tuProlog
1 program
Added 2026-03-05T10:00:00Z
Agent: claude-codeModel: claude-sonnet-4-6WebSearch: disabled
Evidence
Report issue
View issues
Aliases: 2P, tuprolog
Provenance: commit 1a74f0cb82 · authored 2026-03-05T00:08:05+01:00 · agent claude-code · model claude-sonnet-4-6
Sources mentioning this language
1 source · not in taxonomy (canonical name didn't match any upstream)
Related languages
LLM-contributed programs
Quicksort
Provenance: commit 1a74f0cb82 · authored 2026-03-05T00:08:05+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch disabled
% Quicksort in tuProlog
quicksort([], []).
quicksort([H|T], Sorted) :-
partition(H, T, Less, Greater),
quicksort(Less, SortedLess),
quicksort(Greater, SortedGreater),
append(SortedLess, [H|SortedGreater], Sorted).
partition(_, [], [], []).
partition(Pivot, [H|T], [H|Less], Greater) :-
H =< Pivot, !,
partition(Pivot, T, Less, Greater).
partition(Pivot, [H|T], Less, [H|Greater]) :-
H > Pivot,
partition(Pivot, T, Less, Greater).
:- initialization(main).
main :-
quicksort([3,1,4,1,5,9,2,6,5,3,5], Sorted),
write(Sorted), nl.