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

Party time with Ruby:

  orders.map(&:total)
... Where :total is a symbol, and & is asking :total for the Proc version of itself (a Proc being an anonymous function of sorts), and map is then calling that Proc with a single argument (an order from the list of orders).

More detail: http://stackoverflow.com/a/1217114/3528



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: