diff options
author | Son Ho | 2022-04-26 19:34:12 +0200 |
---|---|---|
committer | Son Ho | 2022-04-26 19:34:12 +0200 |
commit | 79b0bf1fdb0283c2bd9cbca91794105dda88f03b (patch) | |
tree | 4a51f6cf3fcb208f074a306b80cb1a89ddbbbd63 /src/Collections.ml | |
parent | 732e3305cba3a628d9408a048978151e4ef2fcc2 (diff) |
Introduce the Abs expression and continue updating the code
Diffstat (limited to 'src/Collections.ml')
-rw-r--r-- | src/Collections.ml | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Collections.ml b/src/Collections.ml index 2d7a8787..614857e6 100644 --- a/src/Collections.ml +++ b/src/Collections.ml @@ -77,6 +77,11 @@ module List = struct match ls with | [ x ] -> x | _ -> raise (Failure "The list should have length exactly one") + + let pop (ls : 'a list) : 'a * 'a list = + match ls with + | x :: ls' -> (x, ls') + | _ -> raise (Failure "The list should have length > 0") end module type OrderedType = sig |