This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/Logtalk/examples/lo/travellers/quick1.lgt
pmoura 75392e54c7 Logtalk 2.15.0 release files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@757 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2003-02-05 00:15:28 +00:00

46 lines
670 B
Plaintext

:- object(quick(_Order)).
:- info([
author is 'Paulo Moura',
version is 1.0,
date is 2000/4/22,
parnames is ['Order'],
comment is '.',
source is 'Example adopted from the Francis G. McCabe L&O documentation.']).
:- public(sort/2).
:- mode(sort(+list, -list), one).
sort([], []).
sort([X| L], S):-
split(L, X, L1, L2),
sort(L1, S1),
sort(L2, S2),
app(S1, [X| S2], S).
split([], _, [], []).
split([D| L], X, [D| L1], L2):-
parameter(1, Order),
Order::less(D, X),
!,
split(L, X, L1, L2).
split([D| L], X, L1, [D| L2]):-
split(L, X, L1, L2).
app([], L, L).
app([H| T], L, [H| T2]) :-
app(T, L, T2).
:- end_object.