psk09-maxsort-bool-nocut.pl

loading
details
attribute value
description
owner Johannes Waldmann
uploaded 2017-08-17 03:45:07.0
disk size 476 Bytes
downloadable true
type
attribute value
name no_type
processor id 1
description this is the default benchmark type for rejected benchmarks and benchmarks that are not associated with a type.
owning community none
loading contents
% Author: Carsten Fuhs
% sorting by extracting the maximum of a list

%query: maxsort(i,o).

eq(t,t).
eq(f,f).

neq(t,f).
neq(f,t).

del(_,[],[]).
del(X,[Y|YS],YS) :- eq(X,Y).
del(X,[Y|YS],[Y|ZS]) :- neq(X,Y), del(X,YS,ZS).

ge(t,t).
ge(t,f).
ge(f,f).

gt(t,f).

max([],f).
max([X],X).
max([X,Y|XS],Z) :- ge(X,Y), max([X|XS],Z).
max([X,Y|XS],Z) :- gt(Y,X), max([Y|XS],Z).

maxsort([],[]).
maxsort([X|XS],[Y|YS]) :- max([X|XS],Y), del(Y,[X|XS],ZS), maxsort(ZS,YS).
popout

content may be truncated. 'popout' for larger text window.

actions get anonymous link download benchmark