Advertisement
Guest User

Hoon 151 Fibonacci function

a guest
Apr 5th, 2016
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. ++ fib :: ++ - arm of a core
  2. |= a/@ :: |= - gate (like a function)
  3. ~+ :: ~+ - memoization hint
  4. ?~ a :: ?~ - if-zero then else
  5. ~| %fib-zero !! :: ~| - print this if we crash, !! - crash here
  6. ?: &(=(a 1) =(a 2)) :: ?: - if then else, &(a b) - logical and, =(a b) - equality test
  7. 1
  8. (add $(a (sub a 2)) $(a (sub a 1))) :: (a [etc]) - application, like Lisp, $(a a1, b b1, ...) - evaluate $
  9. :: ($ is the empty name of the gate we are inside) but with a replaced with a1, etc.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement