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

merged 1 commit into from Jun 18, 2019


Copy link

@catb0t catb0t 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
Copy link

@presidentbeef presidentbeef commented Jun 18, 2019


Thank you 🙇‍♂️

Copy link

@presidentbeef presidentbeef 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
  # ...

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
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants