Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #16968 > unrolled thread

Recursive Lists

Started byArnold Doray <invalid@invalid.com>
First post2012-11-02 08:48 +0000
Last post2012-11-02 08:48 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.forth


Contents

  Recursive Lists Arnold Doray <invalid@invalid.com> - 2012-11-02 08:48 +0000

#16968 — Recursive Lists

FromArnold Doray <invalid@invalid.com>
Date2012-11-02 08:48 +0000
SubjectRecursive Lists
Message-ID<k701di$9k6$1@dont-email.me>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web