Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Re: (Golf) Multiply polynomials

by Masem (Monsignor)
on May 07, 2001 at 22:00 UTC ( #78585=note: print w/ replies, xml ) Need Help??

in reply to Re: (Golf) Multiply polynomials
in thread (Golf) Multiply polynomials

New approach, but still 102. I don't I can break it any more...

sub p { my($a,$b)=(shift,shift); my@c=map{my($d,$e);for$e(0..$_){$d+=$$a[$e]*$$b[$_-$e]}$d}0..$#$a+$# +$b; @_?p(\@c,@_):\@c }

Dr. Michael K. Neylon - || "You've left the lens cap of your mind on again, Pinky" - The Brain

Comment on Re: Re: (Golf) Multiply polynomials
Download Code
Replies are listed 'Best First'.
(tye)Re: (Golf) Multiply polynomials
by tye (Sage) on May 07, 2001 at 22:09 UTC

    Simple improvement:

    my($a,$b)=(shift,shift); my$a=shift;my$b=shift; # a bit shorter my$a=pop;my$b=pop; # even shorter since multiplaction is commutative

            - tye (but my friends call me "Tye")

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2015-12-02 05:33 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (35 votes), past polls