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
11
votes
4 answers

aggregating predicates in SWI-Prolog

I need to count all X for which some_predicate(X) holds, and there really a lot of such X. What is the best way to do that? First clue is to findall, accumulate to a list and return the length of the list. countAllStuff( X ) :- findall( Y …
10
votes
1 answer

How to query RDF/OWL using SWI-Prolog's Semantic Web Library?

How can I use the SWI-Prolog Semantic Web Library to make a query into the OWL/RDF file and extract some information? The OWL/RDF file is having information about all the Debian packages so I need to make the query in order to find package…
codious
  • 3,377
  • 6
  • 25
  • 46
10
votes
1 answer

SWI Prolog vs. GNU Prolog - CLP(FD) issues under SWI

I wrote a quick predicate in Prolog trying out CLP(FD) and its ability to solve systems of equations. problem(A, B) :- A-B #= 320, A #= 21*B. When I call it in SWI, I get: ?- problem(A,B). 320+B#=A, 21*B#=A. Whereas in GNU, I get the…
Name McChange
  • 2,750
  • 5
  • 27
  • 46
10
votes
2 answers

Run SWI-Prolog binary without swipl installed on the machine

I want to run swi-prolog program on the machine (actually a server) where there is no prolog installed. The prolog code swipl_test.pl: main :- write('Hello, world\n'). On the local machine 4.4.0-64-generic #85~14.04.1-Ubuntu SMP Mon Feb 20…
Fibo Kowalsky
  • 1,198
  • 12
  • 23
10
votes
1 answer

what about (SWI) Prolog as NoSQL platform?

I'd like to see (SWI)Prolog advertised as a NoSQL 'serious contender'. (SWI)Prolog has awesome data bindings features, and lot of power - of course - to write logic against such big data. With recent PLGI contribution, writing a sophisticated Gnome…
CapelliC
  • 59,646
  • 5
  • 47
  • 90
10
votes
4 answers

Prolog - handling binary data with DCGs

It seems to me one ought to be able to process binary data with DCGs on a list of bytes. To make it work generally, though, one has to use bitwise operations which means is/2 is involved, which means instantiation order is an issue, which may…
Daniel Lyons
  • 22,421
  • 2
  • 50
  • 77
10
votes
2 answers

Turning off warnings in swi-prolog

How Can I turn off warnings in swi-prolog. Clauses of XXX/AA are not together in the source-file is very annoying.
Juanjo Conti
  • 28,823
  • 42
  • 111
  • 133
10
votes
1 answer

Python interface with SWI-Prolog

I want to use a Python script as a frontend to a Prolog program that uses the SWI-PL engine. So, the components of the setup are: Python (2.7 or higher) SWI-PL: website here I've been looking around for an interface between SWI-PL and Python. What…
Mythio
  • 671
  • 2
  • 7
  • 18
9
votes
3 answers

Fold over a partial list

This is a question provoked by an already deleted answer to this question. The issue could be summarized as follows: Is it possible to fold over a list, with the tail of the list generated while folding? Here is what I mean. Say I want to…
user1812457
9
votes
5 answers

Overflow handling in GMP pow

(I am only an indirect user of the GMP-library primarily through swi-prolog and yap. But I am very much interested in fixing this problem.) When performing exponentiations with ridiculously large values, the host-systems or GMP are no longer able to…
false
  • 10,264
  • 13
  • 101
  • 209
8
votes
2 answers

Predsort/3 like msort/2

I would like to know is it possible to use predsort/3 without losing duplicate values? If not, that how should I sort this list of terms? Current sort function: compareSecond(Delta, n(_, A, _), n(_, B, _)):- compare(Delta, A,…
Trac3
  • 270
  • 3
  • 13
8
votes
3 answers

How to see all of the answers in SWI-Prolog without pressing spacebar?

Simple example: ?- between(1,10,X). X = 1 ; X = 2 ; X = 3 ; X = 4 ; X = 5 ; X = 6 ; X = 7 ; X = 8 ; X = 9 ; X = 10. When this is done using SWI-Prolog using the REPL to see the next answer the spacebar has to be pressed. How can all of the results…
Guy Coder
  • 24,501
  • 8
  • 71
  • 136
8
votes
2 answers

How to use predicate sharing the same name from several modules in Prolog

I am new to Prolog and I'm struggling with the following problem using SWI-Prolog. I have several files dataBase1.pl, dataBase2.pl, ... with the same structure (based on this thread) :- module(dataBase1,[]). :-…
8
votes
1 answer

Implementing partial evaluation in SWI-Prolog

I'm writing a partial-evaluator for Prolog queries. I tried to expand a query using expand_goal/2, but it simply unifies the Input with the Output in this case: :- initialization(main). main :- …
Anderson Green
  • 30,230
  • 67
  • 195
  • 328
8
votes
2 answers

Writing macros in SWI-Prolog

I am trying to implement a simple macro for switch-statements in SWI-Prolog. This is a series of conditional statements: (X = a -> Output = case1; X = b -> Output = case2; X = c -> Output = case3). and this is an equivalent (but much…
Anderson Green
  • 30,230
  • 67
  • 195
  • 328
1
2
3
81 82