Reputation: 3381
Given a list of string elements in Python, I can concatenate these elements with specified glue. For example:
' '.join(["phd", "in", "everything"])
evaluates to the string "phd in everything"
.
What analogue in OCaml is considered most idiomatic? That is, how may string elements of a list be joined with some specified string in OCaml?
Upvotes: 2
Views: 209
Reputation: 4431
The equivalent in Ocaml is :
#String.concat " " ["phd"; "in"; "everything"]
There is no restriction vs the length of the list.
Upvotes: 5