Revolucent

nacci.hoon

Apr 12th, 2021 (edited)
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. :: nacho.hoon
  2. :: Nacci in Hoon
  3. :: The first 1,000 Tribaonacci numbers:
  4. :: +nacci 1.000, ~[0 0 1]
  5.  
  6. !:
  7. :- %say
  8. |= [* [end=@ud ~] [fibs=(list @ud) limit=@f ~]]
  9. :- %noun
  10. =/ count (lent fibs)
  11. =. fibs (flop fibs)
  12. |^
  13.  
  14. ?: =(0 (lent fibs))
  15. $(fibs ~[1 0])
  16. ?: should-exit
  17. (flop fibs)
  18. $(fibs (weld ~[n] fibs))
  19.  
  20. ++ n (reel (scag count fibs) add)
  21.  
  22. ++ should-exit
  23. ?: limit
  24. (gte (lent fibs) end)
  25. (gth n end)
  26.  
  27. --
  28.  
Add Comment
Please, Sign In to add comment