
Additionally, since let is “let rec”, it can’t be translated into a lambda expression using that method in all cases, e.g.
let f x = g x
g x = 1
in f 2
==>
(\f -> (\g -> f 2)) (\x -> g x) (\x -> 1)
In the lambda expression, the second g is free, whereas the corresponding g in Haskell is bound.
–
Kyle Marek-Spartz
On Sep 23, 2014, 8:01:29 AM, Barak A. Pearlmutter
It's hard to tell from your example, but if you want, you can translate the let binding directly to lambda calculus and then go from there where the rules are simple.
In Haskell,
let = in
translates to,
( -> )
Although this list might not be for homework problems, there is an element of terminological confusion and a quest for nomenclature in the question that don't seem entirely unreasonable. Even if we're not going to answer the question per se, we shouldn't give hints that are misleading, or true in Scheme and lambda calculus but false in Haskell. $ ghci Prelude> let b = 3:b in take 3 b [3,3,3] Prelude> ( -> take 3 b) (3:b) :3:21: Not in scope: `b' _______________________________________________ Haskell-Cafe mailing list mailto:Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe