On Fri, Jul 18, 2003 at 06:05:52PM -0400, Benjamin Goldberg wrote:

> What would happen if I used 1,2,3 instead of 1..3?  Would it do the same
> thing?  

I would think so.

> I wanna know what happens if I do:
> 
>        @a[0,2,4] = qw/ a b c d e /;


Yup, you're right, I didn't consider non-contiguous ranges in my
original proposal.  Stupid of me.

After considering it more thoroughly, I guess this isn't a good idea.
Here are some of the cases that it would need to cover (obviously,
punting on some of these is an option).


Single finite contiguous list  (1,2,3)
Single finite noncontiguous list with pattern (2,4,6)
Single finite noncontiguous list without pattern (2,4,6,13)
Single finite contiguous range (1..3)
Single finite noncontiguous range(1..10 :by 2) 

Multiple finite contiguous lists
         - that resolve to a contiguous list ((1,2,3),(4,5,6))
         - that do not resolve to a contiguous list  ((1,2,3),(7,8,9))
Multiple finite noncontiguous lists with pattern ((2,4,6),(9,12,15))
         - that resolve to a contiguous list if reordered
                 ((2,4,6),(1,2,3)) 
                 #  reordering is almost certainly a bad idea
Multiple finite noncontiguous lists  without pattern ((2,4,6,13), (77,100,203))
Multiple finite contiguous ranges ((1..3),(7..9))
Multiple finite noncontiguous ranges ((1..10 :by 2), (20..50 :by 7))

Infinite ranges  (1..Inf) or (7..Inf :by 8)

Mixed cases 
      -  ((2,4,6),(99..200)) 
      -  ((2,4,6),(20..50 :by7))
Overlapping cases
      - ( (1,2,3,4), (3,4,5,6) )


It's a shame, because I think it would make a really nice convenience
feature.  I will say that I like the solution proposed earlier (sorry,
I forget by whom) that the C<...> in 5...10 would mean "this is a
splice slice".


Btw, I don't remember what the syntax for "range, step by N" was, so
my version probably isn't right.


--Dks

Reply via email to