<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/12/052649193f7443e5fad49ddd9dbe05f7"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-18T00:15:15"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml"
  prev="2003/12/f6e4f3915780cad48789ef64a0624577"
  next="2003/12/a8c52bf4ae153acf2af4c9fccd7a479c"
  prev-in-thread="2003/12/bf33bfec2c564f71b03f23afcf441aca"
  next-in-thread="2003/12/e8f2fdd8daaa77e7297afe895e600af3"
  prev-thread="2003/12/774646ec595322579ea76517edc01410"
  next-thread="2003/12/49cb44539cd1e5dc776c6a8f345e0a04"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/f0d20744dca590b72fee31849f8ef5a8"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-16T13:13:20"
  subject="[Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/bf33bfec2c564f71b03f23afcf441aca"
  from="Oleg Trott &lt;oleg_trott@c...&gt;"
  author="Oleg Trott"
  date="2003-12-16T13:28:13"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/052649193f7443e5fad49ddd9dbe05f7"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-18T00:15:15"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
</msg>
</msg>
<msg 
  url="2003/12/e8f2fdd8daaa77e7297afe895e600af3"
  from="Ville-Pertti Keinonen &lt;will@e...&gt;"
  author="Ville-Pertti Keinonen"
  date="2003-12-16T13:48:01"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/01e78a00f853a1ce4d39b398b9afb114"
  from="Kenneth Knowles &lt;kknowles@u...&gt;"
  author="Kenneth Knowles"
  date="2003-12-16T15:44:06"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/e9d5dc1f43b97ae6ac0b88e55734a825"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-12-16T16:45:41"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/346cf0f17cf25f0a13da2cfa8edf4234"
  from="Ville-Pertti Keinonen &lt;will@e...&gt;"
  author="Ville-Pertti Keinonen"
  date="2003-12-16T18:36:42"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/12/88fc2c8210caaa7c1abe39d783755b7f"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-12-16T17:40:58"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/40790bf3984b821df7900e88d90f42ac"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-12-16T18:10:39"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/5d2b8084aba6efbe7ecad855a7b3fddc"
  from="ijtrotts@u..."
  author="ijtrotts@u..."
  date="2003-12-17T06:29:27"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/1f4371b3bf98c5187ba2a9e7dbda1b49"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-12-17T08:13:15"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
</msg>
<msg 
  url="2003/12/850360ffe8d0d409f2af993875710c0d"
  from="Falk Hueffner &lt;falk.hueffner@s...&gt;"
  author="Falk Hueffner"
  date="2003-12-17T10:36:03"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/0d6d04a011e30722187b8606b72e19f6"
  from="Pierre Weis &lt;pierre.weis@i...&gt;"
  author="Pierre Weis"
  date="2003-12-17T19:14:30"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/8edface9abeaaa61e00ef1a62a6c512c"
  from="Falk Hueffner &lt;falk.hueffner@s...&gt;"
  author="Falk Hueffner"
  date="2003-12-17T19:32:23"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
</msg>
<msg 
  url="2003/12/777e01692302f33698e7b6cb5d3e6839"
  from="David Brown &lt;caml-list@d...&gt;"
  author="David Brown"
  date="2003-12-17T20:04:11"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
</msg>
<msg 
  url="2003/12/ac2f915dbdd9a3f399cc73b8be16246d"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2003-12-18T01:15:27"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/744adfd5672c3969872e3d4872e7741f"
  from="David Brown &lt;caml-list@d...&gt;"
  author="David Brown"
  date="2003-12-18T05:32:02"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
</msg>
<msg 
  url="2003/12/1c4b3799107085f07200a724dd0cc444"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-12-18T06:27:21"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/4a1681fc89e77e8a070727585335ceeb"
  from="David Brown &lt;caml-list@d...&gt;"
  author="David Brown"
  date="2003-12-18T06:46:06"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
</msg>
</msg>
<msg 
  url="2003/12/93c3b2ec873addb64754bf56a09fb0a7"
  from="brogoff@s..."
  author="brogoff@s..."
  date="2003-12-18T18:44:30"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
</msg>
</msg>
</msg>
<msg 
  url="2003/12/f43d6ac0112ef047d18d7386d09e7f89"
  from="brogoff@s..."
  author="brogoff@s..."
  date="2003-12-17T19:43:06"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
<msg 
  url="2003/12/e9e19245af4d01fc23cbaecd9a62ba86"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-12-19T13:40:06"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
</msg>
</msg>
</msg>
<msg 
  url="2003/12/a8c52bf4ae153acf2af4c9fccd7a479c"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-18T00:51:23"
  subject="Re: [Caml-list] Python&apos;s yield, Lisp&apos;s call-cc or C&apos;s setjmp/longjmp in OCaml">
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
I've lumped together a bunch of answers to not spam the list too much.

Oleg Trott wrote:
&gt; call/cc is Scheme, Common Lisp has "throw" instead, and ML has
&gt; "raise".

Thanks for the reply, but I was aware that OCaml has exceptions.

Seth J. Fogarty wrote:
&gt; Um.... does lisp have call/cc, I thought that was only scheme? But
&gt; in any case, look at exceptions. They provide a very similar control
&gt; flow arrangement to continuations (although they are weaker).

Thanks.

Ville-Pertti Keinonen wrote:
&gt; There are many different things you could be referring to, some of
&gt; which OCaml does have (exceptions), some of which it doesn't
&gt; (coroutines, first-class continuations, generators etc.).

Well, indeed it was the three latter examples you gave that I was
looking for.

&gt; First-class, capturable continuations are one of the things I often
&gt; wish OCaml had, but implementing them efficiently would require
&gt; significant changes to the execution model.
&gt;
&gt; SML/NJ has efficient first-class continuations, so it's clearly
&gt; possible, even in the presence of native compilation and exceptions.

That's nice to know! Yes, I'd wish for capturable continuations as
well - but living without them is certainly possible.

Brian Hurt wrote:
&gt; By my measurements, Ocaml's exceptions are faster than C's
&gt; setjmp/longjmp.  Ocaml doesn't provide first-class continuations,
&gt; but most of the things people actually do with call-cc can be done
&gt; in other ways in Ocaml.  I don't know what Python's yield
&gt; instruction does.

Ah yes, I should have been more specific. I was looking for things
that are possible with first-class continuations - but also something
weaker, as Python's yield.

&gt; What do you want to do?

Well, what I was looking for is a way to suspend the execution of
something, and come back to it later. Exceptions provide me a way from
getting out of odd places, but not a way back in those odd places.

Python's yield is just a limited form of suspending executing
something, and continuing it later.

-- Naked

-------------------
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

</contents>

</message>

