2026-04-09 17:26 UTC
Replies (3)
-
@DrHyde@fosstodon.org 2026-04-09 22:36
@dpiponi #Prolog always did my head in. I could never write it, but with a bit of concentration it's surprisingly readable. Have you seen the version of tar(1) that someone wrote in it? https://github.com/SuperDisk/tar.pl/blob/master/tar.pl
-
@cliffle@hachyderm.io 2026-04-10 00:11
@dpiponi what an odd Prolog dialect. Have you seen that s-expr notation elsewhere (among Prologs I mean)?
-
@theohonohan@graphics.social 2026-04-10 00:44
@dpiponi Most(?) people are only introduced to the formal "Euclid's division lemma" framing of division (with a unique quotient and remainder) at third level. But it's possible to express that in Prolog as well. quotRem(N, D, Q, R) :- leq(D, N), leq(Q, N), mul(D, Q, P), add(P, R, N), lt(R, D). The symmetry of D and Q here feels like it has something to do with the 'partitive' vs 'quotative' interpretations of division, but maybe that's meaningless nonsense.