title: implement polynomial multiplication in Haskell
body: <p>I'm defining some functions for polynomial arithmetic</p>
  
  <p>To make it easier for debugging, I make polynomial list:</p>
  
  <pre><code>[5,3,7] -&gt; 5 + 3*x + 7*x^2
  </code></pre>
  
  <p>Here I get function <code>add</code> that already works:</p>
  
  <pre><code>add [1,9,7] [9,3] == [10,12,7]
  </code></pre>
  
  <p>But I have trouble with <code>mul</code>:</p>
  
  <pre><code>mul []       _ = [0]
  mul (x : xs) ys = add (map (*x) ys) (mul (0 : xs) ys)
  </code></pre>
  
  <p>As I suppose:</p>
  
  <pre><code>[4,5,6] * [1,2,3] = 4*[1,2,3] + [0,4,6]*[1,2,3]
  </code></pre>
  
  <p>It takes forever to evaluate <code>mul [1] [1,2,3]</code>, I can't find out what's wrong with it.</p>