Skip to content

Instantly share code, notes, and snippets.

@texodus
Created October 31, 2013 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save texodus/7252252 to your computer and use it in GitHub Desktop.
Save texodus/7252252 to your computer and use it in GitHub Desktop.
True: Bool
False: Bool
`if (a) then (b) else (c)` = match a with
True = b
False = c
`if (a) { (b) } else { (c) }` = if a then b else c
`if (a) { (b) } else (c)` = if a then b else c
`if (a); (b) else (c)` = if a then b else c
`fun (x) = (y)` = fun x -> y
`λ (x) -> (y)` = fun x -> y
`λ (x) = (y)` = fun x -> y
`\ (x) -> (y)` = fun x -> y
`\ (x) = (y)` = fun x -> y
`let (a) (b) = (c); (d)` = let a = fun b -> c; d
`let (a) (b) (c) = (d); (e)` = let a = fun b -> fun c -> d; e
`(a) = (b); (c)` = let a = b; c
`(a) (b) = (c); (d)` = a = λ b -> c; d
`(a) (b) (c) = (d); (e)` = a = λ b -> λ c -> d; e
fib n = if n == 0 {
0
} else if n == 1 {
1
} else fib (n - 1) + fib (n - 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment