ls lib/prolog/
Prolog
SWI-Prolog's term order, sorting and counting.
- draft Counting in Prolog: the dynamic database, assoc trees and clumped/2Three ways to count occurrences in SWI-Prolog 11.0.1, what each does inside (just-in-time hash indexes, a failure-driven loop, a sort, an AVL tree with a brand-new C fast path), and how fast each one is.
- draft Sorting in Prolog: standard order of terms, msort and sort/4How SWI-Prolog 11.0.1 sorts: the standard order of terms that lets sort/2 work without a comparison, the natural merge sort in pl-list.c behind sort/2, msort/2, keysort/2 and sort/4, and the two ways a sort can quietly drop your data.