Using Prolog\'s =.., is it possible to get something such as f(x),g(开发者_StackOverflow社区x) from [f,x,g,x]?I can use H =.. [f,x,g,x] to get f(x,g,x) but this isn\'t what I want.Apologies if this is
I have to write a program which has a predicate p(A,B,C,D,E,F). A,B,C,D,E,F are lists. A contains D, E and F. (Something like A and B is D, A and C is E) F contains A with开发者_C百科out D and E.
How can I transpose a list like [[1,2,3][4,5,6开发者_Go百科][6,7,8]] to [[1,4,6],[2,7,8],[3,6,9]]?
i downloaded some facts from open streetmap project, you can download it here http://www.mediafire.com/?15pttpp847ld71x
I have a list of stirings I need to manipulate and write out. I get the strings the usual way with H|Tail recu开发者_如何学Pythonrsion.
Let\'s say I want to make a rule dependency graph for a Prolog program, in Prolog. For instance, the following program
With SWI Prolog, there\'s a predicate that finds the nth item in a list called nth1.I want to implement my own version of the predicate but SWI\'s is so complicated if you look at the listing(nth1) co
I\'m looking for a fast way to sort a list in reverse order in Prolog. Algorithmically it should perform as quickly as standard sort, but the options that I\'ve come up with are much slower, for obvio
How can I开发者_Go百科 double even numbers in a list in Prolog? For example: X=[1,2,3,5,4] The result should be:
Question is simply... why this doesn\'t work? replace([l|[r|[r|[l|R]]]], Result) :- append([f,f],R,Result).