Thursday, December 18, 2008

oh god how did this get here i am not good with array languages

You know, learning new programming languages can be very beneficial for yourself, regardless of how you might use them. You'll be exposed to new, interesting concepts and idioms you've never seen before.
So, when can this go wrong? When you try learning a language radically different from any others you've seen before at three in the morning.

Introducing J, an array programming language. What is an array programming language, you ask? Well, first off, they're confusing as hell and trying to read code written in one is like trying to translate hieroglyphs while simultaneously being whacked with cactuses. Angry cactuses.
Here's a good example of some APL (the original array language) code, which J is closely related to:




(implements a version of Conway's Game of Life, though I'm sure you already figure that out)

Yeah, it doesn't even stick to ASCII. J does, though it still manages to be not much more readable:
+/ i.@x:&.(p:^:_1) N

The above returns the sum of all primes less than N.

As cryptic as it might seem from the above, it's actually a pretty cool language. I wouldn't ever use it for general programming purposes before trying Python first, but if I'm working on a Project Euler problem, sometimes it might be quicker to fire up the J interpreter and write a single line of code.

Of course, I've still got no idea as to what the hell I'm doing.

2 comments:

  1. I nearly cried after reading this.

    IT'S SO BEAUTIFUL ^___^

    ReplyDelete
  2. What's up? I'm Pescina at Mahalo. Drop me a line whenever you can, please.

    ReplyDelete

Please be civil. Or if you're going to be uncivil, don't hold back. It's more entertaining that way.