This is not a substantial issue regarding Perl 6, but is more a minor feature curiosity/meditation. It was inspired some time ago by this PM node:

http://perlmonks.org/?node_id=509310

I was wondering if in addition to push(), pop() etc. there could be be rot() and roll() methods that would act upon lists (not modifying them) like thus:

(qw/aa bb cc dd ee/).rot(2)   # qw/cc dd ee aa bb/
(qw/aa bb cc dd ee/).rot()    # qw/bb cc dd ee aa/ => same as .rot(1)
(qw/aa bb cc dd ee/).roll(2)  # qw/dd ee aa bb cc/ => same as .rot(-2)
(qw/aa bb cc dd ee/).roll()   # qw/ee aa bb cc dd/ => same as .roll(1)
...
etc.

Also I wonder if one will be able to push(), pop(), etc. array slices as well whole arrays. A' la

my @a=qw/aa bb cc dd ee/;
my $s=pop @a[0..2];  # or [0,2] or just [0] for that matters!
# $s='cc';
# @a=qw/aa bb dd ee/; => same as what I can do with slice()

Not terribly necessary, but indeed consistent IMHO.


Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling in clpmisc,
  "perl bug File::Basename and Perl's nature"

Reply via email to