Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] productivity improvement
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas barnier <barnier@r...>
Subject: Re: [Caml-list] productivity improvement
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