Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/tests/nofib/real/prolog/prolog.stdin

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


??
?- append(cons(1,nil),cons(2,nil),X)
;
?- append(X,Y,cons(1,cons(2,nil)))
;;;
?- append(cons(1,nil),cons(2,nil),cons(1,cons(2,nil)))
?- append(cons(1,nil),cons(2,nil),cons(1,cons(3,nil)))
parent(Child,Parent):==father(Child,Parent).
parent(Child,Parent):==mother(Child,Parent).
grandparent(GChild,Gparent):==parent(GChild,Parent),parent(Parent,Gparent).
father(charles,princePhilip).
mother(charles,theQueen).
father(anne,princePhilip).
mother(anne,theQueen).
father(andrew,princePhilip).
mother(andrew,theQueen).
father(edward,princePhilip).
mother(edward,theQueen).
mother(theQueen,theQueenMother).
father(william,charles).
mother(william,diana).
father(harry,charles).
mother(harry,diana).
?- grandparent(X,theQueenMother)
;;;;
?- grandparent(harry,Who)
;;
sibling(One,Tother) :== parent(One,X),parent(Tother,X).
?- sibling(harry,Who)
;;;;
newsib(One,Tother) :== parent(One,X),!,parent(Tother,X).
?- newsib(harry,Who)
;;
newsib1(O,T):==parent(O,X),!,parent(T,X),not(equals(O,T)).
?- newsib1(harry,Who)
;
bye

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.