Browse thread
[Caml-list] ocaml killer
[
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: | Florian Hars <hars@b...> |
| Subject: | Re: fancy types (was Re: [Caml-list] ocaml killer) |
Vasile Rotaru wrote:
> The difference between the two versions are in those two calls
>
> (id specialist/..) ; obviously a nop
> and
> (makeblock 0 specialist/..) ; ???
>
> Comments about whether (makeblock 0 ..) is a special case which can be
> optimized away are welcome.
Try
let do_rec (S specialist as spec) n =
if n = 0 then
1
else
n * specialist spec n
instead, and the code becomes a simple spec/..
Isn't it a standard idiom to pass the same cons cell on recursive calls instead
of rebuilding an otherwise identical copy?
Yours, Florian Hars.
-------------------
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