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', '
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 extr
ok like an ::Array::Const if you treat it as such.
With pugs (r2917) this doesn't return an Array of Strings but an Array
of Match-objects:
pugs> map { ref $_ } split /(..)*/, 1234567890
(::Str, ::Array::Const)
pugs> map { ref $_ } [split /(..)*/, 1234567890][1]
(::Mat
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
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 implementatio
$0, ...)
> > >
> > > where in this case it just happens to be
> > >
> > > ('', $0)
> > >
> > > and $0 expands to ['12','34','56','78','90'] if you treat it as an array.
>
> Thanks, impl
; where in this case it just happens to be
> >
> > ('', $0)
> >
> > and $0 expands to ['12','34','56','78','90'] if you treat it as an array.
>
> Exactly so. Principle of least surprise wins again!
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
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 happen
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
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 becau
>>>>> "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
ound 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 /(..)*/, 1234567890'
which currently generates a list of ('',
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 /(.
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 t
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 char
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
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 ))
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
19 matches
Mail list logo