in reply to Re: Fibo Golf challenge on 3 monkeys
in thread Fibo Golf challenge on 3 monkeys
or alternately:.say for 1,1...{$^a+$^b}
The latter is likely to be more efficient, since it calls the builtin addition operator without the extra layer of function call implied by the first one (unless we get really fancy with the optimizer and notice it's an identity wrapper)..say for 1,1...&infix:<+>
Either of these works because the ... operator is defined to pass the last N numbers in the list repeatedly to the generator function, where N is determined by the arity of the function, which is 2 in this case.
|
---|