From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id E8474BC69 for ; Tue, 2 Oct 2007 20:41:01 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAIQsAkfBAkMt/2dsb2JhbAA X-IronPort-AV: E=Sophos;i="4.21,221,1188770400"; d="scan'208";a="2028126" Received: from vega.fmf.uni-lj.si (HELO postar.fmf.uni-lj.si) ([193.2.67.45]) by mail1-smtp-roc.national.inria.fr with ESMTP; 02 Oct 2007 20:41:01 +0200 Received: from localhost (unknown [192.168.5.1]) by postar.fmf.uni-lj.si (Postfix) with ESMTP id 47036187F53 for ; Tue, 2 Oct 2007 20:41:01 +0200 (CEST) X-Virus-Scanned: amavisd-new at spam.fmf.uni-lj.si Received: from postar.fmf.uni-lj.si ([192.168.5.5]) by localhost (spam.fmf.uni-lj.si [192.168.5.1]) (amavisd-new, port 10024) with ESMTP id 9E2XIm4OoLdb for ; Tue, 2 Oct 2007 20:41:01 +0200 (CEST) Received: from [192.168.1.101] (BSN-77-148-136.static.dsl.siol.net [193.77.148.136]) (Authenticated sender: bauer) by postar.fmf.uni-lj.si (Postfix) with ESMTP id EBA76187EAD for ; Tue, 2 Oct 2007 20:41:00 +0200 (CEST) Message-ID: <470290BC.8020604@fmf.uni-lj.si> Date: Tue, 02 Oct 2007 20:41:00 +0200 From: Andrej Bauer Reply-To: Andrej.Bauer@andrej.com User-Agent: Thunderbird 1.5.0.13 (X11/20070824) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Which control structure? Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; andrej:01 andrej:01 bool:01 bool:01 exception:01 argument:02 argument:02 evaluates:02 evaluates:02 unit:03 let:03 raise:03 raise:03 passing:05 passing:05 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