-
Notifications
You must be signed in to change notification settings - Fork 24
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
convenience tmap
function
#200
Comments
Code I ended up writing for this was:
|
Supporting Regarding the first snippet, you can just write generator = Base.Generator(models, input_splits) do model, inputs
predict(model, inputs; kwargs...)
end without If we add a curried version of predictions = Iterators.map(models, input_splits) do model, inputs
predict(model, inputs; kwargs...)
end |> tcollect(basesize = 1) which takes the same number of lines as predictions = tmap(models, input_splits; basesize = 1) do model, inputs
predict(model, inputs; kwargs...)
end Arguably, the curried version of predictions = Iterators.map(models, input_splits) do model, inputs
predict(model, inputs; kwargs...)
end |> withprogress |> tcollect(basesize = 1) or to produce a DataFrame Iterators.map(...) do ...
...
end |> withprogress |> tcopy(DataFrame, basesize = 1) Note: |
Your curried Your examples there are nice and I once would have really liked them. But I no longer write any code that work in that way.
is almost as nice and return type control remains always on the left. But anyway, this is not a thread for discussing But for discussing something that exists only to match existing API from Base. I guess main argument against it is it would allow people to use Transducers.jl very shallowly, without delving into what a Transducer is or how to compose them. This is also the main argument in favor of it. |
As I said, I half-agree that
Yes, this is a good summary of my struggle. |
|
I thought about
(OTOH, I think implementing Maybe it makes sense to create a package (say) |
Just FYI, other libraries with " |
I find myself writin a lot of code like:
Which I coild also write in direct generator from but I find that a bit too long:
What I would like to write is:
The text was updated successfully, but these errors were encountered: