On Tuesday, 19 March 2013 at 18:53:21 UTC, bearophile wrote:
Small changes on your version:
http://codepad.org/E9KHKvAi
It's now on Rosettacode. I have added more changes to make it
able to deal with immutable input.
Bye,
bearophile
Another issue to consider as the question I was attempting ended
up requiring this, I wasn't aware of it when I made the original
post:
The prime factorization of 1 is an empty set, so surely to be
correct it should return [] when given 1 and not throw an
exception. This also suggests a possible modification to
[].reduce!"a * b" as mathematically the product of the empty set
is defined as 1.