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

Don't force booleans to return #t/#f in if #4

Open
khoborerkagoj opened this issue Jan 4, 2017 · 0 comments
Open

Don't force booleans to return #t/#f in if #4

khoborerkagoj opened this issue Jan 4, 2017 · 0 comments

Comments

@khoborerkagoj
Copy link
Owner

From the tutorial exercise 1.4.3:
Consider the expression (if (fx> 3 4) (fxadd1 3) (fxlognot 5)):
fx> first compares it arguments, generates 0 or 1, and then returns #t or #f depending on the result.
if then evaluates the result, compares to #f, and then decides what to do.

The fix would be to have a different definition of emit-expr which would just generate 1 or 0 as the result of the boolean expression. This alternate form would be called only from the test expression of an if, so would not affect results. This would save us in the creation of the boolean.

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

No branches or pull requests

1 participant