From: Brian Adkins Date: 2008-11-08T06:43:03+09:00 Subject: Re: Finding gaps in a sorted sequence Robert Dober writes: > On Fri, Nov 7, 2008 at 9:28 AM, Brian Adkins wrote: >> Martin DeMello writes: > >> I still think I like it best though because it seems to be the most >> natural Ruby solution to the original problem. > Well not quite, it does not return nil if there is no gap, D'oh! I missed that. Ok, I guess I like my version best again then :) > one has to > check if the return value is the last element of the array > and replace it with nil in that case. > One should know that inject is quite slow, but no reason not to use it > unless performance is a problem. > > Cheers > Robert > -- > C'est v�ritablement utile puisque c'est joli. > > Antoine de Saint Exup�ry > -- Brian Adkins http://www.lojic.com/ http://lojic.com/blog/