Front page | perl.perl6.language |
Postings from February 2005
Pop a Hash?
Thread Next
From:
Rod Adams
Date:
February 9, 2005 03:14
Subject:
Pop a Hash?
Message ID:
4209F074.8040005@rodadams.net
Does
($k, $v) <== pop %hash;
or
($k, $v) <== %hash.pop;
make sense to anyone except me?
Since we now have an explicit concept of pairs, one could consider a
hash to be nothing but an unordered (but well indexed) list of pairs.
So, C<< pop %hash >> would be a lot like C<< each >>, except, of course,
that it deletes the pair at the same time.
If we do that, I'd also want to be able to
push %x, %y;
which would mean something like:
%x{%y.keys} <== %y{%y.keys};
but be much easier to read.
-- Rod Adams.
(And now I'm really off to bed.)
Thread Next