Tuesday, June 26, 2012

Curry in Ruby

While I was wandering around Proc and Lambda in Ruby, I found very useful method Proc#curry. This method answer the question that bugs me for a while, is there an easy way to make Curry happen in Ruby? Let look at the example how to use it.

Start with a simple method: Manually currying: But with Proc#curry, you can heavily simplify your code like this: Pretty neat!

No comments:

Clojure has lesser typing error problems than the others well-known dynamic typing languages

Give these snippets a try. // JS function foo () {   bar(1) } # Ruby def foo   bar(1) end ; Clojure (defn foo []    (bar 1)) As yo...