APL\iv: an APL interpreter and stream processor written in Go
github.com
github.com
>The author has never used APL. It's a chicken and egg problem. (...) All testing has been done with tryapl.org.
There are also a few free software implementations of APL most notably GNU APL. I have been sticking to that while learning APL. https://www.gnu.org/software/apl/
Dyalog is the only implementation that is robust and production ready that is still actively maintained. I would suggest learning with something other than the GNU implementation.
I did request a copy of Dyalog but they rejected my application (probably because I didn't add my address?). I don't have a lot of enthusiasm for learning using a proprietary implementation of a language anyway.
"The APL interpreter is an (almost) complete implementation of ISO standard 13751 aka. Programming Language APL, Extended."
I wish there were more languages like that.
"Ken suggested iota for the counter and, since all three of us (Ken, Robert, Rob) had implemented APL interpreters, it seemed a perfect thing to us." - Rob Pike
Iota in APL is unary operator that generates a vector of consecutive integers starting at the origin up to and including its operand. Iota in Go is a predeclared identifier that can only be used in constant declarations wherein it auto-increments on every use. The resemblance is superficial at best.
> "Ken suggested iota for the counter and, since all three of us (Ken, Robert, Rob) had implemented APL interpreters, it seemed a perfect thing to us." - Rob Pike
Maybe we have just have a different view on what "modeled" means, or I am being too literal. To me, "modeling" implies that something is created with another thing in mind, adhering to the same principles. To relate that to the quote, I wouldn't call the process of coming up with a concept and only afterwards finding a name for it from some handwavely similar concept in another context modeling.
Still, I wouldn't call the resemblance superficial. "iota" in both languages refers to sequences of whole numbers. If "iota" in Go meant "the zero-value for an arbitrary object" or "the smallest non-zero float64," then the two would truly share only a name.
In the latter case, you can say that "A B C←⍳3" (at least in Dyalog) which is roughly equivalent to a Go constant assignment using iota if you squint a little and disregard the underlying procedure of creating and unpacking an array at run-time vs creating a compile-time constant. In the former case, I'm not aware of any analogue.
$, : The output field separator
$ perl -E 'my @data = (11,22,33); say 11,22,33; say "@data"; say @data; $,="|"; say 11,22,33; say "@data"; say @data;'
112233
11 22 33
112233
11|22|33
11 22 33
11|22|33
$" : Interpolated list separator
$ perl -E 'my @data = (11,22,33); say 11,22,33; say "@data"; say @data; $"="|"; say 11,22,33; say "@data"; say @data;'
112233
11 22 33
112233
112233
11|22|33
112233
And a bunch more, including input line/record separators (so you can slurp a whole file into a buffer at once instead of line by line), etc.I've been using Dyalog's GUI, but I'd much rather be using free software from the usual terminal. It'd be nice if there were just a global input method like the ones they have for human languages.
Then add another input method for APL as you would for switching between English, German, French, etc keyboard layouts.
The author has never used APL
I’d like to know more about the underlying motivation! APL is a fascinating language but I’m not sure how you’d implement it efficiently in a language like Go - you would need intrinsics to get at the vector instructions no?