Created
April 23, 2021 16:09
-
-
Save cwfoo/df0277fe1fcc832d1d78e2102d636e92 to your computer and use it in GitHub Desktop.
OCaml implementation of Haskell's Data.List intersperse and intercalate.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* OCaml implementation of Haskell's Data.List intersperse and intercalate. *) | |
let rec intersperse sep ls = | |
match ls with | |
| [] | [_] -> ls | |
| x::xs -> x :: sep :: intersperse sep xs | |
let intercalate = String.concat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment