Crazy operators: J, a different creature

Warning to non-geek readers: This might be the most in-bred geek-talk posting ever to be made on this blog. Bear with me. Skip this post if functional programming and “different” languages is not on your plate. The web is bigger than this blog: check *it* out instead of my ramblings. If you are interested, read on.

[My appreciation of Lisp](http://www.43things.com/people/progress/olleolleolle/1265627) is still in its infancy, and I have had some positive learning experiences over at Mental’s blog, [Moonbase](http://moonbase.rydia.net/), where he talks about [Monads in Ruby](http://moonbase.rydia.net/mental/writings/programming/monads-in-ruby/00introduction.html), (via [Redhanded](http://redhanded.hobix.com/inspect/mentalOnMonadsInRuby.html)).

After that I got side-tracked – again, and found myself reading Wikipedia articles. After reading a little on the quirky IBM-invented language [APL](http://en.wikipedia.org/wiki/APL_programming_language) (A Programming Language, written by [a guy called Iverson](http://en.wikipedia.org/wiki/Kenneth_E._Iverson)), I side-tracked over to [J](http://www.jsoftware.com/) (the ASCII implementation of APL, also by Iverson), which uses English language as its “naming pool” for its concepts. That enables statements like this:

> “Every verb has a dyadic and a monadic implementation.”

That is: `+` in the context `+1000` and in the context `1977 + 28` is bound to different functions. Most “verbs” are overloaded like this.

The thing with J is that many of the operators look like they’re from the Black ASCII Lagoon, dig these monadic ones: `+: *: -: %:`

Yeah, us folks from non-APL cultures read the colon as “assignment”, and most often it works like that, but these operators look like they have been run over by a bus.

But for all its quirkiness in looks, it seems very “orthogonal” — that is, you get what you expect, when you already know what to expect. (It’s like all the manuals for Greenlandic were in Greenlandic. Only.)

But there is [cool stuff in there](http://www.jsoftware.com/jwiki/Primer/WordFormation) as well: The `:;` monad returns a visual representation of “what the words are in a sentence”, a sentence being a statement. So you can slice up your language run-time, I guess. I speculate. That visual representation is done with some ASCII art, little boxes with numbers and characters in them.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>