Browse thread
[Caml-list] [ANN] The Missing Library
-
John Goerzen
-
Kenneth Knowles
- Alexander V. Voinov
-
John Goerzen
-
Maxence Guesdon
-
John Goerzen
- Maxence Guesdon
-
John Goerzen
-
Alain.Frisch@e...
-
John Goerzen
-
Alain.Frisch@e...
-
Nicolas Cannasse
-
Yamagata Yoriyuki
- Gerd Stolpmann
-
Nicolas Cannasse
-
Yamagata Yoriyuki
- Jacques GARRIGUE
- Nicolas Cannasse
-
Yamagata Yoriyuki
-
Yamagata Yoriyuki
-
Nicolas Cannasse
- oliver@f...
-
Alain.Frisch@e...
-
John Goerzen
- Henri DF
- Shawn Wagner
- james woodyatt
-
Alain.Frisch@e...
- Basile STARYNKEVITCH
-
John Goerzen
- Kenneth Knowles
- Florian Hars
-
Maxence Guesdon
- Eric C. Cooper
-
Kenneth Knowles
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2004-04-29 (12:30) |
From: | Andreas Rossberg <rossberg@p...> |
Subject: | Re: [Caml-list] [ANN] The Missing Library |
skaller wrote: > > Sure like to see a monadic/lazy solution to > the example using streams .. Admittedly, I'm too lazy ( :-) ) to give an example right now, but the idea behind the lazy solution is very simple: for iteration, your collection provides a function that delivers a list of all items. You can then iterate over it as you would normally do for lists. However, the important point is: the list is constructed lazily (in OCaml, by using the type I showed in my previous posting, or something similar). That is, only when you try to match the next item, i.e. the tail of the stream (in OCaml, by forcing it) it is actually computed. Thereby, the client takes control over the iteration. Note that lazy functional languages can often perform optimizations like deforestation to avoid actual construction of the intermediate list. Cheers, - Andreas -- Andreas Rossberg, rossberg@ps.uni-sb.de Let's get rid of those possible thingies! -- TB ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners