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

Reply via email to