On Saturday, 10 January 2015 at 20:19:14 UTC, Andrei
Alexandrescu wrote:
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.
It would be interesting if we could make it possible to do a
translation between D and SQL, similar to how LINQ is implemented
internally, but preferably have it done at compile-time rather
than at runtime.