Write an ML function cross which given two lists computes th
Write an ML function cross which, given two lists, computes the list of their cross-products.
Namely, given the inputs [1,2,3] and [4,5,6], it computes [(1,4), (1,5), (1,6), (2,4), (2,5), (2,6), (3,4), (3,5), (3,6)].
fun cross a b = ...
Solution
function res=cross(a,b)
 res=0
 for i=1:size(a)+1
 for j=1:size(b)+1
 res=res+(a(i)*b(j))
 end
 end
 end
 cross([1,2,3],[4,5,6])
![Write an ML function cross which, given two lists, computes the list of their cross-products. Namely, given the inputs [1,2,3] and [4,5,6], it computes [(1,4),  Write an ML function cross which, given two lists, computes the list of their cross-products. Namely, given the inputs [1,2,3] and [4,5,6], it computes [(1,4),](/WebImages/34/write-an-ml-function-cross-which-given-two-lists-computes-th-1099864-1761580888-0.webp)
