Browse thread
[Caml-list] Python's yield, Lisp's call-cc or C's setjmp/longjmp in OCaml
[
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: | 2003-12-19 (13:40) |
From: | skaller <skaller@o...> |
Subject: | Re: [Caml-list] Python's yield, Lisp's call-cc or C's setjmp/longjmp in OCaml |
On Thu, 2003-12-18 at 06:42, brogoff@speakeasy.net wrote: > On 17 Dec 2003, Falk Hueffner wrote: > In any case, programming this kind of thing in ML is pretty easy, so I don't > think we need an extension to the language for yield. callcc is more powerful, > but I don't like the possibility that making callcc fast penalizes code which > doesn't use it. We have exceptions and threads already. Felix provides the converse of yield -- read. yield returns a value, saving the current position. Read yields *expecting* a value, saving the current position. I'd sure like to know how to do that in (Oca)ML easily (without using threads). In particular, take some aritrary program that reads a structured file read stuff .. do something read stuff do something if condition read stuff .. else read ... for loop .. subroutine calls and do that in ML 'easily'... I don't think the transformation is all that easy to do by hand. (Felix does this transformation mechanically, so I have an idea what is required, the details are trivial .. the amount of transforming is quite laborious though .. and possibly unreadble .. ) ------------------- 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