diff options
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 |