Skip to content
New issue

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

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

Already on GitHub? # to your account

fix the free variable names #51

Merged
merged 4 commits into from
Sep 20, 2023
Merged

Conversation

hiratara
Copy link

Hello,

I noticed that in the current implementation, the free variables are named incorrectly.

For example, 34(λ45)(λλ56) refers to the third and fourth names of the free variable list in each lambda abstraction, but is printed in c d (λa.d e) (λa.λb.e f). It is correct that the free variables within any lambda abstraction are the same, as in e f (λa.e f) (λa.λb.e f).

@hiratara hiratara force-pushed the free-variable-context branch from a1b6c05 to 71da7a3 Compare September 16, 2023 12:21
Comment on lines +471 to +472
// use a different name than bound variables
from_u32(max_depth + 96 + *i as u32 - depth)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refer to the free variable list while considering depth. Also, avoid using names that might be used for bound variables by using max_depth.

@hiratara hiratara force-pushed the free-variable-context branch from 71da7a3 to 3fdc516 Compare September 16, 2023 12:30
@ljedrz
Copy link
Owner

ljedrz commented Sep 19, 2023

Apologies for not having checked this out yet, I was on vacation. I'll look into it soon, though!

Signed-off-by: ljedrz <ljedrz@gmail.com>
Signed-off-by: ljedrz <ljedrz@gmail.com>
@ljedrz ljedrz merged commit 14fad22 into ljedrz:master Sep 20, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants