As usual when reading about languages like this I nod along until suddenly a sentence like this trips me up:

Next I wrote a fill dyad that uses ‘gerunds’ to combine two verbs. The implementation is a bit out of scope, but all it does is replace 0’s in array with a given atom.

appreciate all these comments giving some background to J / APL. My interest is piqued, but it usually takes a few years to go from piqued to into trying… not bad for a chain of languages that started in the late 50s. :D

Yeah, that’s the part of the bit I’m least happy about. I try to write articles where every example presents exactly one new idea, but gerunds were so complicated that I just threw my hands up and said “don’t try to understand, this is J magic”. That doesn’t mean they’re unexplainable, just that explaining them would have taken the article too far off course.

I liked the article because it showed a practical example that wasn’t “say you want to calculate the Eigenvector”. Kudos. Also great layout and presentation.

J is from the APL family, which means it is all about manipulating arrays as concisely as possible. This means it has a lot of features that look really odd at first. The look of the language is one of them: the sort ‘function’ is /:~. It also has no operator precedence, and everything is strictly evaluated right to left. That means that 2 + 2 = 4 is 2, because it’s parsed as 2 + (2 = 4).

On the other hand, it’s really, really good at manipulating arrays. Taking calculating the moving average of an array. Here’s a pure python way I grabbed off SO:

mylist = [1, 2, 3, 4, 5, 6, 7]
N = 3
cumsum, moving_aves = [0], []
for i, x in enumerate(mylist, 1):
cumsum.append(cumsum[i-1] + x)
if i>=N:
moving_ave = (cumsum[i] - cumsum[i-N])/N
#can do stuff with moving_ave here
moving_aves.append(moving_ave)

Clicked thinking this was in Joules… mildly disappointed, then mildly interested in whatever J the language is.

J is one of many ASCII APLs.

As usual when reading about languages like this I nod along until suddenly a sentence like this trips me up:

appreciate all these comments giving some background to J / APL. My interest is piqued, but it usually takes a few years to go from piqued to into trying… not bad for a chain of languages that started in the late 50s. :D

Yeah, that’s the part of the bit I’m least happy about. I try to write articles where every example presents exactly one new idea, but gerunds were so complicated that I just threw my hands up and said “don’t try to understand, this is J magic”. That doesn’t mean they’re unexplainable, just that explaining them would have taken the article too far off course.

I liked the article because it showed a practical example that wasn’t “say you want to calculate the Eigenvector”. Kudos. Also great layout and presentation.

J is from the APL family, which means it is all about manipulating arrays as concisely as possible. This means it has a lot of features that look really odd at first. The look of the language is one of them: the sort ‘function’ is

`/:~`

. It also has no operator precedence, and everything is strictly evaluated right to left. That means that`2 + 2 = 4`

is`2`

, because it’s parsed as`2 + (2 = 4)`

.On the other hand, it’s really,

reallygood at manipulating arrays. Taking calculating the moving average of an array. Here’s a pure python way I grabbed off SO:And here’s the moving average in J:

This would get very very useful if the syntax for going from a fixed array (mylist) to a stream of numbers wasn’t too cumbersome.