diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/cList.ml | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/cList.ml b/lib/cList.ml index 72f892a09d..bd3e09b5b2 100644 --- a/lib/cList.ml +++ b/lib/cList.ml @@ -645,12 +645,13 @@ let rec split3 = function let (rx, ry, rz) = split3 l in (x::rx, y::ry, z::rz) let firstn n l = - let rec aux acc = function - | (0, l) -> List.rev acc - | (n, (h::t)) -> aux (h::acc) (pred n, t) + let rec aux acc n l = + match n, l with + | 0, _ -> List.rev acc + | n, h::t -> aux (h::acc) (pred n) t | _ -> failwith "firstn" in - aux [] (n,l) + aux [] n l let rec last = function | [] -> failwith "List.last" |
