From d1de211bdb72fe5a1e8380f45b4f643befb628aa Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Thu, 2 Jul 2020 22:48:12 -0700 Subject: [PATCH 1/4] Update: Transducers Using commit: Merge branch 'master' into compose https://github.com/JuliaFolds/Transducers.jl/commit/6d3de407ff53a3ab4d2b63051b8a0f0bf76b5165 --- test/environments/main/Manifest.toml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/environments/main/Manifest.toml b/test/environments/main/Manifest.toml index f443c3a..221b0a2 100644 --- a/test/environments/main/Manifest.toml +++ b/test/environments/main/Manifest.toml @@ -28,6 +28,11 @@ git-tree-sha1 = "a6a8197ae253f2c1a22b2ae17c2dfaf5812c03aa" uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" version = "3.13.0" +[[CompositionsBase]] +git-tree-sha1 = "f3955eb38944e5dd0fabf8ca1e267d94941d34a5" +uuid = "a33af91c-f02d-484b-be07-31d278c5ca2b" +version = "0.1.0" + [[ConstructionBase]] git-tree-sha1 = "a2a6a5fea4d6f730ec4c18a76d27ec10e8ec1c50" uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" @@ -256,8 +261,8 @@ deps = ["Distributed", "InteractiveUtils", "Logging", "Random"] uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [[Transducers]] -deps = ["ArgCheck", "BangBang", "Distributed", "InitialValues", "Logging", "Markdown", "Requires", "Setfield", "SplittablesBase", "Tables"] -git-tree-sha1 = "3ffdba968ea18a106c7084283d58ee022297c9ce" +deps = ["ArgCheck", "BangBang", "CompositionsBase", "Distributed", "InitialValues", "Logging", "Markdown", "Requires", "Setfield", "SplittablesBase", "Tables"] +git-tree-sha1 = "eb3d50f79b4b2da59a10e3315ca56b86a6a40f78" repo-rev = "master" repo-url = "https://github.com/JuliaFolds/Transducers.jl.git" uuid = "28d57a85-8fef-5791-bfe6-a80928e7c999" From 47d69996eac6987032b11b29049af1c6a60f78f1 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Thu, 2 Jul 2020 23:58:03 -0700 Subject: [PATCH 2/4] Use opcompose --- src/LazyGroupBy.jl | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/LazyGroupBy.jl b/src/LazyGroupBy.jl index e0ffaa4..ea45e64 100644 --- a/src/LazyGroupBy.jl +++ b/src/LazyGroupBy.jl @@ -90,7 +90,7 @@ _groupby_kwargs(; init = Transducers.DefaultInit, kwargs...) = ((init,), kwargs) function _impl_fold(fold, kwargs, rf, xf, group) (init,), kwargs = _groupby_kwargs(; kwargs...) prexf, collection = extract_transducer(group.collection) - gxf = prexf |> GroupBy(group.key, Map(last) |> xf, rf, init) + gxf = opcompose(prexf, GroupBy(group.key, opcompose(Map(last), xf), rf, init)) d = fold(right, gxf, collection; init = nothing, kwargs...) if d === nothing error("input collection is empty or all filtered out") @@ -115,7 +115,7 @@ impl(::typeof(dreduce), kwargs, rf, xs) = impl(dreduce, kwargs, rf, Map(identity impl(::typeof(collect), kwargs, xf::Transducer, group::GroupedBy) = foldl( right, - GroupBy(group.key, Map(last) |> xf |> Map(SingletonVector), append!!), + GroupBy(group.key, opcompose(Map(last), xf, Map(SingletonVector)), append!!), group.collection, ) impl(::typeof(collect), kwargs, group::GroupedBy) = @@ -123,7 +123,7 @@ impl(::typeof(collect), kwargs, group::GroupedBy) = impl(::typeof(tcollect), kwargs, xf::Transducer, group::GroupedBy) = reduce( right, - GroupBy(group.key, Map(last) |> xf |> Map(SingletonVector), append!!), + GroupBy(group.key, opcompose(Map(last), xf, Map(SingletonVector)), append!!), group.collection, ) impl(::typeof(tcollect), kwargs, group::GroupedBy) = @@ -131,7 +131,7 @@ impl(::typeof(tcollect), kwargs, group::GroupedBy) = impl(::typeof(dcollect), kwargs, xf::Transducer, group::GroupedBy) = dreduce( right, - GroupBy(group.key, Map(last) |> xf |> Map(SingletonVector), append!!), + GroupBy(group.key, opcompose(Map(last), xf, Map(SingletonVector)), append!!), group.collection; kwargs..., ) @@ -223,7 +223,10 @@ impl(::typeof(findfirst), ::NamedTuple{()}, f, group::GroupedBy) = foldl( right, GroupBy( group.key ∘ last, - Filter(((_key, (_idx, val)),) -> f(val)) |> Map(((_key, (idx, _val)),) -> idx), + opcompose( + Filter(((_key, (_idx, val)),) -> f(val)), + Map(((_key, (idx, _val)),) -> idx), + ), left, ), pairs(group.collection), @@ -235,7 +238,7 @@ impl(::typeof(findlast), ::NamedTuple{()}, f, group::GroupedBy) = foldl( right, GroupBy( group.key ∘ last, - Filter(((_key, (_idx, val)),) -> f(val)) |> Map(((_key, (idx, _val)),) -> idx), + opcompose(Filter(((_key, (_idx, val)),) -> f(val)), Map(((_key, (idx, _val)),) -> idx)), right, ), pairs(group.collection), @@ -245,8 +248,10 @@ impl(::typeof(findall), kwargs, f, group::GroupedBy) = foldl( right, GroupBy( group.key ∘ last, - Filter(((_key, (_idx, val)),) -> f(val)) |> - Map(((_key, (idx, _val)),) -> SingletonVector(idx)), + opcompose( + Filter(((_key, (_idx, val)),) -> f(val)), + Map(((_key, (idx, _val)),) -> SingletonVector(idx)), + ), append!!, ), pairs(group.collection), From 392f123440d4f69112150e6631664f08d1d25185 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sat, 4 Jul 2020 01:06:04 -0700 Subject: [PATCH 3/4] Update: Transducers Using commit: Bump to 0.4.39 https://github.com/JuliaFolds/Transducers.jl/commit/c381a91827578d5d963fe1fb33eaca7d1aed8cc9 --- test/environments/main/Manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/environments/main/Manifest.toml b/test/environments/main/Manifest.toml index 221b0a2..1fde043 100644 --- a/test/environments/main/Manifest.toml +++ b/test/environments/main/Manifest.toml @@ -262,11 +262,11 @@ uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [[Transducers]] deps = ["ArgCheck", "BangBang", "CompositionsBase", "Distributed", "InitialValues", "Logging", "Markdown", "Requires", "Setfield", "SplittablesBase", "Tables"] -git-tree-sha1 = "eb3d50f79b4b2da59a10e3315ca56b86a6a40f78" +git-tree-sha1 = "329e69f3104057ae0aaab823c447bd7d5aae1d8b" repo-rev = "master" repo-url = "https://github.com/JuliaFolds/Transducers.jl.git" uuid = "28d57a85-8fef-5791-bfe6-a80928e7c999" -version = "0.4.37-DEV" +version = "0.4.39" [[UUIDs]] deps = ["Random", "SHA"] From 5a9c4dbadc61e91d01fc0a7d3e2ac78b9c407cc9 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sat, 4 Jul 2020 01:07:09 -0700 Subject: [PATCH 4/4] Require Transducers 0.4.39 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 5c59413..63ba3bf 100644 --- a/Project.toml +++ b/Project.toml @@ -16,7 +16,7 @@ BangBang = "0.3.24" Compat = "2.2, 3" InitialValues = "0.2.6" OnlineStats = "1" -Transducers = "0.4.35" +Transducers = "0.4.39" julia = "1" [extras]