COP 4555 Lecture 4: COP4555 HW 4 Solutions
Document Summary
//do the inner product of u and v, using tail recursion. let rec accinner = function. | ( x :: xs , y :: ys , zs ) -> accinner ( xs , ys , ( x * y )+ zs) let inner xs ys = accinner ( xs , ys , 0 );; //mult let rec mult xs ys = match ys with. | ( _ :: _ ):: _ as ys -> ( inner xs ( list . map list . head ys )) :: ( mult xs ( list . map list . tail ys )) | _ -> [] let rec multiply ( xs , ys ) = match xs with. | ( x :: xs , y :: ys ) -> if x < y then x :: merge ( xs , y :: ys ) Else y :: merge ( x :: xs , ys ) let rec split = function.