Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 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,
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: