Re: I need sorting help

2024-03-16 Thread ToddAndMargo via perl6-users
On 3/2/24 05:13, Elizabeth Mattijsen wrote: $ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ (try .Numeric) // $_}).List) afoo2 afoo12 On 2 Mar 2024, at 07:26, ToddAndMargo via perl6-users wrote: Hi All, @Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self

Re: I need sorting help

2024-03-09 Thread Ralph Mellor
On Sat, Mar 9, 2024 at 7:52 PM yary wrote: > how to sort by alpha & numeric segments (b3b, a1a, c20c) => (a1a, b3b, c2c) Ahhh. D'oh. Thanks!  Now I see what was required, or at least think I do: .sort: {m:g/ \d+{make +$/} | \D+{make ~$/} /».made} That does what was meant, right? -- love,

Re: I need sorting help

2024-03-09 Thread yary
Using my quick-intuition, are these methods sorting on the earliest number withing the string, ignoring the non-digits? $ raku -e '.say for .sort: {m/ \d+ /.Int}' $ raku -e '.say for .sort: +*.match: / \d+ /' let's see $ raku -e '.say for .sort: {m/ \d+ /.Int}' it1 does2 not3 matter10 what20

Re: I need sorting help

2024-03-07 Thread Ralph Mellor
On Tue, Mar 5, 2024 at 7:01 AM ToddAndMargo via perl6-users wrote: > >> $ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ > >> (try .Numeric) // $_}).List)' > >> > >> Yippee! > > raku -e '.say for .sort: { .comb(/ \d+ | \D+ /).map({ > > .Int // .self }).cache };' > > Awesome! Now I have

Re: I need sorting help

2024-03-04 Thread ToddAndMargo via perl6-users
On 3/4/24 23:01, ToddAndMargo via perl6-users wrote: No I have Sould have been Now I have

Re: I need sorting help

2024-03-04 Thread ToddAndMargo via perl6-users
On 3/4/24 22:09, Bruce Gray wrote: On Mar 4, 2024, at 15:55, ToddAndMargo via perl6-users wrote: --snip-- $ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ (try .Numeric) // $_}).List)' bk1 bk2 bk10 bk34 Yippee! tony@rn6:/home/linuxutil1$ raku -e '.say for .sort: { .comb(/ \d+ |

Re: I need sorting help

2024-03-04 Thread Bruce Gray
> On Mar 4, 2024, at 15:55, ToddAndMargo via perl6-users > wrote: --snip-- > $ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ (try > .Numeric) // $_}).List)' > bk1 > bk2 > bk10 > bk34 > > Yippee! > > > tony@rn6:/home/linuxutil1$ raku -e '.say for .sort: { > .comb(/ \d+ | \D+ /)

Re: I need sorting help

2024-03-04 Thread ToddAndMargo via perl6-users
On 3/4/24 13:55, ToddAndMargo via perl6-users wrote: On 3/4/24 12:40, Ralph Mellor wrote: On Sat, Mar 2, 2024 at 6:26 AM ToddAndMargo via perl6-users wrote: @Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self })}; In case another answer is helpful... First, a

Re: I need sorting help

2024-03-04 Thread ToddAndMargo via perl6-users
On 3/4/24 12:40, Ralph Mellor wrote: On Sat, Mar 2, 2024 at 6:26 AM ToddAndMargo via perl6-users wrote: @Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self })}; In case another answer is helpful... First, a simplified sort that produces the same result as your

Re: I need sorting help

2024-03-04 Thread Ralph Mellor
> @Sorted_List .= sort: *.match: / \d+ /; > ... > @Sorted_List .= sort: +*.match: / \d+ /; Or perhaps easier to understand: @Sorted_List .= sort: {m/ \d+ /.Str} vs @Sorted_List .= sort: {m/ \d+ /.Int} love, raiph

Re: I need sorting help

2024-03-04 Thread Ralph Mellor
On Sat, Mar 2, 2024 at 6:26 AM ToddAndMargo via perl6-users wrote: > > @Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self > })}; In case another answer is helpful... First, a simplified sort that produces the same result as your code above: @Sorted_List .= sort:

Re: I need sorting help

2024-03-02 Thread Clifton Wood
Easy multisort! my @h = ( { name => "albert", age => 40, size => 2 }, { }, { ); # ({age => 40, name => albert, size => 2} {age => 69, name => albert, size => 3} {age => 22, name => andy, size => 3}) On Sat, Mar 2, 2024 at 9:29 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote:

Re: I need sorting help

2024-03-02 Thread ToddAndMargo via perl6-users
On 3/2/24 05:13, Elizabeth Mattijsen wrote: .sort(*.split(/\d+/, :kv).map({ (try .Numeric) // $_}).List) Hi Elizabeth, It works perfectly. Thank you! I have no idea why, I will ask you in another post -T

RE: I need sorting help

2024-03-02 Thread Mark Devine
Elizabeth, I have been looking for that one to sort operating system devices. Exceptional timing! Thanks, Mark Devine (202) 878-1500 -Original Message- From: Elizabeth Mattijsen Sent: Saturday, March 2, 2024 8:14 AM To: ToddAndMargo via perl6-users Subject: Re: I need sorting help

Re: I need sorting help

2024-03-02 Thread Elizabeth Mattijsen
$ raku -e '.say for .sort(*.split(/\d+/, :kv).map({ (try .Numeric) // $_}).List) afoo2 afoo12 > On 2 Mar 2024, at 07:26, ToddAndMargo via perl6-users > wrote: > > Hi All, > > @Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self > })}; > > gives me > > Element

I need sorting help

2024-03-01 Thread ToddAndMargo via perl6-users
Hi All, @Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self })}; gives me Element [0] Element [1] Element [2] Element [3] Element [4] Element [5] Element [6] Element [7] Element [8] Element [9] I need it to say