How can I connect C# and Sicstus prolog?
I am trying to connect prolog project with C#. How can i Do this? ...
I am trying to connect prolog project with C#. How can i Do this? ...
I have a problem trying to get some code that returns unique answers to my query. For example, defining stuff(A,B,C) :- A=C ; B=C. morestuff([],[],[]). morestuff([A|AA],[B|BB],[C|CC]) :- stuff(A,B,C), morestuff(AA,BB,CC). then running morestuff([A,A],[A,B],[a,b]). gives the output: A = a B = b ? ; A = a B = b ? ; yes. As you c...
Hi, I have prolog statements like this verb('part_of-8'). noun('doctor_investigation_system-2'). noun('dis-4'). berelation('be-6'). verb('be-6'). noun('hospital_information_system-11'). noun('his-13'). rel('part_of-8', 'doctor_investigation_system-2'). rel('doctor_investigation_system-2', 'dis-4'). rel('part_of-8', 'be-6'). rel('part_o...
Hello, I am trying to write a predicate that given the following list in Prolog: [[1,a,b],[2,c,d],[[3,e,f],[4,g,h],[5,i,j]],[6,k,l]] will produce the following list: [[6,k,l],[[5,i,j],[4,g,h],[3,e,f]],[2,c,d],[1,a,b]] As you can see I would like to preserve the order of the elements at the lowest level, to produce elements in the ...
Is there a way to determine the type of an element within a list in Prolog? I know that variables aren't explicitly typed in Prolog, but I need to check whether an element is a number, a specific character, etc. How can this be accomplished? ...
I am attempting to learn the basics of Prolog for a class. I'm running into the seemingly simple problem of not being able to store a list within a rule and retrieve it for usage in other clauses. For example: % These are the contents of the pl file I want to consult % Numbers I want to process inputList([3,2,1,0]). % Prints out the c...
I currently have the following problem, that I want to solve with Prolog. It's an easy example, that would be easy to solve in Java/C/whatever. My problem is that I believe to be too tied to Java's thinking to actually formulate the problem in a way that makes useof Prolog's logic power. The problem is.. I have a set of 6 arrows, eithe...
resolve(K, K, _) :- writeln('finished'). %goal state resolve(CurrentState, GoalState, Path) :- suc(_, CurrentState, NextState, GoalState), append(Path, [CurrentState], NextPath), resolve(NextState, GoalState, NewPath). I currently have this algorithm, and it works as it should. I am running it like this: resolve(0, 10, Pa...
I am experimenting with prolog, reading "Programming in prolog using the ISO standard, fith edition". I have installed yap (yet another prolog) on my ubuntu 10.10 Maverick RC system, installed using synaptic. I am running prolog from within emacs23 using prolog-mode. The following code (from chapter five of book) does not give results a...
I'm given a list of arcs: arc(a,b). arc(b,c). arc(c,d). arc(d,b). arc(d,e). arc(e,e). arc(e,f). I've written a set of clauses which will tell me if theres a path from node X to node Y. Loops may occur and I've accounted for that. path(X,Y) :- arc(X,Y). path(X,Y) :- arc(X,Z), path(Z,Y,[X]). path(X,Y,P) :- arc(X,Y). path(X,Y,...
Hello, I currently have the need to execute prolog code in an application I am making. I am aware that Apple probably never would allow something like this in the App Store, but that is not the intention either. This is more a private project that will never reach the App Store. Purpose In this case prolog is used to describe an objec...
i done my prolog coding and no error when run it. but still cannot get the output i want. so i want to ask where is the problem. my coding is like bellow even_member(X, [X|_]). even_member(X, [_|Tail]) :- 0 is X mod 2, write(X), nl, even_member(X, Tail). the output i need it is when key in even_member(2,[1,2,3,4,5,6]). w...
As many programmers I studied Prolog in university, but only very little. I understand that Prolog and Datalog are closely related, but Datalog is simpler? Also, I believe that I read that Datalog does not depend on ordering of the logic clauses, but I am not sure why this is advantages. CLIPS is supposedly altogether different, but i...
How would you code a program in Prolog to print numbers from 1 to 10 using recursion? I've tried the following but it doesn't work, can you tell me why? print_numbers(10) :- write(10). print_numbers(X) :- write(X),nl,X is X + 1, print_numbers(X). ...
Say I have the following piece of code: edge(a, b). edge(a, c). edge(a, d). Now when I do neighbors(V, N) :- edge(V, N), writeln(N), fail. I can get a list of the neighbors printed out to the console. But how can I get it as a result list? Something like neighbors(V, Vs) :- edge(V, N), not(member(N, Vs)), neighbor...
Hi everybody, first off thanks for helping. I am writing a prolog program describing family relationships, including all versions of in-laws. The logic is all there, what I need help with is some prolog problems as I am not very experienced with it. I am trying to set up multiple possibilities for each rule through use of semicolons. T...
I am trying to make a predicate in order to validate if a given input represents a formula. I am allowed to use only to propositional atoms like p, q, r, s, t, etc. The formulas which I have to test are the following: neg(X) - represents the negation of X and(X, Y) - represents X and Y or(X, Y) - represents X or Y imp(X, Y) - represe...
I plan to make a little obfuscatory logic language. It's going have some features prolog doesn't. Probable some of the features I want aren't possible to unify. But before I ask what features I should drop you should know what my language is. A comma means and. A semicolon means or. Things which would be zero-ary constructors take one ar...
Hi there, I can easily write a predicate to get unique elements from a given list in Prolog e.g. no_doubles( [], [] ). no_doubles( [H|T], F ) :- member( H, T ), no_doubles( T, F ). no_doubles( [H|T], [H|F] ) :- \+ member( H, T ), no_doubles( T, F ). However, how can you do the same thing but for something other than a normal lis...
Hi,in visual prolog there is "domains" section in a prolog program in which you can define types. Is there any similar thing in swi-prolog? In visual prolog a type is defined like: domains NewType = thing1; thing2 ...