Bug introduced in 10.0.0 and fixed in 10.0.2
Is it possible to take advantage of Dataset's Query operator syntax to Merge parallel queries thereby avoiding Function's that are otherwise required?
Using the planets data:
planets = ExampleData[{"Dataset", "Planets"}];
{moonMasses, nMoons } = {planets[All, "Moons", Median, "Mass"],
planets[All, "Moons", Length, "Mass"]}
These queries are nearly equivalent merges:
(1) Merge[{moonMasses // Normal, nMoons // Normal}, List]
(2) planets[All, "Moons", {Median[#], Length[#]} &, "Mass"] // Normal
The values in (1) are unfortunately wrapped in an extra nested list (and further requres normalizing the data as Merge doesn't take Dataset
arguments).
(2) is preferred (normalizing here only because 10.0.0 Dataset Format
is not usable).
How to avoid using Function
in (2), eg, to shorten the query to a syntax similar to:
planets[All, "Moons", {Median, Length}, "Mass"]
planets[All, "Moons", Query[{Median, Length}], "Mass"]
$\endgroup${Query[Median],Query[Length]}
but didn't think of this variation. Write it up as an answer, will accept. $\endgroup$