Questions tagged [swi-prolog]

SWI-Prolog is an open source implementation of Prolog that runs on Unix, Windows and Mac.

is an open source implementation of the programming language , commonly used for teaching and semantic web applications. It has a rich set of features and libraries including:

  • Constraint logic programming
  • Multithreading
  • Unit testing
  • GUI
  • Interfacing to Java
  • ODBC and others
  • Literate programming
  • A web server
  • SGML
  • RDF and RDFS

Along with developer tools (including an IDE with a GUI debugger and profiler).

SWI-Prolog runs on Unix, Windows, and Macintosh platforms.

SWI-Prolog has been under continuous development since 1987. Its main author is Jan Wielemaker.

The name SWI is derived from Sociaal-Wetenschappelijke Informatica ("Social Science Informatics"), the former name of the group at the University of Amsterdam, where Wielemaker is employed. The name of this group has changed to HCS (Human-Computer Studies).

http://www.swi-prolog.org/

Useful links

1221 questions
0
votes
1 answer

Swi-Prolog: Undefined procedure: random_permutation/2

Why this predicate random_permutation doesn't work? http://www.swi-prolog.org/pldoc/doc_for?object=random_permutation/2 ?- use_module(library(random)). % library(pairs) compiled into pairs 0.00 sec, 8,880 bytes % library(random) compiled into…
Leonardo
  • 358
  • 2
  • 17
0
votes
2 answers

Prolog User Identification

I am creating an API for web with prolog. The user will sign in with their name, and I would like the API to remember the user throughout session until user logs off, or shuts down API. This will of course have to be different for each unique user.…
dangood
  • 1
  • 1
-1
votes
1 answer

Prolog assignment fails

I am trying to build a simple greatest common divisor (cmmdc) in prolog and, for the following code, I get a fail on newY = X mod Y. Can anyone help me out? % cmmdc(X: intreg, Y: intreg, Ret: intreg) % (i, i, o), (i, i, i) cmmdc(X, 0, X):-…
-1
votes
1 answer

prolog List Reverse

%reverse_List reverseList(H|T,ReversedList):- reverseListHelper(T,[H],ReversedList). reverseListHelper([],Accumulator.Accumulator). reverseListHelper([H|T],Accumulator,ReversedList):- reverseListHelper(T,[H|Accumulator],ReversedList). I am…
-1
votes
1 answer

Prolog-return all triples of elements in the ring Zm which satisfy the property x + y = z- Arguments are not sufficiently instantiated

I am trying to Implement plus(X,Y,Z) , which should return all triples of elements in the ring Z_m that satisfy the property X + Y = Z, etc. Here is my codes: plus(X,Y,Z):-read(M),A is mod(X,M),B is mod(Y,M),Sum is A+B,Z is Sum mod…
Miu
  • 3
  • 2
-1
votes
1 answer

display a list in PROLOG in specific format

How can i display a list : Sorted = [p(201, 15, 2), p(301, 15, 3), p(401, 30, 4), p(501, 75, 5)]. in this format: 201 15 2 301 15 3 401 30 4 501 75 5 i used display(Sorted), is there any other function to solve this ?
elfii
  • 49
  • 7
-1
votes
1 answer

How bootstrap setarg_with_occurs_check/3 in Prolog?

How would one go about and bootstrap setarg_with_occurs_check/3 in Prolog. It seems Prolog has two ways to create cyclic data structures. Not only unification can do that, but also setarg/3: /* SWI-Prolog 8.3.26 */ ?- X = f(X). X = f(X). ?- X =…
user502187
-1
votes
1 answer

Compiling Prolog to exe file

this is to politely ask you how a prolog code can be converted to executable file format (.exe). Please help me step by step, I am new to prolog and I am doing a project using Prolog. I am windows user and I have only swi-prolog installed in my pc,…
-1
votes
1 answer

Can I take the output of a swipl command and set it as the value of a variable with swi-prolog?

I am trying to write an interface between the shell and swi-prolog so I would like (preferably) to have the text come in one line at a time but I can see why that might not possible. Swi-prolog has a shell predicate that will give the output of a…
Lambda Banquo
  • 81
  • 1
  • 5
-1
votes
1 answer

How to get more complex theory in Aleph with SWI-Prolog?

I tired to use Aleph to get a theory, but my out only one head with one body, actually I want more bodies. My input file is: :- use_module(library(aleph)). :- if(current_predicate(use_rendering/1)). :- use_rendering(prolog). :- endif. :- aleph. :-…
Vic
  • 27
  • 1
  • 4
-1
votes
1 answer

Compiling error Java "package jpl does not exist" on Ubuntu

I installed swi-prolog by using $ sudo apt-get install swi-prolog and $ sudo apt-get install swi-prolog-java However I can't compile anything on netbeans because it gives me this: As you can see on the screenshot, I even tried importing jpl.jar to…
Tamara
  • 3
  • 4
-1
votes
1 answer

Prolog code not workin on SWISH

The dog can perform the following actions: walk on floor; climb the box (if it is already at the box); and grasp the meat if standing on the box directly under the meat. but when i run the code below but i get an Error procedure `(A:-B)' does not…
-1
votes
1 answer

Is it possible to perform string processing in prolog

I want to perform some operation like string search, iterate, split etc on sentence. I checked couple of Prolog tuts but no help - http://kti.ms.mff.cuni.cz/~bartak/prolog/contents.html,…
user123
  • 5,269
  • 16
  • 73
  • 121
-1
votes
1 answer

Write data to CSV file from swi-prolog code

How can I write data to CSV file from the prolog code below? Thanks, SB run:- member(A,[a,b,c,d,e]), member(B,[1,2,3,4,5,6]), write(A),write(' '),write(B),nl, fail. run.
-1
votes
1 answer

Second End View puzzle, Prolog

I write code in swi-prolog to solve Second End View Pazzles 7*7 (example http://www.funwithpuzzles.com/2009/10/abcd-second-end-view-ev4.html like this 5*5) for numbers 1-6 :- [library(clpfd)]. gen_row(Ls):-length(Ls, 7), Ls ins 0..6. abc_view…
Oona
  • 3
  • 4
1 2 3
81
82