[
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: | -- (:) |
| From: | Andrej Bauer <Andrej.Bauer@f...> |
| Subject: | Which control structure? |
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