Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SKK /= I in chapter 4 #88

Open
reuleaux opened this issue Sep 1, 2016 · 2 comments
Open

SKK /= I in chapter 4 #88

reuleaux opened this issue Sep 1, 2016 · 2 comments

Comments

@reuleaux
Copy link

reuleaux commented Sep 1, 2016

I am working through your wonderful "Write you a Haskell" tutorial, thanks a lot for creating it in the first place.

I have downloaded and compiled the code for chapter 4 (the untyped lambda calculus).

Contrary to the explanations in the text, SKK does not reduce to I in my case, instead I get:

Untyped> (\x y z. x z (y z)) (\x y . x) (\x y . x)
  => \x y z . (x z (y z))
  => \x y . x
 => \x y z . (x z (y z)) (\x y . x)
 => \x y . x
<<closure>>
Untyped>

Recall, that according to the text on page 50 I should see something along the lines of:

Untyped> (\x y z. x z (y z)) (\x y . x) (\x y . x)
  => \x y z . (x z (y z))
  => \y z . ((\x y . x) z (y z))
    => \x y . x
    => \y . z
   => z
 => \z . z
\z . z

I wonder what's going on? Cannot be a huge thing, as the data structures / code base
is relatively small at this point.

Nevertheless, as SKK=I is supposed to be a kind of litmus test, I would like to
get this fixed.

A few more explanations for what's going on in detail in Eval.hs would also be nice
(VClosure, Scope, type Eval = WriterT [Step](State EvalState) a, inc, red, etc)

Thanks.

@sdiehl
Copy link
Owner

sdiehl commented Oct 31, 2016

In this case you get a closure whose value is an identity function (\x -> x).

@reuleaux
Copy link
Author

reuleaux commented Nov 4, 2016

OK, thanks.

Stephen Diehl [email protected] writes:

In this case you get a closure whose value is an identity function (\x -> x).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants