Given a recursive factorial definition:
fact←{{⍵ × fact ⍵-1}⍣(⍵>2)⊢1⌈⍵}
[written by Kacper Gutowski in the 'Recursive Lambda' thread]
I am attempting to write a basic accumulator. This should take an empty vector as the left value argument, and a rank 1 array as the right value argument.
Every iteration it should drop a value from the right value, and append it to the left, until the right value is an empty vector.
I thought I'd be able to do something like the following:
acc←{⍺,{acc 1↑⍵}⍣(0=⍴⍵)⊢⍵}
⍬ acc 1 2 3
But modifying this to say, add a 1 to every number, still returns the input vector ⍵.
Thoughts?