4 ms·
J is a rather odd choice for teaching functional programming. It distinguishes "nouns" (first-order data), "verbs" (first-order functions), and "adverbs"/"conju
by kd0amg 12y ago
J is a rather odd choice for teaching functional programming. It distinguishes "nouns" (first-order data), "verbs" (first-order functions), and "adverbs"/"conjunctions" (essentially second-order functions -- not arbitrarily high order) at the syntax level. This means currying is pretty limited, common higher-order operations like composition (@:) and partial application (&) can only be done to first-order functions, putting functions into data structures gets awkward.
The article doesn't seem to say much about J's treatment of all functions as aggregate operations on arbitrarily high-dimensional arguments. Since functions are "polymorphic in dimensionality", instead of a bunch of nested loops, you write just the loop body. You control the orientation of the loop nest by changing what a function expects as its lowest possible argument dimensionality. This mechanism is what J has that isn't readily available elsewhere, and it's sad to see it left aside.
- avmich 12y agoI think forks and hooks are also interesting higher-order functions.