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 reduce macromethod to TupleLiteral and ArrayLiteral #5294

Merged
merged 1 commit into from
Nov 18, 2017
Merged

Add reduce macromethod to TupleLiteral and ArrayLiteral #5294

merged 1 commit into from
Nov 18, 2017

Conversation

willhbr
Copy link
Contributor

@willhbr willhbr commented Nov 15, 2017

Just adds a reduce macro method to TupleLiteral and ArrayLiteral.

I'm not sure if there is a reason this was previously excluded, I couldn't find anything previous issues.

end
end
else
raise "Only 0 or 1 args expected for reduce, got #{args.size}"
Copy link
Contributor

Choose a reason for hiding this comment

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

compile-time exceptions messages start with lowercase, like elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

when "reduce"
raise "reduce expects a block" unless block
accumulate_arg = block.args.first?
value_arg = block.args.size >= 2 ? block.args[1] : nil
Copy link
Contributor

Choose a reason for hiding this comment

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

block.args[1]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤙🏻

I will learn, eventually.

@RX14 RX14 added this to the Next milestone Nov 18, 2017
@RX14 RX14 merged commit 818c438 into crystal-lang:master Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants