Hello,
I am trying to learn OCaml and I have installed the binary OCaml-5.3.0 distribution on my MacOS where “uname -a” gives
Darwin Kernel Version 20.6.0: Thu Sep 29 20:15:11 PDT 2022; root:xnu-7195.141.42~1/RELEASE_X86_64
I have also installed Jane Street’s Core library using “opam”.
When I try to compile and run this program (“dune exec bad”)
open Base
let lines = ["aa"; "bb"; "cc"]
let text = String.concat "\n" lines;;
print_endline text
with the following Dune file
(executable
(public_name bad)
(name main)
(libraries base))
then I get the error message
File "bin/main.ml", line 3, characters 30-35:
3 | let text = String.concat "\n" lines;;
^^^^^
Error: The function applied to this argument has type ?sep:string -> string/2
This argument cannot be applied without label
“dune exec bad” succeeds after changing “open Base” to “(* open Base *)”
Trying to change lines into an array of strings and using Jane Street’s String.concat_array leads to a similar error message.
Thanks