Questions tagged [gnu-prolog]

GNU Prolog is an ISO compliant Prolog dialect developed by Daniel Diaz. GNU Prolog features constraints over finite domains, produces native binaries, and provides a bidirectional interface with C.

GNU Prolog is an ISO compliant Prolog dialect developed by Daniel Diaz.

In addition to traditional Prolog functionality GNU Prolog supports constraints solving over finite domains. Furthermore, GNU Prolog produces native binaries and provides a powerful bidirectional interface with C.

It spots a very clean WAM based architecture, giving access to the intermediate language at both bytecode and C levels.

103 questions
2
votes
2 answers

why does gprolog need so much RAM?

The following is from top command: size res 1127 *** 1 20 0 117M 2196K ttyin 0 0:00 0.00% gprolog 1149 *** 1 23 0 10700K 3728K ttyin 0 0:00 0.00% swipl Its RES is reasonable but its…
z_axis
  • 8,272
  • 7
  • 41
  • 61
1
vote
1 answer

Gnu Prolog segfaults on simple math

Given the following code: example1(X) :- X is 1. example2(X) :- X is 1+1. when I run it with gprolog, I get: $ gprolog GNU Prolog 1.4.0 By Daniel Diaz Copyright (C) 1999-2011 Daniel Diaz | ?- ['example']. compiling…
Tomo
  • 3,431
  • 5
  • 25
  • 28
1
vote
0 answers

GNU Prolog: member in list?

I'm using some code from the Art of Prolog. This example is causing an error in GNU Prolog. mem(X,[X|Xs]). user:2: warning: singleton variables [Xs] for mem/2 mem(X,[Y|Ys]) :- mem(X,Ys). user:3: warning: singleton variables [Y] for mem/2 Now I…
notaorb
  • 1,944
  • 1
  • 8
  • 18
1
vote
1 answer

Prolog project issue with GNU Prolog

I have an issue with this code that works in Swi Prolog but doesn't in GNU Prolog. :- dynamic libro/3. :- dynamic prestito/3. trim_whitespace(Input, Output) :- atom_string(InputAtom, Input), string_codes(InputAtom, InputCodes), …
Carlo27
  • 11
  • 1
1
vote
1 answer

Is there a way to execute piped shell command in GnuProlog?

Im trying to execute this piped command: powershell.exe Get-ChildItem | Where-Object { $\_.Name -match "router" } in GnuProlog: :- initialization(main). main :- shell('powershell.exe Get-ChildItem \174\ Where-Object { $_.Name -match "router"…
odium
  • 21
  • 2
1
vote
3 answers

Unfulfillable distribution with prioritization

i'm working on a distribution issue with gnu prolog. Im trying to distribute teachers to several school subject based on time conditions. The Code for the ideal case looks like this. soln(X) :- X = [T1M, T1E, T1H, T2M, T2E, T2H, T3M, T3E, T3H], …
Specta
  • 37
  • 6
1
vote
2 answers

How to use an fd solver to determine which elements of a list can sum to a given number?

Given a list of possible summands I want to determine which, if any, can form a given sum. For example, with [1,2,3,4,5] I can make the sum of 9 with [4,5], [5,3,1], and [4,3,2]. I am using GNU Prolog and have something like the following which does…
sail0r
  • 445
  • 1
  • 5
  • 18
1
vote
0 answers

Prolog How to use get_code in a pl file

I want to print a ASCII value of a character. I am using GNU prolog. Everything I have tried during 1h hasn't worked. So I came here and I have seen this post: Prolog - get_code/1 without prompt However, For every character in input, It write 10.…
1
vote
1 answer

How to convert from tuples_in/2 in SWI-Prolog to fd_relation/2 in GNU Prolog?

The following example code uses SWI-Prolog % example from https://github.com/Anniepoo/swiplclpfd/blob/master/clpfd.adoc :- use_module(library(clpfd)). trains([[1,2,0,1], % from station, to station, departs at, arrives at [2,3,4,5], …
sail0r
  • 445
  • 1
  • 5
  • 18
1
vote
1 answer

Combining two facts via a boolean OR in Gnu Prolog

I'm totally new to Prolog. So please excuse this possibly extermely simple qiuestion: I have a few facts like likes(peter,cars). likes(maria,bikes). likes(walter,bikes). likes(paul,bikes). likes(paul,cars). in a file likes.pl. Now I'm trying to…
halloleo
  • 9,216
  • 13
  • 64
  • 122
1
vote
1 answer

Prolog: 'Hello world' resulting in existence_error. Have checked file paths with no success

Here is my file: Here is proof of where the file is located: Here's what I typed into the GNU Prologue console: | ?- change_directory('C:/Users/Aidan/Desktop/Prolog practice'). yes | ?- [hello_world]. Expected result: compiling…
AidanofVT
  • 57
  • 4
1
vote
2 answers

When does Prolog prompts 'yes' and when does it says 'true'

I wrote the following knowledge base in Prolog: likes(yamini,chocolate). likes(anuj,apple). likes(yamini,book). likes(john,book). likes(john,france). Now, when I consult the above file and try the following commands: | ?- likes(anuj,apple). …
yamini goel
  • 519
  • 2
  • 10
  • 23
1
vote
1 answer

What is the difference between goals without and without call/2 in prolog?

What is the difference between these two goals? foo(A) :- A, !, fail. foo(A). foo(A) :- call(A), !, fail. foo(A). They seem to behave identically? What is the purpose of call/1 and is there an example of when it matters?
kentrid
  • 121
  • 2
1
vote
1 answer

How to run GNU-Prolog on VSC?

I'm new to using VSCode and also I'm learning Prolog so I want to know how to run it from the editor. I'm on windows and I already activated the enviroment variable LINEDIT=gui=no so when I call C:\GNU-Prolog\bin\gprolog.exe it runs on the…
Slyn
  • 11
  • 2
1
vote
1 answer

How to interface between C and gprolog?

I am in the somewhat unfortunate position of interfacing C and Prolog code. We have some data collection code in C, and some analysis code in Gnu-Prolog. So what is the best method to interface C and gprolog? I am currently trying to use the C…
apoorv020
  • 5,420
  • 11
  • 40
  • 63