Hacker News new | ask | show | jobs
by usgroup 935 days ago
I tried J (Iverson's successor to APL) in earnest but struggled to understand what I was supposed to do when I needed data structures other than arrays. E.g. tries, trees, hash tables and so on. The majority of the out-of-the-box vocabulary is centered on arrays, so it seemed that either you convert your problem to some kind of an array representation, or go somewhere else.
2 comments

i've also tried learning J and can't really say i've managed it yet, but i think the idea is that everything is an array. in J an array can contain a box, and a box might contain an array, so you have nested arrays, (different from multidimensional arrays.)

lisp baffled me for a while because, in my mind, a list is different from a tree, but in lisp a list element might be itseld a list, and so a lisp list might be a tree. similar situation with J arrays.

i'm not sure how APL does it. i /think/ it uses a flat array model, but i'm not sure what that means exactly, or if it's even applicable to modern APL, let alone what it might imply about bending APL arrays into other data structures.

J has primitives (like I. and i. and e. and the primitives which set up for their use) which serve some of those roles.

But, yes, approaches which use some kind of array representation are highly favored by the language (and by other languages, to varying degrees, once you understand the patterns and issues).