You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 1401 Reporter: administrator Status: closed Resolution: won't fix Priority: normal Severity: feature Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello!
I have encountered a situtation where the precondition that
two lists be of the same length is too strict. Yet, I must
iterate on the two lists contemporarily. Hence, I would like
to express the wish to extend the standard library List
module with such iterators as the following:
let rec iter2opt (f:'a option -> 'b option -> unit) l1 l2 =
match l1, l2 with
| [], [] -> ()
| h1 :: t1, [] -> f (Some h1) None; string_iter2opt f t1 []
| [], h2 :: t2 -> f None (Some h2); string_iter2opt f [] t2
| h1 :: t1, h2 :: t2 -> f (Some h1) (Some h2);
string_iter2opt f t1 t2
I offer to write them myself, should the Caml team deem such
an addition to the standard library to be useful for everybody.
Alex
The text was updated successfully, but these errors were encountered:
Original bug ID: 1401
Reporter: administrator
Status: closed
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello!
I have encountered a situtation where the precondition that
two lists be of the same length is too strict. Yet, I must
iterate on the two lists contemporarily. Hence, I would like
to express the wish to extend the standard library List
module with such iterators as the following:
let rec iter2opt (f:'a option -> 'b option -> unit) l1 l2 =
match l1, l2 with
| [], [] -> ()
| h1 :: t1, [] -> f (Some h1) None; string_iter2opt f t1 []
| [], h2 :: t2 -> f None (Some h2); string_iter2opt f [] t2
| h1 :: t1, h2 :: t2 -> f (Some h1) (Some h2);
string_iter2opt f t1 t2
I offer to write them myself, should the Caml team deem such
an addition to the standard library to be useful for everybody.
Alex
The text was updated successfully, but these errors were encountered: