skb*_*skb 3 f# functional-programming f#-interactive
我无法弄清楚如何在F#中实现Zip功能.谁能告诉我我做错了什么?这是我输入的内容fsi.exe:
> let rec zip xs ys =
- match xs with
- | [] -> []
- | head :: tail -> (match ys with
- | [] -> []
- | headY :: tailY -> (head, headY) :: zip tail tailY);;
val zip : xs:'a list -> ys:'b list -> ('a * 'b) list
> zip [1;2;3;4] ["a","b","c","d"];;
val it : (int * (string * string * string * string)) list =
[(1, ("a", "b", "c", "d"))]
Run Code Online (Sandbox Code Playgroud)