Re: [m-users.] Announcement (aggregates module) + questions (window functions)

Volker Wysk <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
Thanks for sharing!

I've added it to my list of Mercury resources:

https://volker-wysk.de/mercury/resources.html#mark-clementss-aggregates-library

Cheers,
Volker


Am Donnerstag, dem 29.12.2022 um 13:27 +0000 schrieb Mark Clements:
> As an announcement, I have drafted a Mercury module for aggregates: see https://github.com/mclements/mercury-aggregates . This includes bag and set semantics for count, min, max, sum, avg, geom_mean, var, median and quantile.
> 
> As an extension, I have tried to implement window functions (https://en.wikipedia.org/wiki/Window_function_(SQL)) in Mercury: see https://github.com/mclements/mercury-aggregates/blob/main/test_window.m for an example. First, has anyone previously worked with window functions in Mercury? Second, is the syntax that I have used sensible (see code snippet below)? Here, bag_cum_sum and bag_row_number are functions that return a predicate, which is concise, but perhaps not obvious.
> 
> %% patient and visit are nondet predicates
> main(!IO) :-
>     print_line("{Id, RowNumber, Date, Score, CumScore}", !IO),
>     aggregate((pred({Id,RowNumber,Datei,Scorei,CumScorei}::out) is nondet :-
>                    patient(Id,_),
>                    Combined = (pred(Date::out,Score::out) is nondet :- visit(Id,Date,Score)),
>                    Combined(Datei,Scorei),
>                    bag_cum_sum(Combined)(Datei,CumScorei),
>                    Dates = (pred(Date::out) is nondet :- Combined(Date,_)),
>                    bag_row_number(Dates)(Datei,RowNumber)),
>               print_line,
>               !IO).
> 
> Third, I have sought to stay with nondet predicates, with the implementation internally using lists -- is there a better approach?
> 
> Sincerely, Mark.
> 
> 
> När du skickar e-post till Karolinska Institutet (KI) innebär detta att KI kommer att behandla dina personuppgifter. Här finns information om hur KI behandlar personuppgifter<https://ki.se/medarbetare/integritetsskyddspolicy>.
> 
> 
> Sending email to Karolinska Institutet (KI) will result in KI processing your personal data. You can read more about KI’s processing of personal data here<https://ki.se/en/staff/data-protection-policy>.
> _______________________________________________
> users mailing list
> [email protected]
> https://lists.mercurylang.org/listinfo/users

_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmOvDwIACgkQ+K4ydFOs
HoUpJw//Q6OhR1o/SIkCBvxaoN6gBs2eINprMGLXsVuKz0MkPmn7hAasnA8HJDTE
uB2TyhmKpejtNHi+Yh6VTW/qavUl44hVndRMB0vRnu+JO+8S+FKG4sfTgxMo7t5q
s+89ia87o5TPd+B1Rvj4jKnM6ccmRo0+o76Qek5LyUk7xHYsoEuhhcoVZDJ/+vPx
lJ5J+MpCvwWDA9PAjDERSWDwsPXYCEE1449MhGN/XNRGxuuE8hXSOINHRr5APyUv
2fZo8P3YuPjFEO3FDGwmDsJDTESQfc30Q5/PJI3uU+rDm7iolsZFoyK4Dz0cN3c2
cQE3Ua9Z7KvVIfMVB6wBa0K+kxQebuRgAieDJNyzGzE/C5j1imnXOq4jzI59fpFW
uADJyukzhLPMv1902GqNxcjqEVKFb/tRdjJtdm7iB7RLXvHxzyKQX4jDylynbWGQ
Z2l7RbsgHfZbdjzBtOnLXUpqyoEpioBkslEQSEe/H7Ln31zu+hmE8CiBHUyOU+3v
0/1qWxpexl69Ejt+OR7aTPycaPuFpJNjPNac+4/tp7H/nudB++tWoXLsUSVaeNpw
4wVvx3xygCXqBJf5/xkdFV1bbg4hpUwkCkOzK/+leIiZAM9MjwbmId1dXR2Jvr5H
s5oKUOyb2ggOcxuVlkmgiUgdAfQAAkVvFuM7p6pRqNwQxMeggfE=
=OYdd
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.