num(N) :- No=N, write(No), nl. check(S) :- No==S -> write(Ok) ; write(Not ok). When i call num(5), it prints 5. However after calling num(5), when i call check(5), it prints Not ok. I think its
This is the problem. \"Mr. and Mrs. Astor, Mr. and Mrs. Blake, Mr. and Mrs. Crane, and Mrs. and Mrs. Davis were seated around a circular table. Mrs. Astor was insulted by Mr. Blake, who sat next to he
hi everyone I\'m here again, this week I got this Homework: I should find all the numbers between 10 and 10000 which has property like the following example:
I have a file, name: \"file1.pl\" in c:/. Now I want to load the file into the prolog, and then ask a query about the procedure and the relations that I defined.
run([H|T]) --> num(H),run(T). run([T]) --> num(T). num(increase) --> [increase],{write(1),nl}.
I have the next procedure for natural number开发者_如何学JAVA is SWI-prolog: natural_number(0).
a List of Lists like Lists=[ [1,2,3], [4,5,6], [7,8,3] ] and i want to get in this case all vertical lists like
Suppose I have a substitution S and list Xs, where each variable occurring in Xs also occurs in S. How would I find the list S(Xs), i.e., the list obtained by applying the substitution S to the list X
Consider the following Prolog code.It edits lines of a particular type in its input and prints out the remaining lines w/o any change.It uses a DCG called rule which isn\'t included below, since it\'s
I have a predicate: neig(I, J, I1, J1):- I1 is I - 1, I1 >= 0, J1 is J. neig(I, J, I1, J1):- I1 is I + 1,