[*:a..:c].inject({}){|h,e|h[e]=h.size+1;h}

I think thats that shortest I can manage. Mind you, I'm crap at golf :P

On Sat, Jul 24, 2010 at 6:30 PM, Ashley Moran
<[email protected]> wrote:
>
> On 24 Jul 2010, at 6:26 PM, Jim Neath wrote:
>
>> and for the sake of golfing:
>>
>> [:a,:b,:c].inject({}){|h,e| h.merge(e => h.size+1)}
>
> Correct about the bang, but only variables count for the golfing ;)
>
> Cheers
> Ash
>
> --
> http://www.patchspace.co.uk/
> http://www.linkedin.com/in/ashleymoran
>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "NWRUG" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/nwrug-members?hl=en.
>
>



-- 
Jim Neath - Manchester based Ruby on Rails Developer
http://jimneath.org

-- 
You received this message because you are subscribed to the Google Groups 
"NWRUG" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nwrug-members?hl=en.

Reply via email to