I am trying to replicate this example:
https://jakevdp.github.io/PythonDataScienceHandbook/03.08-aggregation-and-grouping.html
Besides various limitations of library(aggregate) in Prolog,
such that it doesn’t allow function pointers like np.median
or
that it doesn’t spread an aggregate along multiple columns,
i.e. data1
and data2
in the above example. I also found that already
a min and max pair has some limitations:
?- aggregate_all(min(X), between(1,100000000,X), Y).
Y = 1.
?- aggregate_all(max(X), between(1,100000000,X), Y).
Y = 100000000.
?- aggregate_all((min(X), max(X)), between(1,100000000,X), Y).
ERROR: Stack limit (1.0Gb) exceeded
In another Prolog system the 3rd query works as expected:
?- aggregate_all((min(X), max(X)), between(1,100000000,X), Y).
Y = (1, 100000000).
Disclaimer: np.median
is probably a bad example anyway, since
it is not streaming friendly such as min and max. Unless you dare
to run the aggregate goal between(1,100000000,X)
twice?