Paste: Fibonacci

Author: Mitch
Mode: factor
Date: Wed, 29 Sep 2010 21:48:29
Plain Text |
! Create the Fibonacci sequence up to max

: fib-help ( max seq -- seq' ) dup 2 tail* sum
    swap [ [ > ] 2keep ] dip swap suffix
    rot [ fib-help ] [ nip but-last ] if ;

: fib ( max -- seq ) { 1 1 } fib-help ;

New Annotation

Summary:
Author:
Mode:
Body: