3 ms·
Quick, what does the i stand for in "for (i=0; i<n; i++) {"? It was a quick prototype written by one APLer, for another APLer, using mutually understood conven
by silentbicycle 16y ago
Quick, what does the i stand for in "for (i=0; i<n; i++) {"?
It was a quick prototype written by one APLer, for another APLer, using mutually understood conventions. For example, its dyadic verbs ("V2" functions) use the variable names 'a' and 'w'. For a while, I wondered why (maybe they stood for "Arthur" and "Whitney"?), but after reading Iverson's _A Programming Language_, I realized APL usually uses lowercase alpha (α) and omega (ω), which look like 'a' and 'w' in ASCII. Details like that would need no explanation.
Likewise, in
typedef struct a{I t,r,d[3],p[2];}*A;
t is type (is it boxed? 0 or 1), r is rank (number of dimensions), d is the dimensions (hardcoded to a max of 3; a 2x3x4 matrix has d={2,3,4}), and p is a variable-length array sized by malloc-ing extra space; that's where the values go, either longs or void pointers). That'll save you some time if you ever try to pick the rest apart. :)
APL code is often terse to the point of seeming cryptic, just math papers are. You get used to it, and it's that way for a reason.
- ehsanul 16y agoWow, thanks for that clue. Will have to take a closer look at that source now. I don't feel too bad for not really getting it, given the creator of J saying this about it: My immediate reaction on seeing the page was recoil and puzzlement: it looked nothing like any C code I had ever seen. (“Is it even C?”) However, Ken counselled that I should reserve judgment. As recounted in An Implementation of J, it then happened that: I studied this interpreter for about a week for its organization and programming style; and on Sunday, August 27, 1989, at about four o’clock in the afternoon, wrote the first line of code that became the implementation described in this document. The name “J” was chosen a few minutes later, when it became necessary to save the interpreter source file for the first time.
- silentbicycle 16y agoIf it intrigues you, check out Henry Rich's _J for C Programmers_. There's a free PDF on Lulu, and it's included with J (http://www.jsoftware.com/ http://www.jsoftware.com/). Like Emacs, J's internal documentation is excellent, but you have to learn its idiosyncratic terminology before you can actually find things.