[julia-users] Re: base case for the reduce operator?

2014-11-05 Thread Ivar Nesje
# reducing with a single polynomial list gives just the polynomial back reduce(+, [p1]) p1 Doesn't this just work? It does for me. # reducing with an empty list gives back the 0 polynomial reduce(+, []) ZeroPoly If you ensure that the array is correctly typed (eg: Poly[] ), you get:

[julia-users] Re: base case for the reduce operator?

2014-11-04 Thread James Porter
To get an empty list of polynomials, you can type `Poly[]`. I wouldn't recommend changing the behavior of the built in reduce function though, that would definitely be confusing for anyone else who later wants to work with your module (and who will reasonably expect Base.reduce to return a