We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When an element in the result of LazyList.map2 is accessed, this forces the next element to be constructed. LazyList.map doesn't have this behavior:
LazyList.map2
LazyList.map
# let pr = Printf.printf "%d\n%!";; val pr : int -> unit = <fun> # let s1 = LL.seq 0 (fun n -> let n' = n + 1 in pr n'; n') (fun _ -> true);; val s1 : int LL.t = <lazy> # let s2 = LL.seq 0 (fun n -> let n' = n + 1 in pr n'; n') (fun _ -> true);; val s2 : int LL.t = <lazy> # let s3 = LL.seq 0 (fun n -> let n' = n + 1 in pr n'; n') (fun _ -> true);; val s3 : int LL.t = <lazy> # let s1' = LL.map (fun n -> n) s1;; val s1' : int LL.t = <lazy> # let s2s3 = LL.map2 (fun x y -> x, y) s2 s3;; val s2s3 : (int * int) LL.t = <lazy> # LL.hd s1';; - : int = 0 # LL.hd s2s3;; 1 1 - : int * int = (0, 0) # LL.hd (LL.tl s1');; 1 - : int = 1
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When an element in the result of
LazyList.map2
is accessed, this forces the next element to be constructed.LazyList.map
doesn't have this behavior:The text was updated successfully, but these errors were encountered: