开发者

How does F# map2 iter2 ||> work with Vector?

Input two arrays of Vector x,y pair by x,y pair and find the function of the two x,y pairs output new array ...?

    let v1 = [|for x, y in [3.,3.; 5.,5.; 1.,1.] -> Vector(x, y)|];;
    let v2 = [|for x, y in [1.,1.; 2.,2.; 4.,4.] -> Vector(x, y)|];;

    let data8 v1 v2 = Array.map2 (fun x y -> Vector.C开发者_JAVA百科rossProduct) v1 v2

val v1 : Vector [] = [|3,3; 5,5; 1,1|]

val v2 : Vector [] = [|1,1; 2,2; 4,4|]

val data8 : 'a [] -> 'b [] -> (Vector * Vector -> float) []

data8 v1 v2;; val it : (Vector * Vector -> float) [] = [|; ; |]


See: http://fpish.net/topic/Some/0/73895

You forgot to pass the arguments to Vector.CrossProduct:

let data8 v1 v2 = Array.map2 (fun x y -> Vector.CrossProduct(x, y)) v1 v2
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜