转载自:https://mp.weixin.qq.com/s/kqzCFTLbKCIQPYn-E8lH4w
$ vim eating.pl
$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.15)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- [eating]. //载入eating.pl
true.
?- is_digesting(stork,mosquito).
true ;
false.
?- trace.
true.
[trace] ?- is_digesting(stork,mosquito).
Call: (10) is_digesting(stork, mosquito) ? creep
Call: (11) just_ate(stork, mosquito) ? creep
Fail: (11) just_ate(stork, mosquito) ? creep
Redo: (10) is_digesting(stork, mosquito) ? creep
Call: (11) just_ate(stork, _10044) ? creep
Exit: (11) just_ate(stork, frog) ? creep
Call: (11) is_digesting(frog, mosquito) ? creep
Call: (12) just_ate(frog, mosquito) ? creep
Exit: (12) just_ate(frog, mosquito) ? creep
Exit: (11) is_digesting(frog, mosquito) ? creep
Exit: (10) is_digesting(stork, mosquito) ? creep
true .
$ vim descend1.pl
$ swipl descend1.pl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.15)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- descend(anne,donna).
false.
?- descend(bridget,emily).
<