G'day all.
Quoting Dougal Stanton <[EMAIL PROTECTED]>:
> Is there a better way to turn an integer N and a list of primes
> [p1,p2,p3,...] into powers [c1,c2,c3,...] such that
>
> N = product [p1^c1, p2^c2, p3^c3, ...]
It depends what you mean by "better".
You can make it more concise by using zip or zipWith:
product (zipWith (^) ps cs)
If you're after performance, that's another issue entirely. For
large integers, you're using entirely the wrong algorithm.
Cheers,
Andrew Bromage
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe