:: nacho.hoon
:: Nacci in Hoon
:: The first 1,000 Tribaonacci numbers:
:: +nacci 1.000, ~[0 0 1]
!:
:- %say
|= [* [end=@ud ~] [fibs=(list @ud) limit=@f ~]]
:- %noun
=/ count (lent fibs)
=. fibs (flop fibs)
|^
?: =(0 (lent fibs))
$(fibs ~[1 0])
?: should-exit
(flop fibs)
$(fibs (weld ~[n] fibs))
++ n (reel (scag count fibs) add)
++ should-exit
?: limit
(gte (lent fibs) end)
(gth n end)
--
Comments