Skip to content

Instantly share code, notes, and snippets.

@Bloofer
Created April 13, 2018 07:10
Show Gist options
  • Save Bloofer/037680707792be9236bb1074e7f0fb92 to your computer and use it in GitHub Desktop.
Save Bloofer/037680707792be9236bb1074e7f0fb92 to your computer and use it in GitHub Desktop.
expect test
let%expect_test _ =
let test l =
let stringify l = List.map ~f:Int.to_string |> String.concat ~sep:"-" in
List.group l ~break:(fun x y -> y < x)
|> List.iter ~f:(fun sub -> print_endline (stringify sub))
in
test [1;2;3;2;3;3;6;1;2;36;7];
[%expect {|
1-2-3
2-3-3-6
1-2-36
7
|}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment