April 30, 2004

Learn a new language - J

It's good for you to learn a new programming language every now and again and the more you'll learn from it the better, so it's probably best to pick something quite different to any that you already know. Therefore, on the recommendation of Romilly Cocking, I've chosen J, invented by Kenneth E. Iverson - the inventor of APL. Romilly assured me that I'd be able to become proficient in a matter of only 2 or 3 years ;-)

J has really succinct syntax for mathematical things.

Some examples:
a list of the numbers 6, 4 and 9 is 6 4 9
each item in that list squared is 6 4 9 ^ 2
2 to the power of each item in that list is 2 ^ 6 4 9
a list from 0 to 9 is i.10
therefore, a list from 1 to 10 is 1 + i.10

J doesn't just handle one dimensional lists of numbers, but rather multidimensional matrices.
For example:

6 4 9 ^/ 2 3

produces a matrix of 6, 4 and 9 squared and 6, 4 and 9 cubed, i.e.:

36 216
16 64
81 729

that matrix with 1 added to every item is simply:

1 + 6 4 9 ^/ 2 3

produces:

37 217
17 65
82 730

Another cute example is a random lottery ticket generator (thanks to Adewale Oshineye for this):

sort 1 + 6?49

I've been learning by following the tutorials that it comes with - they are very good but sometimes goes off into mathematics that is way beyond anything I understand.

J also comes with graphing and some demo applications including solitaire! There's so much more but I won't be covering it here - find out for yourself.

Posted by ivan at April 30, 2004 7:52 PM
Copyright (c) 2004-2007 Ivan Moore
Comments

and when you're finished with J you can learn k

Posted by: simon at October 5, 2004 4:17 PM