caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Continuations
@ 2006-08-30 15:24 Tom
  2006-08-30 17:08 ` [Caml-list] Continuations Jacques Carette
  0 siblings, 1 reply; 4+ messages in thread
From: Tom @ 2006-08-30 15:24 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 97 bytes --]

Has anyone implemented continuations in pure, dirty OCaml yet?

(pure = no C, dirty = Obj.magic)

[-- Attachment #2: Type: text/html, Size: 107 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Continuations
  2006-08-30 15:24 Continuations Tom
@ 2006-08-30 17:08 ` Jacques Carette
  0 siblings, 0 replies; 4+ messages in thread
From: Jacques Carette @ 2006-08-30 17:08 UTC (permalink / raw)
  To: Tom; +Cc: caml-list

It can be done in pure, clean Ocaml.  See
http://caml.inria.fr/pub/ml-archives/caml-list/2006/07/530ba0e13ce88fab8ee0e981d65b70b1.en.html
as well as
http://caml.inria.fr/pub/ml-archives/caml-list/2006/02/8fc9c1a56c497b9743515a5e3432d704.en.html

If you want delimited continuations, see
http://caml.inria.fr/cgi-bin/hump.en.cgi?contrib=508

Jacques

Tom wrote:
> Has anyone implemented continuations in pure, dirty OCaml yet?
>
> (pure = no C, dirty = Obj.magic)
> ------------------------------------------------------------------------
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>   


^ permalink raw reply	[flat|nested] 4+ messages in thread

* continuations
  1997-05-07 16:24 continuations Lyn A Headley
@ 1997-05-09  1:35 ` Frank Christoph
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Christoph @ 1997-05-09  1:35 UTC (permalink / raw)
  To: caml-list

>>>>> "Lyn" == Lyn A Headley <laheadle@midway.uchicago.edu> writes:
> hi, I was reading an article about language implementation in Standard ML
> (slightly annoying name isn't it?) which described a continuation-passing
> interpreter.  It seems that in sml, continuations are simply unit -> unit
> functions.  So it seems that any language with higher-order functions is
> capable of passing continuations.  This is not the impression I get from the
> Scheme camp, who seem to think that continuations are a special form that
> only a few almighty languages support.  Anyone know the full story?

It doesn't take any special facility to use continuations if you are writing
in CPS (continuation-passing style) or monadic style; either technique can be
used in any functional language.  For example, functional parsers are often
written in this way.  On the other hand, if you want to be able to capture the
current continuation in a functional language in any piece of code (i.e., in
so-called direct style), the interpreter or compiler has to be able to save
the current context, duplicate it, discard it and reinstate it later on.
Compilers or interpreters that support that are said to support first-class
continuations.  It turns out that in fact the New Jersey implementation of SML
does have first-class continuations; I believe they are typed as "'a cont",
where "cont" is a special type constructor that is hard-wired into the
language.

Any good book on functional programming will outline at least the basics of
continuation-passing style, but books that use Scheme make more frequent use
of them because Scheme happens to be the a language that supports first-class
continuations.  (In fact, you can make a good case that any eager language
should support them.)

-- 
Frank Christoph                 Next Solution Co.      Tel: 0424-98-1811
christo@nextsolution.co.jp                             Fax: 0424-98-1500





^ permalink raw reply	[flat|nested] 4+ messages in thread

* continuations
@ 1997-05-07 16:24 Lyn A Headley
  1997-05-09  1:35 ` continuations Frank Christoph
  0 siblings, 1 reply; 4+ messages in thread
From: Lyn A Headley @ 1997-05-07 16:24 UTC (permalink / raw)
  To: caml-list

hi,

I was reading an article about language implementation in Standard ML
(slightly annoying name isn't it?) which described a
continuation-passing interpreter.  It seems that in sml, continuations
are simply unit -> unit functions.  So it seems that any language with
higher-order functions is capable of passing continuations.  This is
not the impression I get from the Scheme camp, who seem to think that
continuations are a special form that only a few almighty languages
support.  Anyone know the full story?

Lyn





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-08-30 17:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-30 15:24 Continuations Tom
2006-08-30 17:08 ` [Caml-list] Continuations Jacques Carette
  -- strict thread matches above, loose matches on Subject: below --
1997-05-07 16:24 continuations Lyn A Headley
1997-05-09  1:35 ` continuations Frank Christoph

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).