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 KAA27155; Thu, 11 Jul 2002 10:57:10 +0200 (MET DST) 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 KAA27151 for ; Thu, 11 Jul 2002 10:57:09 +0200 (MET DST) Received: from indigo.recherche.enac.fr (indigo.recherche.enac.fr [195.220.158.66]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g6B8v8D29548 for ; Thu, 11 Jul 2002 10:57:08 +0200 (MET DST) Received: from recherche.enac.fr (unknown [10.31.1.89]) by indigo.recherche.enac.fr (Postfix) with ESMTP id AE7D2B9A1 for ; Thu, 11 Jul 2002 10:57:07 +0200 (CEST) Message-ID: <3D2D4863.EC9D1EB3@recherche.enac.fr> Date: Thu, 11 Jul 2002 10:57:07 +0200 From: Nicolas barnier Reply-To: barnier@recherche.enac.fr X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.12 i686) X-Accept-Language: en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] productivity improvement References: <200207081952.PAA28813@hickory.cc.columbia.edu> <3D2C5538.2090901@ozemail.com.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk John Max Skaller wrote: > > Try doing this in C++: > > type 'a node = Leaf of 'a | Unop of ('a->'a) * node | Binop of ('a * > 'a -> 'a) > let rec eval n = match n with > | Leaf i -> i > | Unop (f,n) -> f (eval n) > | Binop (f,n1,n2) -> f ((eval n1), (eval n2)) Just if some newbie wants to copy and paste this piece of code, there is a small mistake in the type: type 'a node = Leaf of 'a | Unop of ('a->'a) * 'a node | Binop of ('a * 'a -> 'a) * 'a node * 'a node;; -- Nicolas ------------------- 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