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/packages/meld/examples/temperature/maxtemp.meld

34 lines
512 B
Plaintext
Raw Normal View History

type logical_neighbor parent(module, first module).
type maxTemp(module, max float).
parent(A, A) :- root(A).
parent(A, B) :-
neighbor(A, B),
parent(B, _).
maxTemp(A, T) :-
temperature(A, T).
maxTemp(B, T) :-
parent(A, B),
maxTemp(A, T).
type globalMax(module, max float).
globalMax(A, T) :-
maxTemp(A, T),
root(A).
globalMax(B, T) :-
neighbor(A, B),
globalMax(A, T).
type localMax(module).
2010-11-03 16:16:40 +00:00
localMax(A) :-
temperature(A,T),
forall
neighbor(A, B)
then
( temperature(B, TT), T > TT ).