Browse thread
[Caml-list] productivity improvement
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Max Skaller <skaller@o...> |
| Subject: | Re: [Caml-list] productivity improvement |
Oleg wrote:
>What are the _simplest_ examples that demonstrate considerable (> 2:1) O'Caml
>vs C++ productivity improvement (in terms of program size) and where can I
>find them?
>
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))
[Hint: it cannot be done without one of:
a) casts, or
b) serious difficulties wth memory management
]
--
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850
-------------------
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