From: MikkelFJ Date: 2001-10-04T05:26:06+09:00 Subject: [ruby-talk:22028] Re: Infinite lists "HarryO" wrote in message news:20011002.233106.1939964443.8852@zipworld.com.au... > However, the most useful facility discussed in the article is the merging > of such sequences and I'm having problems working out how to get that > going. I haven't looked at the Ruby / Perl way to address infinite lists. But streams a.k.a. lazy streams are fundamental features of pure functional programming languages like Haskell and Clean. Laziness can be implemented by storing functions instead of values in a list, and this is probably what is done in the Ruby / Perl case. Streams can be used for parsers where subexpressions are merged together to larger expressions. The merge process is accomplished with something called a combinator. The parsers are called combinator parsers. This is not specific to parsers and prettyprinters - these are just favorite examples. There is a chapter in the clean book about combinator parsers. http://www.cs.kun.nl/~clean/ Mikkel