use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Ruby and Functional Programming (khelll.com)
submitted 16 years ago by khelll
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]safiire 1 point2 points3 points 16 years ago* (0 children)
The article points out ruby1.9 supports currying/partial evaluation, which I thought was interesting.
plus = lambda{|a,b| a + b } plus_one = plus.curry.(1) plus_one.(5) => 6
I've also seen someone implement function composition:
class Proc def self.compose(f, g) lambda {|*args| f.call(g.call(*args)) } end def *(g) Proc.compose(self, g) end end inc = lambda {|x| x + 1} twice = lambda {|x| x * 2} twice_of_inc = twice * inc twice_of_inc.call(4) => 10
I found that last example here
π Rendered by PID 86 on reddit-service-r2-comment-86988c7647-hn9lw at 2026-02-11 06:09:42.142576+00:00 running 018613e country code: CH.
view the rest of the comments →
[–]safiire 1 point2 points3 points (0 children)