This could have been a really unique thread: 15 messages, 1 author
--
http://mail.python.org/mailman/listinfo/python-list
Xah Lee wrote:
> In imperative languages such as Perl and Python
> and Java, in general it is not safe to delete
> elements when looping thru a list-like entity.
> (it screws up the iteration) One must make a
> copy first, and work with the copy.
Correction:
When looping thru a list-like entity an
Xah Lee wrote:
> In imperative languages such as Perl and Python
> and Java, in general it is not safe to delete
> elements when looping thru a list-like entity.
> (it screws up the iteration) One must make a
> copy first, and work with the copy.
Correction:
When looping thru a list-like entity an
Xah Lee wrote:
> In imperative languages such as Perl and Python and Java, in general
it
> is not safe to delete elements when looping thru a list-like entity.
> (it screws up the iteration) One must make a copy first, and work
with
> the copy.
Correction:
When looping thru a list-like entity and
Xah Lee wrote:
attached below is the Perl documentation that i wrote for a function
called "reduce", which is really the heart of a larger software.
Don't shadow built-ins. Especially for a function name.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Xah Lee wrote:
here's a interesting real-world algoritm to have fun with.
From you? Doubtful.
Sorry, dude, but you've been replaced by über-troll Ilias Lazaridis.
Security will escort you to the door.
--
Soraia: http://www.soraia.com
--
http://mail.python.org/mailman/listinfo/python-list
here are the answers:
Perl code:
sub reduce ($$) {
my %hh= %{$_[0]}; # e.g. {'1,2'=>[1,2],'5,6'=>[5,6],...}
my ($j1,$j2)=($_[1]->[0],$_[1]->[1]); # e.g. [3,4]
delete $hh{"$j1,$j2"};
foreach my $k (keys %hh) {
$k=~m/^(\d+),(\d+)$/;
my ($k1,$k2)=($1,$2);
if ($k1==$j1) {
here's a interesting real-world algoritm to have fun with.
attached below is the Perl documentation that i wrote for a function
called "reduce", which is really the heart of a larger software.
The implementation is really simple, but the key is to understand what
the function should be. I'll post