<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>I’m trying to make a multiplication function that can take either all numbers or all numbers and one vector, and have it not matter what order they come in. To do this, I’m using match with list-no-order:</div><div><div><font face="Courier New">#lang typed/racket</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">(require plot/typed/utils)</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">(define listof-number?</font></div><div><font face="Courier New"> (make-predicate (Listof Number)))</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">(: my* (case-></font></div><div><font face="Courier New"> (-> One)</font></div><div><font face="Courier New"> (Number Number * -> Number)</font></div><div><font face="Courier New"> ((Vectorof Real) Real * -> (Vectorof Real))</font></div><div><font face="Courier New"> (Real (Vectorof Real) Real * -> (Vectorof Real))</font></div><div><font face="Courier New"> (Real Real (Vectorof Real) Real * -> (Vectorof Real))</font></div><div><font face="Courier New"> (Real Real Real (Vectorof Real) Real * -> (Vectorof Real))</font></div><div><font face="Courier New"> (Real Real Real Real (Vectorof Real) Real * -> (Vectorof Real))))</font></div><div><font face="Courier New"> ; if I could, I would do this:</font></div><div><font face="Courier New"> ; (Real * (Vectorof Real) Real * -> (Vectorof Real))</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">(define my*</font></div><div><font face="Courier New"> (case-lambda</font></div><div><font face="Courier New"> [() 1]</font></div><div><font face="Courier New"> [args (match args</font></div><div><font face="Courier New"> [(list-no-order (? vector? v) (? real? ns) ...)</font></div><div><font face="Courier New"> (v* v (apply * ns))]</font></div><div><font face="Courier New"> [(? listof-number? ns)</font></div><div><font face="Courier New"> (apply * ns)])]))</font></div></div><div><br></div><div>It’s giving me these errors:</div><div><div><font face="Courier New">. Type Checker: Expected One, but got Number in: (apply * ns) ; why is it expecting One there?</font></div><div><font face="Courier New">. Type Checker: Expected (Vectorof Real), but got Any in: v ; the type shouldn’t be Any, it should at least </font></div><div><font face="Courier New"> ; be VectorTop, and with the type annotation </font></div><div><font face="Courier New"> ; for my* should tell it that all of the </font></div><div><font face="Courier New"> ; vectors are (Vectorof Real), right?</font></div><div><font face="Courier New">. Type Checker: Bad arguments to function in apply: ; shouldn’t it be able to tell that ns is a </font></div><div><font face="Courier New">Domains: Number *</font><span style="font-family: 'Courier New';"> </span><span style="font-family: 'Courier New';"> ; (Listof Number), especially since</span></div><div><font face="Courier New">Arguments: (Listof Any) * ; listof-number? was defined with</font></div><div><font face="Courier New"> in: (apply * ns) ; </font><span style="font-family: 'Courier New';">make-predicate?</span></div><div><font face="Courier New">. Type Checker: Expected One, but got (Vectorof Real) in: (v* v (apply * ns)) ; why is it expecting One?</font></div><div><span style="font-family: 'Courier New';">. Type Checker: Expected Number, but got (Vectorof Real) in: (v* v (apply * ns)) ;why is it expecting Number?</span></div><div><font face="Courier New">. Type Checker: Expected (Vectorof Real), but got Number in: (apply * ns);whyis it expecting (Vectorof Real)?</font></div><div><br></div></div><div><br></div></body></html>