Re: split /(..)*/, 1234567890

2005-05-13 Thread Markus Laire
but an Array of Match-objects: pugs map { ref $_ } split /(..)*/, 1234567890 (::Str, ::Array::Const) pugs map { ref $_ } [split /(..)*/, 1234567890][1] (::Match, ::Match, ::Match, ::Match, ::Match) pugs map { ~$_ } [split /(..)*/, 1234567890][1] ('12', '34', '56', '78', '90

Re: split /(..)*/, 1234567890

2005-05-13 Thread Jody Belka
On Thu, May 12, 2005 at 07:13:22PM +0200, Jody Belka wrote: sepsepsepsepsepsep | | | | | | 11 22 33 44 55 66 | | | | | | field field field field field field whoops. add an extra

Re: split /(..)*/, 1234567890

2005-05-13 Thread mark . a . biggar
No, it's not inconsistant. Think about the simpler case split /a/,'a' which return a list of empty strings. Now ask to keep the separators split /(a), 'a' which will return ('', 'a', '', 'a', '', 'a', '', 'a, '', 'a'). Now look at split /(a)/, 'aaab' which returns ('', 'a', '', 'a',

Re: split /(..)*/, 1234567890

2005-05-12 Thread TSa (Thomas Sandlaß)
Autrijus Tang wrote: pugs split /(..)*/, 1234567890 ('', '12', '34', '56', '78', '90') Is this sane? Why the empty string match at the start? -- $TSa == all( none( @Larry ), one( @p6l ))

Re: split /(..)*/, 1234567890

2005-05-12 Thread Autrijus Tang
On Thu, May 12, 2005 at 04:53:06PM +0200, TSa (Thomas Sandla) wrote: Autrijus Tang wrote: pugs split /(..)*/, 1234567890 ('', '12', '34', '56', '78', '90') Is this sane? Why the empty string match at the start? I don't know, I didn't invent that! :-) $ perl -le 'print join

Re: split /(..)*/, 1234567890

2005-05-12 Thread TSa (Thomas Sandlaß)
Autrijus Tang wrote: I don't know, I didn't invent that! :-) $ perl -le 'print join ,, split /(..)/, 123' ,12,3 Hmm, perl -le 'print join ,, split /(..)/, 112233445566' ,11,,22,,33,,44,,55,,66 For longer strings it makes every other match an empt string. With the Positions between chars

Re: split /(..)*/, 1234567890

2005-05-12 Thread David Storrs
On May 12, 2005, at 11:59 AM, Autrijus Tang wrote: On Thu, May 12, 2005 at 04:53:06PM +0200, TSa (Thomas Sandla) wrote: Autrijus Tang wrote: pugs split /(..)*/, 1234567890 ('', '12', '34', '56', '78', '90') Is this sane? Why the empty string match at the start? I don't know, I didn't

Re: split /(..)*/, 1234567890

2005-05-12 Thread Aaron Sherman
On Thu, 2005-05-12 at 12:22, David Storrs wrote: On May 12, 2005, at 11:59 AM, Autrijus Tang wrote: On Thu, May 12, 2005 at 04:53:06PM +0200, TSa (Thomas Sandla) wrote: Autrijus Tang wrote: pugs split /(..)*/, 1234567890 ('', '12', '34', '56', '78', '90') Why the empty

Re: split /(..)*/, 1234567890

2005-05-12 Thread Jonathan Scott Duff
that was matched in the output is because that's what you've asked split to do by placing parens around the pattern. (Type perldoc -f split at your command prompt and read all about it) To bring this back to perl6, autrijus' original query was regarding $ pugs -e 'say join ,, split

Re: split /(..)*/, 1234567890

2005-05-12 Thread Uri Guttman
JSD == Jonathan Scott Duff [EMAIL PROTECTED] writes: JSD To bring this back to perl6, autrijus' original query was regarding JSD $ pugs -e 'say join ,, split /(..)*/, 1234567890' JSD which currently generates a list of ('','12','34','56','78','90') JSD In perl5 it would generate

Re: split /(..)*/, 1234567890

2005-05-12 Thread Jody Belka
On Thu, May 12, 2005 at 06:29:49PM +0200, TSa (Thomas Sandla?) wrote: perl -le 'print join ,, split /(..)/, 112233445566' ,11,,22,,33,,44,,55,,66 [snipped] perl -le 'print join ,, split /(..)/, 11223' ,11,,22,3 Am I the only one who finds that inconsistent? Maybe, but it's because you're

Re: split /(..)*/, 1234567890

2005-05-12 Thread Jonathan Scott Duff
On Thu, May 12, 2005 at 01:12:26PM -0400, Uri Guttman wrote: JSD == Jonathan Scott Duff [EMAIL PROTECTED] writes: JSD To bring this back to perl6, autrijus' original query was regarding JSD$ pugs -e 'say join ,, split /(..)*/, 1234567890' JSD which currently generates

Re: split /(..)*/, 1234567890

2005-05-12 Thread Larry Wall
On Thu, May 12, 2005 at 12:03:55PM -0500, Jonathan Scott Duff wrote: : I think that the above split should generate a list like this: : : ('', [ '12','34','56','78','90']) Yes, though I would think of it more generally as ('', $0, '', $0, '', $0, ...) where in this case it just

Re: split /(..)*/, 1234567890

2005-05-12 Thread Jonathan Scott Duff
On Thu, May 12, 2005 at 12:01:59PM -0700, Larry Wall wrote: On Thu, May 12, 2005 at 12:03:55PM -0500, Jonathan Scott Duff wrote: : I think that the above split should generate a list like this: : : ('', [ '12','34','56','78','90']) Yes, though I would think of it more generally as

Re: split /(..)*/, 1234567890

2005-05-12 Thread Autrijus Tang
expands to ['12','34','56','78','90'] if you treat it as an array. Exactly so. Principle of least surprise wins again! ;) Thanks, implemented as such. pugs map { ref $_ } split /(..)*/, 1234567890 (::Str, ::Array::Const) Thanks, /Autrijus/ pgpFppB36mbol.pgp Description: PGP signature

Re: split /(..)*/, 1234567890

2005-05-12 Thread Rick Delaney
) and $0 expands to ['12','34','56','78','90'] if you treat it as an array. Thanks, implemented as such. pugs map { ref $_ } split /(..)*/, 1234567890 (::Str, ::Array::Const) Sorry if I'm getting ahead of the implementation but if it is returning $0 then shouldn't ref($0) return ::Rule

Re: split /(..)*/, 1234567890

2005-05-12 Thread Autrijus Tang
On Thu, May 12, 2005 at 08:33:40PM -0400, Rick Delaney wrote: On Fri, May 13, 2005 at 04:05:23AM +0800, Autrijus Tang wrote: pugs map { ref $_ } split /(..)*/, 1234567890 (::Str, ::Array::Const) Sorry if I'm getting ahead of the implementation but if it is returning $0

Re: split /(..)*/, 1234567890

2005-05-12 Thread Autrijus Tang
On Thu, May 12, 2005 at 08:33:40PM -0400, Rick Delaney wrote: Sorry if I'm getting ahead of the implementation but if it is returning $0 then shouldn't ref($0) return ::Rule::Result or somesuch? It would just look like an ::Array::Const if you treat it as such. ...also note that the $0 here

split /(..)*/, 1234567890

2005-05-10 Thread Autrijus Tang
In Pugs, the current logic for array submatches in split() is to stringify each element, and return them separately in the resulting list. To wit: pugs split /(..)*/, 1234567890 ('', '12', '34', '56', '78', '90') Is this sane? Thanks, /Autrijus/ pgpUZCdoDMPb0.pgp Description: PGP