Graham Barr:

        > I know other languages call it zip, but personally I dislike that
name
        > as zip() is commonly used with reference to compression. Although
        > I do not have a good alternative.

        Personally, I'd like join() to do this:

        @a = (1,3,5) ;
        @b = (2,4,6) ;

        @list = join(@a, @b) ;   # (1,2,3,4,5,6)


        Likewise split could do this:

        (@a, @b) = split (2, @list)   ; # @a = (1,3,5), @b = (2,4,7) 

        Although this is ambiguous, because this also looks right:

        @list = ('a','b','c','d','e','f') ;

        (@a, @b) = split ('d', @list) ; # @a = ('a','b','c'), @b = ('e','f')
                                                                # looks like
the analog to splitting a scalar...


        ... although, perhaps the proposed want() could be used to tell
split how many arrays it's shoving
        things in to, in which case the first version would:

        (@a, @b) = split (2, @list)  ; # @a = (1) , @b = (3,4,5,6) 

        and

        (@a, @b) = split (@list) ;  # @a = (1,3,5), @b = (2, 4, 7)

        I'm probably, once again, in the minority as far as taste for
terminology goes.  :)


        Dirk Myers




Reply via email to