Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 366 Bytes

File metadata and controls

19 lines (15 loc) · 366 Bytes

Stream.take_while : ('a -> bool) -> 'a Stream.t -> 'a Stream.t

let unsubscribe = [1; 2; 3]
  |> Stream.Async.of_list ~delay:3000
  |> Stream.take_while (fun x -> x < 2)
  |> Stream.subscribe (fun x -> x |> string_of_int |> print_endline)

let _ = print_endline "pass"

(*
  > "pass"
  > 1
  > 2
  
  stream: __1__2__3___.
  output: __1__2___!
*)