I need some examples of implementing curry function in ruby(1.8.6 or 1.8.7 not 1.9).
I need some examples of implementing curry function in ruby(1.8.6 or 1.8.7 not 1.9).
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
So here’s how to do currying with blocks, rather than methods:
And it works fairly well in practice. Arguments can be curried or not, and
extra arguments are collected as usual:
I made the design decision to have no-arg blocks return an immediate value on currying:
This is necessary to avoid having to end currying with a
[]every time (and is fairly Haskell-like).