Merge pull request #182 from Fourchaux/master

Correcting test `CCList.tail_opt`
This commit is contained in:
Simon Cruanes 2018-01-28 10:03:50 -06:00 committed by GitHub
commit c3e11ba31b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -859,6 +859,12 @@ let tail_opt = function
| [] -> None
| _ :: tail -> Some tail
(*$= & ~printer:Q.Print.(option (list int))
(Some [2;3]) (tail_opt [1;2;3])
(Some []) (tail_opt [1])
None (tail_opt [])
*)
let rec last_opt = function
| [] -> None
| [x] -> Some x
@ -868,9 +874,6 @@ let rec last_opt = function
(Some 1) (head_opt [1;2;3])
(Some 1) (head_opt [1])
None (head_opt [])
(Some [2;3]) (tail_opt [1;2;3])
(Some []) (tail_opt [1])
None (tail_opt [])
(Some 3) (last_opt [1;2;3])
(Some 1) (last_opt [1])
None (last_opt [])