6 ms·
I intend to, at some point, learn a readable array oriented programming language. I heard that J fits that bill. Any other suggestions? What I mean by "readabl
by zelphirkalt 4y ago
I intend to, at some point, learn a readable array oriented programming language. I heard that J fits that bill. Any other suggestions?
What I mean by "readable" is, that it uses ASCII strings and actual names, not merely 1 character (except for very few cases where 1 character might be appropriate, like "Y" or stuff like that) as function names, instead of symbols, of which I do not know their names. I should be able to not only write once, but read again easily. I should not need a special keyboard or special keyboard layout to write programs in the language.
- leprechaun1066 4y agoSounds like you want q: https://code.kx.com/q/ref/ https://code.kx.com/q/ref/ https://code.kx.com/q4m3/ https://code.kx.com/q4m3/
- testybesty2 4y agoTo build on this: k is a bit like APL, but more concerned with lists rather than multi-dimensional arrays. It uses normal symbols that are easily accessible on your keyboard like + and !, but they are seriously overloaded. q is built on top of k, and take all the monadic overloads of the operators and gives them a name. So instead of writing !5 to get a list of the first 5 integers, you write til 5 This is sort of what the original comment is getting at (I think)
- mseepgood 4y agohttps://github.com/robpike/ivy https://github.com/robpike/ivy Documentation: https://pkg.go.dev/robpike.io/ivy#pkg-overview https://pkg.go.dev/robpike.io/ivy#pkg-overview Also see these Advent of Code 2021 solutions with Ivy: https://www.youtube.com/playlist?list=PLrwpzH1_9ufMLOB6BAdzO08Qx-9jHGfGg https://www.youtube.com/playlist?list=PLrwpzH1_9ufMLOB6BAdzO...
- rscho 4y agoJ has a library for what you describe, but I doubt you'll like it given your description. What you described is another language called Nial.
- Y_Y 4y agoI guess you're referring to this: https://github.com/danlm/QNial7 https://github.com/danlm/QNial7
- HopenHeyHi 4y agoSomebody always mentions BQN, so: https://mlochbaum.github.io/BQN/ https://mlochbaum.github.io/BQN/ I keep eyeballing that thing. But I am afraid that like only 7 people use it and it isn't a good longterm investment. No idea.
- icen 4y agoI think if you're looking at learning an array language in order to learn an array language, because of the oft-discussed change in perspective and technique, then I think BQN meets that very handily. BQN is, in my opinion, the most slick of the array languages; it consistently takes the best of the approaches to high-rank arrays and combinator (including tacit) programming from the others. Some things are unique, and amazing, like structural under. It is small, it is new, so I would agree with your hesitation to start a business based on it, but to understand these languages or use it for the typical small calculations, it is more than capable.
- HopenHeyHi 4y agoWell, I read: http://nsl.com/papers/origins.htm http://nsl.com/papers/origins.htm https://github.com/zserge/odetoj https://github.com/zserge/odetoj And watched a few neat videos on the concepts of APL. There's a black and white one on YouTube of a British fellow introducing it using a typewriter. :) I vaguely get it, my beef with BQN besides being slow is that it is fledgling. And so I have no real excuse to play with it. Otherwise it seems like a holy grail, like, woah finally an APL/J/K to rule them all. I've seen enough wide eyed salty lispers telling tales of white whales to fear for my sanity going on this quest. Need some sort of lie to buy into like "BQN beyond a superior array language is so fast you could bang out half a page of code in a few minutes and get insane performance and functionality that no mere mortals with their aliensquiggles-less languages can hardly even conceive of". What kind of half assed cult are you running, haha. No, I refuse to get sucked in. You will not nerd snipe me. Must. Resist.
- icen 4y agoDo you have any examples that come to mind of it being slow? My experience has been that I've been the slowest part of my code, by a long way. Some optimisations aren't quite there (like under on higher rank arrays not being as fast as computing the indices on the flattened array), but everything else has been good.
- geocar 4y ago> What I mean by "readable" is, that it uses ASCII strings and actual names, not merely 1 character I urge you to reconsider: That they are 1-character is an extremely important feature of Iverson's work. > instead of symbols, of which I do not know their names Why do we write 5+5 and not five plus five? The symbols are important! Gosh, can you even remember not knowing how to do addition? Don't you remember how much easier adding things up became once you learned "+"? Most of Iverson's ideas for symbols really good -- so good that if you do learn their names and everything about them you will have the most amazing ideas as significant a change in you as learning "+" > I should not need a special keyboard or special keyboard layout to write programs in the language. You don't need anything of the sort, but if you can't touch-type in APL you might want keycaps, because I think connecting the idea with a single symbol or unique idea is harder if you keep having to translate to English all the time.
- abrudz 4y agoAPL Mnemonics: https://dyalog.tv/APLSeeds23/?v=qZtb4XOLdkI https://dyalog.tv/APLSeeds23/?v=qZtb4XOLdkI
- gigatexal 4y agoIf the symbols are just functions then they can have longer-than-one-character names. A(x,y) is no different than add(x,y) no?
- ruste 4y agoThe advantage of single character concatenated symbols is that it allows your brain to group them rather than forcing you to read them separately. This means you almost unconsciously build up a bunch of set of instantly recognizable "chunks" of symbols that represent concepts you're familiar with. Each of these chunks can represent the equivalent of a huge amount of code in another language.
- bear8642 4y ago> bunch of set of instantly recognizable "chunks" Indeed! Much of APL programming is using idioms (≠⊆⊢ for example as split on delimiters) https://aplcart.info https://aplcart.info has a good selection too
- pasquinelli 4y agosomeone already mentioned q, so i'll add nial https://www.nial-array-language.org/examples/ https://www.nial-array-language.org/examples/
- tluyben2 4y agoAs said by others: you should reconsider and learn the symbols or k or j or Klong which use your normal keyboard. In k there are very few commands and it won’t take you long to learn them and in your head, at first, say things like 5 cut range 9 etc. You don’t notice after a while, like a natural language sinking in, that you don’t do this anymore and the symbols just ‘arrive’ instead; you will find patterns and type idioms faster than it would take you to look up (let alone learn how to use it etc) the npm in js let’s say. At that time you would not really enjoy not having mastered symbols but words instead. Also, nothing keeps you from implementing names functions in k or j out of the 1 letter ones; 3#!9 / original 0 1 2 take:{x#y} / or take:# take[3;!9] / 1 readable function 0 1 2 range:{!x} / or range:!: take[3;range[9]] / all readable functions 0 1 2 take[3] range[9] 0 1 2 In k. You can make a readable lib, but I wouldn’t.
- xelxebar 4y ago> I should be able to not only write once, but read again easily. Once you overcome the admittedly very steep learning curve of APL, it tends to actually be more readable than Algol-likes in many respects. In fact, counter-intuitively, the single-character symbols actually contribute a lot to its readability. This is, in part, similar to the reason that "a^2 + b^2 = c^2" is usually preferred over "The sum of the squares of the orthogonal sides of a right triangle is commensurate with the square of the hypotenuse," assuming you've done your homework and know basic algebra, equational reasoning, and all that. In my experience, I see something like a 100X reduction in code size. This means that on my editor screen, right now, just by moving my eyeballs, I can read code that would be scattered over 10s of files in Python. This is the stronger sense in which APL is more readable, and by a large margin, to boot. Seriously, APL is tons of fun. I feel like it would be tragic to let a few small preconceptions cut off the potential for you to give it an honest go. Also, the J and APL communities are each quite distinctive. FWIW, I've have a particularly good experience with the people using Dyalog APL.
- psychoslave 4y ago>"a^2 + b^2 = c^2" is usually preferred over "The sum of the squares of the orthogonal sides of a right triangle is commensurate with the square of the hypotenuse," These two expression doesn’t carry the same level of information. At best the first, without additional contextual information can only be interpreted as into "The surface of two square equals to a third", or more directely "a·squared plus b·squared gives c·squared".
- xelxebar 4y agoHehe. You are absolutely right. I was hoping someone would point that out because it highlights another strong point of APL, in my opinion. APL expressions, just like mathematical formula, don't just float alone in a void in practice. They exist within a context, some problem domain, surrounding code and/or equations, etc. Just how the equation "a^2 + b^2 = c^2" can encode equivalence relations between different structures, depending on context, APL expressions take on interesting, semantically useful meanings when applied to a particular problem domains. The reason I call this a strong point of APL is that, in "normal" languages we tend to re-encode that extra domain-specific information all over the place at the micro level—within function names, type signatures, and more pertinently in the abstractions we make. APL enables (but doesn't demand) us to let that information manifest directly at the macro level, without erasing the unused potential semantics of the raw algebraic expression. This is something that practicing mathematicians get intuitively, I believe. Take category theory, for instance, where commutative diagrams in their most abstract form really are Abstract Nonsense™, but their power comes from instantiating them into specific categories, without having to erase the information about the fact that the same diagram also applies within other categories. That kind of thing really tickles the natural abilities of human pattern matching in a productive way.
- skruger 4y agoIf that’s what you really want, you end up with numpy, which — whilst efficient in its niche — ends up as a pale imitation of the real thing. I’d urge you to try a modern APL to really experience the power of the Iverson vision.
- useerup 4y ago> Any other suggestions? Futhark: https://futhark-lang.org/ https://futhark-lang.org/
- sanjayjc 4y agoAPL entered my consciousness when I wandered into a talk at a conference, where those cryptic symbols first confounded, then intrigued me. Now that I've learning a bit, here's how I explain it. While in elementary school we learned the symbol "-" is a very compact way to convey the powerful ideas of subtraction (when placed between operands: "3-2") and negation ("-5"). The insight underlying APL is that this idea can be extended further. When working with matrices (2d arrays), the operations of (a) checking the shape of an array and (b) reshaping arrays are so frequent that APL designates a single symbol for them: "⍴" (which to me looks like an iron bar whose end was "reshaped" into a loop). In the same way as "-", compact symbols aid communication and also comprehension. Since the symbols aren't alphanumeric, whitespace separators aren't necessary to delimit tokens. Just as "10-7" means the same thing as "10 - 7", "3⍴4" and "3 ⍴ 4" are equivalent (it means a 1d array comprising 3 fours: 4 4 4). What has helped me has been learning from the inventor himself: Iverson wrote books that introduced the symbols in a very natural way. The one I'm working through now (and which I highly recommend) is "Elementary Algebra", available for free download here: https://www.softwarepreservation.org/projects/apl/Papers/ElementaryAlgebra https://www.softwarepreservation.org/projects/apl/Papers/Ele... To try out your own expressions, you can use https://tryapl.org/ https://tryapl.org/
- jodrellblank 4y ago> "a readable array oriented programming language. I heard that J fits that bill. What I mean by "readable" is, that it uses ASCII strings and actual names, not merely 1 character" It definitely doesn't; J is ASCII symbols. See the vocabulary at https://code.jsoftware.com/wiki/NuVoc https://code.jsoftware.com/wiki/NuVoc - those things in the coloured boxes like ": and ;. and {: are the J building blocks and the quotes and brackets don't pair up. If you want words and "actual names", you need something else.