[LRUG] Recursion diversion
Roland Swingler
roland.swingler at gmail.com
Fri Oct 25 07:27:14 PDT 2013
product and its friend combination are really, really useful for solving
these sort of problems in a functional-ish manner. In general it's totally
worth looking over the enumerable/array docs again if you've been
programming ruby since 1.8 and haven't done so - there are loads of new
goodies in there beyond the standard map/select/inject (each_slice and
each_cons can also be really useful).
Cheers,
Roland
On Fri, Oct 25, 2013 at 3:21 PM, Michael Pavling <pavling at gmail.com> wrote:
> On 25 October 2013 15:07, Roland Swingler <roland.swingler at gmail.com>wrote:
>
>> This solves the problem https://gist.github.com/knaveofdiamonds/7155189 -
>> I'm pretty sure it can be made about half as long.
>>
>
> You have a shorter, quicker, better tested solution than me (took me ages
> to find '.product' - haven't used it before)...
>
> https://gist.github.com/Pavling/7155370
>
> This better not be an interview test!!
>>
>
> +1 :-)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20131025/1ae3b655/attachment-0003.html>
More information about the Chat
mailing list