简体   繁体   中英

OCaml Error Unbound value List.unzip

Any idea why I am getting this error:

utop # let (ints,strings) = List.unzip [(1,"one"); (2,"two"); (3,"three")];;
Error: Unbound value List.unzip 

There is no List.unzip in the standard library.
I'm guessing you're looking for List.split :

# let (ints,strings) = List.split [(1,"one"); (2,"two"); (3,"three")];;
val ints : int list = [1; 2; 3]
val strings : string list = ["one"; "two"; "three"]

Note: There is a List.unzip function in OCaml-Core. If you're using it, you probably didn't open the corresponding module.

Base库中提供了List.unzip,您需要安装它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM