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 HAA24304; Thu, 18 Dec 2003 07:27:21 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id HAA24225 for ; Thu, 18 Dec 2003 07:27:00 +0100 (MET) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hBI64DH15493; Thu, 18 Dec 2003 07:04:15 +0100 (MET) Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id hBI640T25471; Thu, 18 Dec 2003 00:04:01 -0600 (CST) Date: Thu, 18 Dec 2003 01:05:20 -0600 (CST) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: Nicolas Cannasse cc: Pierre Weis , Falk Hueffner , Subject: Re: [Caml-list] Python's yield, Lisp's call-cc or C's setjmp/longjmp in OCaml In-Reply-To: <004c01c3c504$62407b80$0274a8c0@PWARP> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 python's:01 lisp's:01 c's:01 cannasse:01 pierre:01 weis:01 stupid:01 ocaml:01 nicolas:01 closure:01 tree:02 stack:02 thread:02 wrote:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 18 Dec 2003, Nicolas Cannasse wrote: > > [...] > > > This only works for simple examples. Try for example writing a > > > function which successively yields all possible moves for a chess > > > board. The "yield" operator really helps there. > > > > Very interesting: please give us the code corresponding to this > > example, in order for us to realize how the full power of the "yield" > > operator helps to solve this problem. > > > > Pierre Weis > > > > One simple sample is tree walking : [snip example of a usefull yield] > Doing it using a closure is more difficult, since we need to reproduce the > stack using a data structure. That goes of course for all recursive data > structures. > Stupid question: would it be possible/usefull to have the yielding function run as a seperate thread of execution, in a produce/consumer sort of way? -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- 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