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

Reopen the prolog program after every edit for the code

Why should i halt the prolog program and run it again when i edit the code?? Is there any way to recompile without halting the program and reopen. Note I'm using swi 5.8.3 for windows.
Ahmed Hamed
  • 59
  • 1
  • 8
0
votes
1 answer

Getting running scriptname in prolog

Is there some way in prolog (SWI-Prolog) that I can get the name of the executing script just like the FILE in perl or arg[0] in C ? I read the docs and I see nothing about this.. the docs actually dont give much support with anything and have very…
ace007
  • 577
  • 1
  • 10
  • 20
0
votes
0 answers

Get command line arguments in prolog

Is there a standard function in prolog to get the arguments the compiled prolog executable was called with? get_arguments/0 or something like that? If there is no standard, is there at least a way to do that in swi-prolog?
tolUene
  • 572
  • 3
  • 18
0
votes
2 answers

run prolog script using random number, how change the random seed?

The problem consist in using a random number on my prolog script, i have the next code on the prolog file script.pl: main:- get_time(TS), set_random(TS), random(-1000.0, 1000.0, X), write('Random number: '), write(X), nl. I…
tonylattke
  • 98
  • 7
0
votes
2 answers

I wrote some prolog logic, how do I write a script that uses it?

I'm writing an assignment for a prolog class and I'm stuck on something simple. I've written a bunch of logic in a file called question1.pl I'm using SWI on Mac OS X, so at the command prompt I do this: swilg consult('question1.pl'). to load the…
user550738
0
votes
1 answer

compile with swi-prolog without including interactive prolog environment into binary

I am learning prolog, and I use swi-prolog as a compiler/interpreter. I have this hello world file: :- initialization(main). main :- format('Hello, world'). but when I try to compile it with swipl -o hello.exe -c hello.pro and run the binary…
tolUene
  • 572
  • 3
  • 18
0
votes
1 answer

why does `swipl -q` need more RAM and start slowly?

I am using swi-prolog version: 6.3.11. And there is no ~/.plrc. swipl -q starts VERY slow and needs more RAM given by top: size:315M RES:210M ?- listing. :- thread_local thread_message_hook/3. :- dynamic thread_message_hook/3. :- volatile…
0
votes
1 answer

Deploying Application that use SWI-Prolog without installing SWI-Prolog

I create a VS-Package application (.vsix) that uses SWI-Prolog inside it. My question is: how can I deploy my VS-Package application (VS 2012) without requiring the user the run the SWI-Prolog installer? Is it possible for me to just create a…
Budi Hartanto
  • 337
  • 3
  • 14
0
votes
1 answer

How to convert string to list of integer list?

I wrote X = [[1,2,3,4,5,6],[6,5,4,3,2,1]|...] to a file by the following code: ?-tell('test.txt'),maplist(format('~d ~d ~d ~d ~d ~d ~n'),X),told. $cat test.txt 1 2 3 4 5 6 6 5 4 3 1 1 ... And using the following code to restore…
z_axis
  • 8,272
  • 7
  • 41
  • 61
0
votes
1 answer

ERROR: read_util:read_line_to_codes/2: does not exist

While I am trying to read file and make some processing on the input and write them in another file, I met this error, ERROR: read_util:read_line_to_codes/2: Number does not exist Where Number is number of stream (ex: 04068B20)) and it's…
Yasmin
  • 931
  • 3
  • 14
  • 35
0
votes
2 answers

Interface from C-Programm in XCode to SWI-Prolog

i want to interface from c-code using XCode IDE under MAC OS X to SWI-Prolog. I´ve included the header files and use the following sample code: #include #include #include int main(int argc, const char *…
solick
  • 2,325
  • 3
  • 17
  • 29
0
votes
3 answers

how to compare strings in prolog

I want to write a program in prolog that compares two strings or string lists. I want achieve the following: if StringList A == StringList B { do this } else do something else How can I achieve this?
Jro
  • 466
  • 2
  • 6
  • 14
0
votes
1 answer

how to query prolog source file using php

i have a site made using PHP and backend mysql. There is a prolog file (.pro extension) which I would like to integrate with this site. My prolog source file can be queried like this - myprolog(Input, Output). So I give prolog Input, and it…
kallakafar
  • 725
  • 3
  • 11
  • 27
0
votes
1 answer

Prolog: display help on a shell prompt

I'm using a predicate to read some values in consecutive prompts in a prolog program shell, and I want the user to be able to get a help message when asked for input. The scenario would be: Ask for input If input = 'help', display help message and…
vmassuchetto
  • 1,529
  • 1
  • 20
  • 44
0
votes
1 answer

escaping "\=" when using string_concatenate in SWIPL swi-prolog

i would like to escape the backslash in swipl when using string_concat. Scenario 1- string_concat('stack', ' overflow', Result). Result = "stack overflow" Scenario 2- string_concat('stack', ' \=overflow', Result). Syntax error: Undefined…
user1644208
  • 105
  • 5
  • 12