I am trying to use a meta-predicate \"=..\" to return a value. Now I have two examples below, the first one works
AIML files: http://www.alicebot.org/aiml/aaa/ I want to make these AIML files the knowledge base of my Prolog program.
fact(1,1):-!. fact(N,F):- N1=N-1, fact(N1,F1), F=F1*N. It leads to the stackoverflow(not the site)! It shouldn\'t because of the cut(!). Does it work 开发者_运维技巧in SWI-Prolog?Please note that bo
i\'m making a game in prolog, with a given set of domino pieces, it should make a correct domino row using all the pieces in the initial set. we must use an inference system in which we must build the
I want to add text to a database in prolog. Something like adding :- tell(\'a.txt\'), write(\'abc\'), told.
Can I get a recursive Prolog predicate having two arguments, called reverse, which returns the inverse of a list:
(This is NOT a coursework question. Just my own personal learning.) I\'m trying to do an exercise in Prolog to delete elements from a list. Here\'s my code :
answer(\"Yes\"). answer(\"No\"). 开发者_StackOverflow社区answer(\"Variable = value\"). receive(A) :- answer(A).
flatten([A|B],R):- (islist(A)->(flatten(A,R1),R=R1);(write(A),append([A],R1,R))), flatten(B开发者_JAVA百科,R1).
I need to write a small Prolog program to co开发者_运维百科unt the number of occurrence of each element in a list.