Re: I need help sorting a list

2020-05-24 Thread ToddAndMargo via perl6-users
On 2020-05-24 15:51, Patrick R. Michaud wrote: On Mon, May 25, 2020 at 12:07:22AM +0200, Tobias Boege wrote: @things.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self }) } Or how about even somethig like @things.sort: *.Version; which does handle a reasonable set of

Re: I need help sorting a list

2020-05-24 Thread Patrick R. Michaud
On Mon, May 25, 2020 at 12:07:22AM +0200, Tobias Boege wrote: > @things.sort: { > .comb(/ \d+ | \D+ /) > .map({ .Int // .self }) > } Or how about even somethig like @things.sort: *.Version; which does handle a reasonable set of version semantics...? (The .Version method was

Re: I need help sorting a list

2020-05-24 Thread ToddAndMargo via perl6-users
On 2020-05-24 15:39, ToddAndMargo via perl6-users wrote: On 2020-05-24 15:07, Tobias Boege wrote: On Sun, 24 May 2020, Elizabeth Mattijsen wrote: Hmmm... it appears we need to numerify the match to get numeric comparison semantics, so we put a "+" before the match: $ raku -e 'my @x=.sort: {

Re: I need help sorting a list

2020-05-24 Thread ToddAndMargo via perl6-users
On 2020-05-24 15:07, Tobias Boege wrote: On Sun, 24 May 2020, Elizabeth Mattijsen wrote: Hmmm... it appears we need to numerify the match to get numeric comparison semantics, so we put a "+" before the match: $ raku -e 'my @x=.sort: { +m/ \d+ $/ }; for @x { say $_; }' a1 a2 a5 a123 a133 So

Re: I need help sorting a list

2020-05-24 Thread Tobias Boege
On Sun, 24 May 2020, Elizabeth Mattijsen wrote: > Hmmm... it appears we need to numerify the match to get numeric comparison > semantics, so we put a "+" before the match: > > $ raku -e 'my @x=.sort: { +m/ \d+ $/ }; for @x { say $_; > }' > a1 > a2 > a5 > a123 > a133 > So I think this would be

Re: I need help sorting a list

2020-05-24 Thread Elizabeth Mattijsen
Hmmm... it appears we need to numerify the match to get numeric comparison semantics, so we put a "+" before the match: $ raku -e 'my @x=.sort: { +m/ \d+ $/ }; for @x { say $_; }' a1 a2 a5 a123 a133 > On 24 May 2020, at 21:49, ToddAndMargo via perl6-users > wrote: > > >>> On 24 May 2020,

Re: I need help sorting a list

2020-05-24 Thread Tobias Boege
On Sun, 24 May 2020, ToddAndMargo via perl6-users wrote: > On 2020-05-24 02:24, Elizabeth Mattijsen wrote: > > dd .sort: { m/ \d+ $/ } > > > > Hi Elizabeth, > > This seems to work: > >$ raku -e 'dd .sort: { m/ \d+ $/ };' >("a5", "a6", "a33", "a111").Seq > > > But I can't figure out

Re: I need help sorting a list

2020-05-24 Thread ToddAndMargo via perl6-users
On 24 May 2020, at 10:43, ToddAndMargo via perl6-users wrote: Hi All, https://docs.raku.org/routine/sort I need help sorting a list. This is the list of values I want to sort: H:\MyDocsBackup\backup1 H:\MyDocsBackup\backup2 H:\MyDocsBackup\backup126 H:\MyDocsBackup\backup3

Re: I need help sorting a list

2020-05-24 Thread Elizabeth Mattijsen
dd .sort: { m/ \d+ $/ } > On 24 May 2020, at 10:43, ToddAndMargo via perl6-users > wrote: > > Hi All, > > https://docs.raku.org/routine/sort > > I need help sorting a list. > > This is the list of values I want to sort: > > H:\MyDocsBackup\backup1 > H:\MyDocsBackup\backup2 >

I need help sorting a list

2020-05-24 Thread ToddAndMargo via perl6-users
Hi All, https://docs.raku.org/routine/sort I need help sorting a list. This is the list of values I want to sort: H:\MyDocsBackup\backup1 H:\MyDocsBackup\backup2 H:\MyDocsBackup\backup126 H:\MyDocsBackup\backup3 H:\MyDocsBackup\backup33 H:\MyDocsBackup\backup6 This is what I want back: