Fibonacci numbers in FP
Example for versions
Interactive FP
This example works in a same way as the factorial one, but without readability functions added.
{ seq ( = @ [id, %1] -> %<1> ; concat @ [ seq @ - @ [id, %1] , [id] ] ) }
{ fibonacci ( < @ [id, %3] -> %1 ; + @ [ fibonacci @ - @ [id, %1], fibonacci @ - @ [id, %2] ] ) }
&fibonacci @ seq:16
Comments
]]>blog comments powered by Disqus
]]>