Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
vidarh
8 months ago
|
parent
|
context
|
favorite
| on:
Ruby Blocks
This is your example in Ruby:
isLarge = -> {|a| a > 100 } numbers.filter(&isLarge)
Or you could replace the first line:
isLarge = -> { _1 > 100 }
Some people hate that syntax, though. I think for trivial predicates like this, it's fine.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: