I am searching for a tutorial/example on creating and searching binary tre开发者_如何转开发es in prolog.
I was wondering if anyone could help me with this problem: I have to order a list using Prolog with Constraing Logic Programming and I must do it with the more efficient way I can.
permutation([], []). permutation(L, [X|Xs]) :- select(X, L, Rest), permutation(Rest, Xs). If I type permutation([1,2,3],R), the first solution is \"[1,2,3]\" but how to get to the second one without
I\'m trying to learn SWI prolog, but my simple program fails when I believe it should succeed. %My code:
I need to write something 开发者_StackOverflow社区like circular buffer in TurboProlog 2.0 for calculating average. I don\'t know what predicates i need to write, and have no idea how link them togethe
I am trying to write a procedure order(List,Result) that has a List as input and returns a list Result of ordered pairs such that:
I have this program written in prolog language. The problem is that i cant understand how it works. even_number([],[]).
I tried to understand how this code works but i failed. It concatenates two lists and then it reverses the result.
I have this code co开发者_Python百科lor(blue). color(red). color(blue). color(green). I want to make a rule that will count how many times the X color exists.
Let\'s say I have these facts: parent(bob, sam). %bob is sam\'s parent parent(sara, sam). %sara is sam\'s parent