Re: [Haskell-cafe] Bound and free variables

On Mon, 22 Sep 2014 19:30:33 -0400, Michael Orlitzky wrote:
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 <name> = <argument> in <expression>
translates to,
(\<name> -> <expression>) <argument>
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> (\b -> take 3 b) (3:b) <interactive>:3:21: Not in scope: `b'

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

On 23/09/14 16:01, Barak A. Pearlmutter wrote:
On Mon, 22 Sep 2014 19:30:33 -0400, Michael Orlitzky wrote:
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 <name> = <argument> in <expression>
translates to,
(\<name> -> <expression>) <argument>
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.
I am not sure which question in this thread you regard as a homework problem and suggest not answering. Roman

On Tue, Sep 23, 2014 at 11:55:54AM -0400, Michael Orlitzky wrote:
On 09/23/2014 11:31 AM, Roman Cheplyaka wrote:
I am not sure which question in this thread you regard as a homework problem and suggest not answering.
I made a joke. It didn't work.
It did for me at least :)

On Tue, Sep 23, 2014 at 11:59 AM, Tom Ellis < tom-lists-haskell-cafe-2013@jaguarpaw.co.uk> wrote:
On Tue, Sep 23, 2014 at 11:55:54AM -0400, Michael Orlitzky wrote:
On 09/23/2014 11:31 AM, Roman Cheplyaka wrote:
I am not sure which question in this thread you regard as a homework problem and suggest not answering.
I made a joke. It didn't work.
It did for me at least :)
It just confused me, fwiw. (I think Scalzi has a relevant comment.) -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
participants (6)
-
Barak A. Pearlmutter
-
Brandon Allbery
-
Kyle Marek-Spartz
-
Michael Orlitzky
-
Roman Cheplyaka
-
Tom Ellis