my $poly = [+] (@polys >>*<< @control_points);. When I ran it, I got back:
Ambiguous dispatch to multi 'infix:*'. Ambiguous candidates had signatures:
:(Polynomial $a, Any $b)
:(Any $a, Vector $b)
That's a beautiful error message, and completely appropriate. Both functions could do the job, each giving you their own answer. That is,
(Polynomial $a, Any $b)where Any is a Vector would generate a Polynomial with Vector coefficients;
(Any $a, Vector $b)where Any is a Polynomial would generate a Vector with Polynomial values. Both make sense, but for our purposes the former is probably best.
How to make that happen? The Polynomial and Vector classes are both completely independent of each other. Other than this potential intersection, they don't need to know about each other. After toying around a bit, I believe "is default" on the Polynomial multiply is the way to go.
Unfortunately, that gets me the error
Method 'Num' not found for invocant of class 'Vector'. Possibly the problem is nested hyper multiply operators? Even when I map that operation, there are still two nested hyper multiply operators (both Polynomial and Vector multiply have them). Yet once again beautiful Perl 6 runs up against the awkward (and ever-improving) reality of Rakudo.