From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA29443; Fri, 19 Dec 2003 14:40:06 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA29527 for ; Fri, 19 Dec 2003 14:40:04 +0100 (MET) Received: from mail1.tpgi.com.au (mail.tpgi.com.au [203.12.160.57]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hBJDe2X21621 for ; Fri, 19 Dec 2003 14:40:02 +0100 (MET) Received: from 203-219-225-116-syd-ts24-2600.tpgi.com.au (203-219-225-116-syd-ts24-2600.tpgi.com.au [203.219.225.116]) by mail1.tpgi.com.au (8.11.6/8.11.6) with ESMTP id hBJDdmX26545; Sat, 20 Dec 2003 00:39:48 +1100 Subject: Re: [Caml-list] Python's yield, Lisp's call-cc or C's setjmp/longjmp in OCaml From: skaller Reply-To: skaller@ozemail.com.au To: brogoff@speakeasy.net Cc: Falk Hueffner , caml-list In-Reply-To: References: Content-Type: text/plain Message-Id: <1071841186.10294.128.camel@pelican> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 20 Dec 2003 00:39:47 +1100 Content-Transfer-Encoding: 7bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 python's:01 lisp's:01 c's:01 ozemail:01 brogoff:01 falk:01 hueffner:01 callcc:01 callcc:01 threads:01 threads:01 subroutine:01 'easily':99 mechanically:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 2003-12-18 at 06:42, brogoff@speakeasy.net wrote: > On 17 Dec 2003, Falk Hueffner wrote: > In any case, programming this kind of thing in ML is pretty easy, so I don't > think we need an extension to the language for yield. callcc is more powerful, > but I don't like the possibility that making callcc fast penalizes code which > doesn't use it. We have exceptions and threads already. Felix provides the converse of yield -- read. yield returns a value, saving the current position. Read yields *expecting* a value, saving the current position. I'd sure like to know how to do that in (Oca)ML easily (without using threads). In particular, take some aritrary program that reads a structured file read stuff .. do something read stuff do something if condition read stuff .. else read ... for loop .. subroutine calls and do that in ML 'easily'... I don't think the transformation is all that easy to do by hand. (Felix does this transformation mechanically, so I have an idea what is required, the details are trivial .. the amount of transforming is quite laborious though .. and possibly unreadble .. ) ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners