Browse thread
Generators/iterators and lazy evaluation?
[
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: | 2007-04-05 (20:40) |
From: | Jon Harrop <jon@f...> |
Subject: | Re: [Caml-list] Generators/iterators and lazy evaluation? |
On Thursday 05 April 2007 06:58, Alain Frisch wrote: > Jon Harrop wrote: > > The moral is: don't try to write idiomatic Python in OCaml. > > I think the moral is rather: read the OP's email more carefully. He > doesn't want to translate some Python examples into OCaml by hand, he > wants to implement a Python interpreter in OCaml. My mistake. In that case, I agree that CPS is the obvious solution. Perhaps it is possible to do something equivalent by explicitly storing the state and "program counter" in the function when yield is called? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. OCaml for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists