Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Algorithm for cancelling common factors between two lists of multiplicands

by hv (Prior)
on Aug 08, 2005 at 19:58 UTC ( [id://482002]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      sub combine_factors {
        my $list = shift;
    ...
      ($fa->{$_} ||= 0) -= $fb->{$_} for keys %$fb;
      my @c = map +($_) x $fa->{$_}, grep $fa->{$_} > 0, keys %$fa;
      my @d = map +($_) x -$fa->{$_}, grep $fa->{$_} < 0, keys %$fa;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://482002]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-19 22:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found