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 number.one?, .zero?, .negative?; condition val in true?, false?, null?, & when blocks #26

Merged
merged 1 commit into from Jun 18, 2019

Conversation

Projects
None yet
2 participants
@catb0t
Copy link
Contributor

commented Jun 17, 2019

new methods to number: one?, zero?, negative?

new language feature: true?, false?, null? and when are now compatible with the following form

true? COND, { C | 
  C # => COND 
}, { C |
  C # => COND
} 

the condition value (before it was converted to true, false or null) is available in both of the branch functions. hopefully, it is not re-evaluated until used.

if the taken branch is not a function, the condition won't be used for anything further.
the condition should only be realised in the branch where it is used.

Also, there's a bunch of trailing whitespace changes, because my editor strips trailing whitespace on file save.

@presidentbeef presidentbeef merged commit 72b0e35 into presidentbeef:master Jun 18, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@presidentbeef

This comment has been minimized.

Copy link
Owner

commented Jun 18, 2019

Awesome!

Thank you 🙇

@presidentbeef

This comment has been minimized.

Copy link
Owner

commented Jun 18, 2019

I wanted to mention how excited I am about passing the conditional to the branches!

In Ruby I'm always writing stuff like

if x = some_thing
  # ...
end

Most people think that's bad style. So I've been wondering how to make a "good" way of doing the same thing...and you did it! I never even considered this approach. It's very cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.