Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.42 KB | None | 0 0
  1. utop # let do_shit lst =
  2.   List.fold_right begin fun x acc ->
  3.       match acc with
  4.       | `Empty -> `String x
  5.       | `String s -> `String (x ^ "-" ^ s)
  6.     end
  7.     lst
  8.     `Empty
  9.   |> function `Empty -> "" | `String s -> s;;
  10. val do_shit : bytes list -> bytes = <fun>
  11. utop # do_shit [];;
  12. - : bytes = ""
  13. utop # do_shit ["qwe"];;
  14. - : bytes = "qwe"
  15. utop # do_shit ["qwe"; "asd"; "zxc"];;
  16. - : bytes = "qwe-asd-zxc"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement