Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Recursive Lists

35 views
Skip to first unread message

Arnold Doray

unread,
Nov 2, 2012, 4:48:51 AM11/2/12
to
Dear Forthers,

I have made a tiny extension to Mini (mini.terraweather.com) so
you can now define recursive lists using the words {: and ;}

For example, an infinite list generating the Fibonacci series would be

{:
dup 1 cons 0 cons
dup tail ' + zipwith
;}

.S
<1> com.terraweather.mini.seq.ZipWith@1f8b81e3 ok

1000 take .list
1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946
17711 ...

Haskell has something similar:

fibs = 0 : 1 : zipWith (+) fibs (tail fibs)

Cheers,
Arnold

0 new messages