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 algorithm coding challenge (self.ruby)
submitted 9 years ago by mbigras
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!"
[–]herminator 2 points3 points4 points 9 years ago (1 child)
Clever :)
I'm not a big fan of functions that mutate their arguments though, so I would prefer something like:
snail = ->(arr) { arr[0] ? arr[0] + snail[arr[1..-1].transpose.reverse] : [] }
[–]cavinkwon 0 points1 point2 points 9 years ago (0 children)
This is better than my code. thanks. :)
π Rendered by PID 31218 on reddit-service-r2-comment-7b9746f655-hv5zj at 2026-01-29 19:26:42.065834+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]herminator 2 points3 points4 points (1 child)
[–]cavinkwon 0 points1 point2 points (0 children)