Skip to content

Instantly share code, notes, and snippets.

@zeekay
Created October 15, 2010 07:25
Show Gist options
  • Save zeekay/627771 to your computer and use it in GitHub Desktop.
Save zeekay/627771 to your computer and use it in GitHub Desktop.
let square x = x *. x;;
square 10;;
def square(x): x**x
square(10)
let rec fib n = if n < 2 then 1 else fib(n-1) + fib(n-2);;
fib 10;;
rec fib(n):
if n < 2:
1
else:
fib(n-1) + fib(n-2)
or even just
rec fib(n): if n <2 then 1 else fib(n-1) + fib(n-2)
fib(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment