Re: Course-of-value recursion by defining a sequence as a self-referential infinite list
Douglas McIlroy <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.cafe |
|---|---|
| Message-ID | <CAKH6PiV2Hp8DHQ50sH7i8_S68Vm-1VnNURMH37vn_7sSo-mhnA@mail.gmail.com> |
> catalanNumbers :: Num a => [a]
> catalanNumbers =
> let xs = 1 : PowerSeries.mul xs xs
> in xs
This example of a generating function come to life as a program deserves to
be better known. Bill Burge presented it 50 years ago in "Recursive
Programming Techniques", Addison-Wesley, 1975. I revisited it in "Power
series, power serious", JFP 9 (1999) 323-335, where, with overloadied
arithmetic, it became
ts = 1 : ts^2
The technique is laid bare in ten one-liners at
https://www.cs.dartmouth.edu/~doug/powser.html.
Doug
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.