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

Add _ as an alias for ans, and disallow assignments to both #314

Merged
merged 2 commits into from
Jun 25, 2022

Conversation

triallax
Copy link
Collaborator

Fixes #159.

If you want me to pull out the the commit that disallows assignment to ans and _ to a separate PR, I'm okay with that.

Comment on lines +499 to +500
when (n == "_" || n == "ans") $
fail ("'" <> n <> "' is a reserved variable name")
Copy link
Owner

Choose a reason for hiding this comment

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

👍

Comment on lines +915 to +920
test "'ans' and '_'" do
let env1 = initialEnvironment
env2 = (repl fmtPlain env1 "5").newEnv
env3 = (repl fmtPlain env2 "_ * 20").newEnv

expectOutput env3 "1" "ans / 100"
Copy link
Owner

Choose a reason for hiding this comment

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

👍

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

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

Cool - Thank you!

@triallax triallax merged commit 353b042 into sharkdp:master Jun 25, 2022
@triallax triallax deleted the add-_-support branch June 25, 2022 13:19
@sharkdp
Copy link
Owner

sharkdp commented Jun 25, 2022

Deployed to https://insect.sh/

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

Successfully merging this pull request may close these issues.

Add _ as an alias for ans
2 participants