Thank you Rob, I appreciate your help, good explanation.
On Thu, Apr 26, 2018 at 5:02 PM, Rob Biedenharn
wrote:
>
>
> On 2018-Apr-26, at 13:47 , Abdel Latif wrote:
>
> But [["AB_1020", "AB_950", "AB_50"], ["1000", "570"]] has non numerical
>
On Fri, Apr 27, 2018 at 12:12 AM, Abdel Latif wrote:
> But this part .flat_map{|x| x.sort_by {|x|x[/d+/]}.reverse}
>
>
two things look suspicious:
1) /d+/
2) reverse
have you tried randomly rearranging your arrays first?
m
any thanks,
--botp
--
You received this
> On 2018-Apr-26, at 13:47 , Abdel Latif wrote:
>
> But [["AB_1020", "AB_950", "AB_50"], ["1000", "570"]] has non numerical
> values too.
>
> On Thursday, April 26, 2018 at 1:05:53 PM UTC-4, Walter Lee Davis wrote:
>
> > On Apr 26, 2018, at 12:12 PM, Abdel Latif
But [["AB_1020", "AB_950", "AB_50"], ["1000", "570"]] has non numerical
values too.
On Thursday, April 26, 2018 at 1:05:53 PM UTC-4, Walter Lee Davis wrote:
>
>
> > On Apr 26, 2018, at 12:12 PM, Abdel Latif > wrote:
> >
> > Hi,
> >
> > I found this code for sorting an
> On Apr 26, 2018, at 12:12 PM, Abdel Latif wrote:
>
> Hi,
>
> I found this code for sorting an array :
>
> p ["AB_1020", "AB_950", "AB_50", "1000", "570"].partition{|x| x.to_i.zero? }
> .flat_map{|x| x.sort_by {|x|x[/d+/]}.reverse}
> ouptut
>
> #⇒ ["AB_50",
5 matches
Mail list logo