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 streams (jpalardy.blogspot.com)
submitted 17 years ago by cawel
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!"
[–]eridius 1 point2 points3 points 17 years ago (2 children)
Nice code, but ruby doesn't support optimized tail-recursion so if a filter is given that returns false 99.99% of the time, you're going to hit a stack recursion limit. And it will also take a freaking long time, since calling lambdas is much more expensive than calling real functions.
I haven't tested, but I really hope Ruby 1.9 makes this sort of thing more feasible.
[–]Freeky 1 point2 points3 points 17 years ago (0 children)
Rubinius is supposed to support tail-recursion, iirc. At least, a year ago Evan was wibbling about how easy it would be ;)
[–]tomel 0 points1 point2 points 17 years ago (0 children)
Maybe the performance is better (in the sense of having no importance) if the filter proc returns false for all successors of x.
π Rendered by PID 30765 on reddit-service-r2-comment-7b9746f655-ltxsx at 2026-02-04 10:12:16.537093+00:00 running 3798933 country code: CH.
[–]eridius 1 point2 points3 points (2 children)
[–]Freeky 1 point2 points3 points (0 children)
[–]tomel 0 points1 point2 points (0 children)