Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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: