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
2 answers

Prolog XPCE how to get multiple values from text item?

I have a dialog which contains multiple text item elements and a button. How can i retrieve the values and use them? new(D, dialog('Add a recipe')), send(D, append(new(NameItem, text_item('Name')))), send(D, append(new(InstItem, …
Dizeme
  • 59
  • 9
0
votes
1 answer

A program crashing the SWI Prolog console

I'm running a Prolog program that I wrote (a proof tester in natural deduction), and when I run the program (run_all_tests('proof_tester.pl').) the program runs, prints stuff from my program in the console(I barely have time to see what), and then…
Rickard
  • 1,289
  • 1
  • 17
  • 27
0
votes
1 answer

Prolog: how to write n amount of characters of a string?

I'm really new to prolog and i have to write a predicate what takes in a string and an integer and writes out as many characters of that string as the integer value is. How can i do this ? Example: myPredicate('Hello',4). %will write out…
Marek
  • 261
  • 4
  • 14
0
votes
0 answers

Prolog findall function XPCE

:-consult('external data base.pl'). listaw:- new(SS, dialog('Rekordy w bazie wiedzy')), send(SS, display, new(W3,text('some text'))), new(M,menu(von,cycle)), findall(B,failure(B,_,_),Y), send_list(M, append, Y), …
Przemek
  • 71
  • 1
  • 1
  • 4
0
votes
0 answers

cannot run Prolog application in ProDT in eclipse kepler and juno

I've installed ProDT plugin for ide. It highlights the code, have configuration for Prolog interpreter. But there is no way to run app. Also Right Click/ProDT/"Consult in Console" dids nothing. How to fix that? Run as/"Run Swi session" menu…
Vyacheslav
  • 3,134
  • 8
  • 28
  • 42
0
votes
1 answer

SWI prolog: answers written in red and/or black

I'm very new to prolog and I'm trying to (self) learn from the basics using SWI-Prolog (windows version). This question of mine is certainly a newbie problem, plese forgive my naivety. I am working with the main interactive window, trying to follow…
DavAlPi
  • 3,138
  • 1
  • 14
  • 9
0
votes
1 answer

optimised minimum value using findall/3

I am trying to optimise and find the minimum Cost of a function. The program below uses findall/3 to iterate over all possible options of values which are generated from using the clpfd library provided by SWI-Prolog. There are several Cost values…
Namit
  • 1,314
  • 8
  • 20
  • 36
0
votes
1 answer

Colorized output in the swipl-win (SWI-Prolog) window

What I'm Doing I am currently working on creating a SWI-Prolog module that adds tab-completion capability to the swipl-win window. So far I've actually gotten it to where it reads a single character at a time without stopping/returning anything…
ksoo
  • 434
  • 1
  • 3
  • 15
0
votes
1 answer

Assert facts from java to prolog

I'm using SWI-Prolog with the JPL library. I have a program written in Java that produces strings like these: fact(1,2) fact(2,3) fact(1,3) Then, there is a prolog file that needs this facts in the head of file. I do not want neither insert the…
user840718
  • 1,563
  • 6
  • 29
  • 54
0
votes
1 answer

Prolog for loop syntax error

I am trying to make a game similar to minesweeper and i need to check the neighbours of a square in the map but i get a syntax error at my for loop, I am using SWI-Prolog checkneighbours(X,Y) :- retractall(vecini(_)), assert(vecini(0)), foreach(I in…
Bogdan
  • 402
  • 2
  • 8
  • 18
0
votes
1 answer

How can extract the module's name in a file?

How can extract the module's name and the optional predicates present in a file? If I have a file.pl containing the call to one or more modules, how can I extract the name of these modules and the name of the predicates in the module…
Vincenzoni
  • 55
  • 4
0
votes
1 answer

String comparison program in swi-prolog always fails

I'm trying to write a program using swi-prolog that randomly asks people for their first or last name and prints "correct" or "incorrect" based on what they type. The current correct answers are "Hello" and "World" but regardless of what the user…
Joshua Snider
  • 705
  • 1
  • 8
  • 34
0
votes
1 answer

swi prolog solve

I am using SWI Prolog for windows 7 and one of my assignments is a basic logic puzzle. We have been given a sample solution to a seperate problem - including its source code. Its the "Its a tie" problem. However I do not know how to get results…
alexeidebono
  • 99
  • 2
  • 6
  • 12
0
votes
2 answers

correct SWI_HOME_DIR value?

I encountered error: "FATAL ERROR: Could not find system resources" I then added the following code: putenv("SWI_HOME_DIR=/usr/lib/swi-prolog"); I ran into another problem of: "$c_call_prolog...Undefined procedure" (More details here) I ran…
0
votes
2 answers

Reading a file line by line searching for a string

I have a plain text file and a few random lines of data, nothing specific.. I was wondering how exactly I would go about reading this file line by line as the following pseudo code: arrLines[] data = open ("x.txt", read, handle) for line in data …
ace007
  • 577
  • 1
  • 10
  • 20