I am new to Prolog, and so far I have learned how to define a predicate in a file and run an interpreter to use it. But I would like to know if there is a way to define a predicate in an invitation? - so I don’t need to switch back and forth.
the way i do it now looks like this
defs.pl file:
adjacent(1,2).
adjacent(1,3).
in the prologue interpreter:
?- consult('defs.pl').
% defs.pl compiled 0.00 sec, 122 bytes
true.
?- adjacent(1,2).
true.
EDIT maybe, I meant how to define "facts", I'm not sure.
source
share