Pandas Aggregation in Prolog

I tested your new trie based distinct/1 realization. Quite
amazing how it beats hash table from library(nb_set):

/* SWI-Prolog 9.3.14 */
?- time(test).
% 1,389,089 inferences, 2.078 CPU in 2.094 seconds (99% CPU, 668434 Lips)
true.

/* SWI-Prolog 9.3.14, nightly from 09. Nov 2024 */
?- time(test).
% 720,310 inferences, 0.578 CPU in 0.592 seconds (98% CPU, 1245942 Lips)
true.

Its the same test case as from the bagof/3 choker.
So mostlikely putting aggregate/3, bagof/3, setof/3 on a trie
footing will not only avoid choking but also give speed?!

test :-
   distinct(gen(_)), fail; true.

gen(L) :-
   between(1,300,_),
   between(1,300,N),
   length(L,N).