From: Andrej Bauer <Andrej.Bauer@fmf.uni-lj.si>
To: caml-list@yquem.inria.fr
Subject: Which control structure?
Date: Tue, 02 Oct 2007 20:41:00 +0200 [thread overview]
Message-ID: <470290BC.8020604@fmf.uni-lj.si> (raw)
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
next reply other threads:[~2007-10-02 18:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-02 18:41 Andrej Bauer [this message]
2007-10-02 22:24 ` [Caml-list] " Andrej Bauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=470290BC.8020604@fmf.uni-lj.si \
--to=andrej.bauer@fmf.uni-lj.si \
--cc=Andrej.Bauer@andrej.com \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox