caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Which control structure?
@ 2007-10-02 18:41 Andrej Bauer
  2007-10-02 22:24 ` [Caml-list] " Andrej Bauer
  0 siblings, 1 reply; 2+ messages in thread
From: Andrej Bauer @ 2007-10-02 18:41 UTC (permalink / raw)
  To: caml-list

I would like to have a control structure which allows me to "copy 
continuations". The idea is to obtain a continuation and then try what 
would happen if we passed it various values.

An example: suppose we have a p : (unit -> bool) -> bool. I want to compute

  (p (fun () -> false), p (fun -> true))

in a particularly strange way (I have my reasons), something like this:

  callcc (fun k ->
     p (fun () -> (callcc l -> k (l false, l true))); raise Badness)

This of course does not make any sense, but I am trying to convey an idea:

- we register the continuation k
- we start evaluating p on our specially crafted argument
- if p never evaluates the specially crafted argument we raise
   an exception
- if p evaluates the special argument, we record "the continuation"
   l and then we want to _evaluate it twice_: once by passing it
   false and once by passing it true. We want to collect the results
   and pass them to the outer continuation k.

I am asking, is there out there (in whatever language) something that 
would let me do this?

Andrej


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

end of thread, other threads:[~2007-10-02 22:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-02 18:41 Which control structure? Andrej Bauer
2007-10-02 22:24 ` [Caml-list] " Andrej Bauer

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