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

Relational operators should return scheme bool values #1

Open
ramyaragupathy opened this issue Feb 28, 2018 · 2 comments
Open

Relational operators should return scheme bool values #1

ramyaragupathy opened this issue Feb 28, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@ramyaragupathy
Copy link
Owner

Input Current Output Expected output
(> 6 5 4) 4 #t
(> 1 2 3) false #f
(> 5 4) 4 #t

This is more to do with the way functions are written for relational operators. All the relational operator functions use array.reduce to return a value. If the expected condition is met, then the second element is returned, else false is returned. So in case of true statements, the value of the last element is the console output.Just returning true from the reduce function means loosing out on the second value, without which comparison could not be made.

@ramyaragupathy ramyaragupathy added the invalid This doesn't seem right label Feb 28, 2018
@ramyaragupathy
Copy link
Owner Author

@mukeshm suggestions here please?

@ramyaragupathy ramyaragupathy added bug Something isn't working and removed invalid This doesn't seem right labels Feb 28, 2018
@mukeshm
Copy link

mukeshm commented Feb 28, 2018

We can convert the expression (> 6 5 4) into 6 > 5 && 5 > 4 which evaluates to boolean in js and then convert that boolean into lisp representation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants