Subject: [SWIPL] how sort works?

From: "Kobi" <[email-masked]>
Date: Thu, 30 Aug 2001 02:25:46 +0200

Does somebody know how the function 'sort' works?
from some reason whn I do listing(sort).
It doesn't give me the way this function build.

I know it should be something like

insert_sort(List,Sorted):-i_sort(List,[],Sorted).
i_sort([],Acc,Acc).
i_sort([H|T],Acc,Sorted):-insert(H,Acc,NAcc),i_sort(T,NAcc,Sorted).
   
insert(X,[Y|T],[Y|NT]):-X>Y,insert(X,T,NT).
insert(X,[Y|T],[X,Y|T]:-X=<Y.
insert(X,[],[X]).
But this is for numbers. anyway it doesn't what I need
I have to see how sort is.
thanks