module List:sig
..end
val fold : 'a list ->
'b -> ('b -> 'a -> 'b Deferred.t) -> 'b Deferred.t
val find : 'a list ->
('a -> bool Deferred.t) -> 'a option Deferred.t
map
, iter
, and filter
(below) use two new features of OCaml that you haven't
seen before: optional arguments and polymorphic variants. For more information
on these types, see
the recitation 18 notes.val map : ?how:[ `Parallel | `Sequential ] ->
'a list -> ('a -> 'b Deferred.t) -> 'b list Deferred.t
map l f
becomes determined
when all calls to f complete.
If how is `Parallel
, all of the calls to f will be started immediately.
If how is `Sequential
, the second call to f will only start when the
first completes, and so on.
The default how is `Sequential
val iter : ?how:[ `Parallel | `Sequential ] ->
'a list -> ('a -> unit Deferred.t) -> unit Deferred.t
iter l f
becomes determined only after all calls to f complete.val filter : ?how:[ `Parallel | `Sequential ] ->
'a list -> ('a -> bool Deferred.t) -> 'a list Deferred.t