Hacker News new | ask | show | jobs
by jpf0 1182 days ago
J recursion is $: You can do flow control in both scripting style and array style. Loops are loops.
1 comments

is $ meaningful in verb trains? because that was what I was referring to when I said no loops/recursion/flowcontrol

N.B. a sibling says J has added a direct definition construct while I wasn't watching which renders my comment largely irrelevant although the I feel general point that a lot of J 'example code' tends towards difficult-for-noobs to parse verb trains still holds.

Yes. this one is fun. Recursive, memoized Fibonacci, the 155th integer precisely.

{{(-&2 +&$: -&1) ^: (1&<) M. y}} 155x

It'll run in your browser in 0.003 seconds.

https://jsoftware.github.io/j-playground/bin/html2/#code=%7B...