I got a little problem. I got a Prolog query which "return" the value I want but then as the second value i want it to return true or false. My other queries all work fine but this one doesn't.
Thats what i get:
queryA(T).
T = [..].
thats what I need:
queryA(T).
T = [..];
false/true.
I hope you can help me. Thanks!
Edit:
the Prolog code: finds all feature structure records (represented as lists in prolog [attribute:value,attribute:value,...]) in the knowledge base, and "returns" the smallest record which is bigger than the OldEvent or the OldEvent if there is no smaller value.
turnEventNotAlreadyUsed(Event, OldEvent) :-
findall(R,
( fsr(R),
type(R, turnEvent)
),
List),
list_min(List,OldEvent, Event).
if there is no OldEvent (OldEvent has the value : "unknown") then just take the latest feature structure record.
list_min([X], _, X). % X is min for single list, [X]
list_min(X,OldEvent,MinFSR):-
OldEvent = "unknown",
latest(MinFSR, X),
!.
% [...]
latest(R, [R]) :- !.
latest(R, [H|T]) :-
latest(L, T),
( after(L, H), !, R = L
; after(H, L), !, R = H
).
I'm not happy withOldEvent = "unknown"
either, how can I check whether OldEvent
is a normal String or a List?