Browse thread
Re: [Caml-list] queasiness about Exit
- Krishnaswami, Neel
[
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: | -- (:) |
| From: | Krishnaswami, Neel <neelk@c...> |
| Subject: | Re: [Caml-list] queasiness about Exit |
Andreas Rossberg [mailto:rossberg@ps.uni-sb.de] wrote: > > For real mapping (as opposed to iteration) terminating early makes > little sense. For iteration and folds it does. It is not too difficult > to provide variations of iter and folds for your data structures that > allow early breaks. For example, consider: > > BTW, this is one of the few problems where lazy evaluation > can play out its strengths: in a lazy language you do not need > variations of iteration with early termination - you will always > "terminate early" automatically. I posted a similar question to comp.lang.functional a few months ago, and Dan Wang showed me how I could use monads to make a regular fold do that. I actually wanted to thread a state through a fold, but IIRC the technique will generalize to any monad (such as the exception or continuation monad). Google reveals that the thread is at: http://groups.google.com/groups?threadm=slrn9ig78d.gpl.neelk%40brick.cswv.co m -- Neel Krishnaswami neelk@cswcasa.com ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr