Michel Boaventura
11/13/2007 3:48:00 PM
Try to include time4 on the array, then sort it. Lood in wich position
is time4, then get the time before e after it. Isn't very efficient,
but works :D
2007/11/13, Robert Klemme <shortcutter@googlemail.com>:
> 2007/11/13, Shai Rosenfeld <shaiguitar@gmail.com>:
> >
> > given that time1 < time2 < time3 < time4 ... (and are all Time objects)
> >
> > myarray= [ time1, time2, time3, time4, time5 , time6 , time7 , .. ]
> >
> > special_sort(time4)= [ time3, time4, time5 ]
> >
> > ...basically, passing an arg of a certain obj in the array to a
> > "special_sort" func, how do i collect the "nearest" ones to it? thx for
> > any suggestions
>
> Define "nearest". What happens if time4 is not present in the array
> itself? etc.
>
> Cheers
>
> robert
>
> --
> use.inject do |as, often| as.you_can - without end
>
>