Talk:Lambda lifting

From Wikipedia, the free encyclopedia

What's the language used in the code examples? SML, maybe? I think it should be noted in the text. Electrolite 00:58, 16 January 2006 (UTC)

Agree
I totally agree. I am a haskell beginner and got more then one problem to solve. I tried to compile the first code fragment with GHC and failed because of "in sum 100". Please add which language is used !

[edit] Rewriting rules

What do the rewriting rules have to do with anything? The procedure given for lambda lifting looks complete; but then the example includes an extra phase that involves converting the program to rewrite rules. Furthermore the rewrite process seems to be demonstrating the evaluation strategy of a lazy language like Haskell, rather than a strict one like OCaml. In the interests of simplicity and consistency, I think the rewrite rules should be removed. Ezrakilty 10:58, 4 July 2007 (UTC)

[edit] Corrections to the code

While the current code does demonstrate the algorithm, it would be clearer and closer to the meaning of the text if the functions sum and f (after lifting) were made into global functions. In both of the current cases, the entire length of code is contained in a single expression. It's clearer and more common in practice to see it written more like this:

(I don't know O'caml too well, so ignore any minor syntax errors). before:

fun sum n = let f x = n + x in
            if equal n 1
               then 1
               else f (sum (n - 1)) 
sum 100

and after:

fun f x w = w + x
fun sum n = 
            if equal n 1
               then 1
               else f (sum (n - 1)) n
sum 100

Tac-Tics 14:34, 16 September 2007 (UTC)