f1a=: 3 : 0 {. y f1a 0 1x : if. *x do. (x-1) f1a +/\|.y else. y end. ) f1b=: {.@($:&0 1x) : ((<:@[ $: +/\@|.@])^:(*@[))
http://progopedia.com/example/fibonacci/452/
http://dfns.dyalog.com/n_fibonacci.htm
This is a nice introduction into APL:
https://www.youtube.com/watch?v=_DTpQ4Kk2wA
And this is how APL is applied in the right way:
https://www.youtube.com/watch?v=a9xAKttWgP4
/first n+2 numbers of fibonacci sequence fibonacci:{{x,sum -2#x}/[x;0 1]};
q) fibonacci[10] 0 1 1 2 3 5 8 13 21 34 55 89
http://www.jsoftware.com/jwiki/Essays/Fibonacci%20Sequence
This:
f0b=: (-&2 +&$: -&1) ^: (1&<) M.
is probably the most elegant solution. It's recursive ($: stands for "self-reference"), memoized, and it works:
f0b&.> i.20
│0│1│1│2│3│5│8│13│21│34│55│89│144│233│377│610│987│1597│2584│4181│