XP is just a number PerlMonks

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

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 - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

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")

Create A New User
Node Status?
node history
Node Type: note [id://78585]
help
Chatterbox?
 [LanX]: as long as he has votes left, the nodelet remains [LanX]: There is a very simple solution ... [marinersk]: Correct, so one workaround is to leave one vote. [marinersk]: But I was looking for a more elegant solution. It appears noone online at this time is aware of one. [LanX]: go to Nodelet Settings and click "All nodelets off" [LanX]: SUPER STABLE!!! [marinersk]: LanX++ LOL Yes, that is another workaround. :-) [LanX]: strangely you can't disable the XP nodelet [LanX]: But you can use CSS to hide it [LanX]: and disoplay the data permanently in your peronal nodelet

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2017-05-29 14:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My favorite model of computation is ...

Results (192 votes). Check out past polls.