Discussion on groupBy
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jan 10 12:19:16 PST 2015
groupBy is an important primitive for relational algebra queries on
data. Soon to follow are operators such as aggregate() which is a sort
of reduce() but operating on ranges of ranges. With those in tow, a
query such as
SELECT COUNT(*), SUM(x) FROM data GROUP BY userid
can be expressed as:
data
.groupBy!((a, b) => a.userid == b.userid)
.aggregate(count, (a, b) => a.x + b.x);
We're working the kinks out groupBy now. Those interested please follow
at https://issues.dlang.org/show_bug.cgi?id=13936.
Thanks,
Andrei
More information about the Digitalmars-d
mailing list