Quantcast
Channel: Active questions tagged ocaml - Stack Overflow
Viewing all articles
Browse latest Browse all 531

List.map returns an unexpected type

$
0
0

I'm learning OCaml (OCaml 5.0.0).

I defined the function below.

let make_pair x ls = List.map (fun y -> (x,y)) ls;;

I expected make_pair 1 ["a","b"];; returns [(1,"a");(1,"b")], but actually the function returns (int * (string * string)) list = [(1, ("a", "b"))].

How do I solve the issue?


Viewing all articles
Browse latest Browse all 531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>