mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
missing compat functions
This commit is contained in:
parent
f6b3a7addf
commit
a249f2ac0b
1 changed files with 10 additions and 0 deletions
|
|
@ -54,6 +54,16 @@ let rec compare_length_with l n = match l, n with
|
|||
(Pervasives.compare (length l)n))
|
||||
*)
|
||||
|
||||
let rec assoc_opt x = function
|
||||
| [] -> None
|
||||
| (y,v) :: _ when Pervasives.(=) x y -> Some v
|
||||
| _ :: tail -> assoc_opt x tail
|
||||
|
||||
let rec assq_opt x = function
|
||||
| [] -> None
|
||||
| (y,v) :: _ when Pervasives.(==) x y -> Some v
|
||||
| _ :: tail -> assq_opt x tail
|
||||
|
||||
(* end of backport *)
|
||||
|
||||
include List
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue