by zelphirkalt · 3y ago · 0 comments
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.
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.
Because tradition is a very hard stuff to get rid of. Just like clocks with needles, with 12 sections.
If you assume addition as implicit juxtaposition syntactic operator ⁙⁙ or ⬠⬠ is also damn efficient to represent five plus five (/faɪv.plʌs.faɪv/ in IPA).
In Ruby:
class Fixnum alias_method :plus, :+;end
five=5
five.plus five
Multiple letter "five" is a single symbol, just as the multiple pixel 5 glyph.Now, there is some convenience in having scripturally short symbols when you do your math with paper and pencil, for example posing some additions in column. But that’s all there is to it, pencil convenience.
A concept is a single semantic idea whatever the length of the symbol used to refer to that concept.
You say that like you can just say it, and it's so, but you've got no evidence all symbols are equal even if they are equal in some ways, and Iverson delivered such an utterly convincing argument to the contrary by showing example after example of the exact opposite. You should read it a few times:
https://dl.acm.org/doi/pdf/10.1145/1283920.1283935
> A concept is a single semantic idea whatever the length of the symbol used to refer to that concept.
No, symbols take up real space on the page, on the screen, and in our minds; there are only so many symbols you're going to be able to put in your mind in your career, or in your life, so if there's a way to say some symbols are better than others, then by knowing the better symbols you will among other things, be able to solve bigger problems faster and with fewer bugs. That may not be important to you, but it's important to me!
"+" is a really good symbol. That's why the tradition has been so hard to shake, and that "pencil convenience" has been with us for thousands of years, but "+" isn't that old! For a long time addition was performed with juxtaposition! Just a series of stroke marks like |||| but seriously 5+5 is better than ||||||||||| and nobody can convince me otherwise! I think though, if you aren't convinced by now, I'm not sure what else I can do.
While we have some standardized operators that got into programming languages, we are doing a very poor job of using symbols even for very useful functions. Iverson was, and still is, right about terse notation. However, APL/J/BQN are not flexible enough in this regard. You can’t introduce new symbols. For example, you CAN do “et = +”, but you CAN’T do “• = *”. User-level definition of custom operators would enable APL-family to break out of the diamond world in which they live in.
Mathematical notation is very concise, but I would not call it a great notation in terms of intuitively being clear, which operations to apply in which order or which symbol groups its argument(s) in what way and found myself rather tending to write an extra pair of parentheses, to make things clearer for myself.
There is also the mix of operators and functions. Some computer languages do not mix that, but employ only functions, which makes things clearer as well.
Ok, now do a million plus a million.
Coming back - notation is important, but sometimes it's hard to find "the best" or even "good enough". Newton's primes as symbols of differentiation used alongside with Leibniz' dy/dx, and there is the shortcut for "differentiated by time" as dot on top of the function symbol, so for various cases different notation is more convenient.
Indeed! Much of APL programming is using idioms (≠⊆⊢ for example as split on delimiters)
https://aplcart.info has a good selection too
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.
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".
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.
> 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.
But that's good! It means there are less possible sources of truth, less things to update when something changes, and less context switching.
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.Documentation: 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_9ufMLOB6BAdzO...
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/Ele...
To try out your own expressions, you can use https://tryapl.org/
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.
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.
http://nsl.com/papers/origins.htm
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.
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.
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)Futhark: https://futhark-lang.org/
It definitely doesn't; J is ASCII symbols. See the vocabulary at 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.