max_valued.pl

loading
details
attribute value
description
owner Johannes Waldmann
uploaded 2017-08-17 03:45:17.0
disk size 497 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
% Prolog and Natural-Language Analysis
% Fernando C. N. Pereira and Stuart M. Shieber
% terminating

%query: max_valued(i,o).
max_valued([Head|Tail],Max) :- max_Valued(Tail,Head,Max).
max_valued([],Term,Term).
max_valued([Head|Tail],Term,Max) :- higher_valued(Head,Term), !, max_valued(Tail,Head,Max).
max_valued([Head|Tail],Term,Max) :- higher_valued(Term,Head), max_valued(Tail,Term,Max).

higher_valued(X,Y) :- greater(s(X),Y).

greater(s(_),0).
greater(s(X),s(Y)) :- greater(X,Y).
popout

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

actions get anonymous link download benchmark