presentations/highlight-js/test/detect/prolog/default.txt

12 lines
249 B
Text
Raw Normal View History

2018-12-07 08:48:05 -06:00
mergesort([],[]). % special case
mergesort([A],[A]).
mergesort([A,B|R],S) :-
split([A,B|R],L1,L2),
mergesort(L1,S1),
mergesort(L2,S2),
merge(S1,S2,S).
split([],[],[]).
split([A],[A],[]).
split([A,B|R],[A|Ra],[B|Rb]) :- split(R,Ra,Rb).