Browse thread
[Caml-list] partial eval question
- Ben Kavanagh
[
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: | Ben Kavanagh <kavabean@l...> |
| Subject: | [Caml-list] partial eval question |
Say I have a function such as pow defined as
let pow n x =
let rec pow_iter (n1, x1, p1) =
if (n1 = 0) then p1
else if (n1 mod 2 = 0)
then pow_iter(n1/2, x1*x1, p1)
else pow_iter(n1-1, x1, p1*x1)
in pow_iter(n, x, 1);;
and I say
let pow2 = pow 2
Are there any ML implementations that would automatically perform
partial evaluation to create pow2 instead of using closures, possibly
unfolding the pow_iter call? Would Caml ever have this capability?
Ben
-------------------
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