-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
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
Pipelining section question #2
Comments
That does look a lot closer, yes, since you're just setting up a non-eagerly evaluated structure that doesn't actually do anything until you try to do something with it. I think it's different on the back end since here it's making a seq whereas the Rust-ish version of the F# type might be like a filter<map<seq>>, but I guess sequences themselves are lazy so maybe the end effect is similar. In the meantime this will be good to add to the section (since Rust users will want to know about sequences for sure). |
In the same manner, this part is wrong:
The pipe operator in F# exactly equals the calling syntax ( |
I'm not sure (warning: I'm not a Rust dev so might be completely wrong here) that the two examples (map.filter vs addOne |> addOne) are really equivalent.
Isn't the map. filter etc. nature of that sample more about library functions, iterators and how collections are evaluated? In F#, probably the closest would be using Seq e.g.
And indeed in the example above, no real computation happens until you "evaluate" the query using e.g.
Seq.toList
or some other function that executes the sequence.So, yes,
|>
does eagerly evaluate, it's really just syntactic sugar for calling the last argument in a function on the LHS of the pipeline - but that doesn't preclude the kind of lazy evaluation you're referring to.Might be completely wrong here though, so feel free to ignore this if I've misunderstood!
The text was updated successfully, but these errors were encountered: