Skip to content

Instantly share code, notes, and snippets.

@ELLIOTTCABLE
Created December 31, 2009 20:09
Show Gist options
  • Save ELLIOTTCABLE/266886 to your computer and use it in GitHub Desktop.
Save ELLIOTTCABLE/266886 to your computer and use it in GitHub Desktop.
fib ↼ routine {
if { @ x =(0) |(@ x =(1)) } { @ last(1) } {
@ last( callee(@ 1 -(1), ?) +(callee(@ 1 -(2), ?))) }}
fib(5) { print(@) }
fib ↼ routine
if { @x = 0 | @x = 1 } { @last(1) }
@last(callee(@1 - 1, ?) + callee(@1 - 2, ?))
fib(5) { print(@) }
@atg
Copy link

atg commented Apr 27, 2010

With macros (libside sugar)

func fib(n)
if(n == 0 || n == 1)
out n
out fib(n - 1) + fib(n - 2)

Without any libside sugar

fib =
native tools if(@0 == 0 || @0 == 1)
return = @0
return = fib(@0 - 1) + fib(@0 - 2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment