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
0
votes
1 answer

GNU Prolog (glpc): error trying to execute as: No such file or directory

I'm trying to use the GNU Prolog Compiler to build an executable from my Prolog program like so: $ gplc solution.prolog -o prog and it's failing with a really cryptic error: error trying to execute as: No such file or directory I can't figure out…
J3RN
  • 1,683
  • 4
  • 20
  • 27
0
votes
0 answers

GNU Prolog how to only consider variable substitutions that meet a certain condition

I am working with GNU prolog. I have the following facts that represent a school with students, where a student buddy is matched with multiple students, but not all students need to have a buddy: school(sc). student(s1, sc). student(s2,…
STcoder
  • 3
  • 2
0
votes
1 answer

Dealing with dynamic predicates that cause compilation failures

I am attempting to run an example GNU Prolog program used as an example during my course work. The code is pulled directly from https://www.cpp.edu/~jrfisher/www/prolog_tutorial/2_17pl.txt and was shown working at one point by my professor. However,…
Xlite
  • 5
  • 1
  • 2
0
votes
1 answer

How do I read a line of input from a user, until an EOF is hit, in GNU Prolog?

I have been reading the GNU Prolog documentation to figure out how to read a line of input until an end_of_file atom is reached. Here is my pseudocode for writing such a goal: read_until_end(Chars, Out): if peek_char unifies with end_of_file, Out…
Caspian Ahlberg
  • 934
  • 10
  • 19
0
votes
0 answers

How to load a file into GNU Prolog on mac?

I have looked at other questions and found no answers on how to do this, but how do you target a .pl file using GNU prolog on mac? When I boot it up, I try to load in the file using the filepath with this…
LiamKr
  • 1
0
votes
1 answer

GNU Prolog simple program doesn't work as expected

EDIT : I've just compiled gprolog from sources. It works fine. The version 1.4.5 in the Debian repo is bugged. It's my first program in GNU Prolog (gprolog) without any success. :-( I found these exercises in a Prolog tutorial. GNU Prolog 1.4.5 (64…
Aubin
  • 14,617
  • 9
  • 61
  • 84
0
votes
1 answer

Is there way I could fix this error ? Undefined symbols for architecture x86_64: (gnu-prolog)

My program runs fine on swi prolog but when i try run it using gnu-prolog. It does not run successfully. Im getting this error which I have no idea how to fix. This is my first error gprolog [myprojectname] ?- ran the program calling the…
user7175920
0
votes
2 answers

How to use read_line_to_codes & atom_codes iteratively to generate array of lines as strings of my .txt file?

I am trying to use read_line_to_codes(Stream,Result) and atom_codes(String,Result). These two predicates first, read line from file as an array of char codes, and then convert this array back to string. Then I would like to input all those strings…
Mandy
  • 145
  • 6
0
votes
1 answer

Integer square root works in SWI-Prolog and YAP, but but not in GNU-Prolog

I tested the following code by adding it to the user file in swipl, gprolog, and yap: isqrt(N, _) :- N < 0, !, fail. isqrt(N, N) :- N < 2. isqrt(N, R) :- X is N, Y is (N // 2), isqrt(N, X, Y, R). isqrt(_, X, Y, X) :- Y >=…
castle-bravo
  • 1,389
  • 15
  • 34
0
votes
0 answers

prolog nurikabe puzzle:Predicate not defined

I am trying to run this code in prolog to solve nurikabe puzzle , but i get this error Predicate fd_domain/3 not defined i am trying to make sure to get at the end a solution that contains : cells that represent sea -> connected horizontally and…
Mr.killer
  • 9
  • 2
0
votes
1 answer

GNU Prolog 'consult' directive not responding on Mac

I'm trying to look back at a run of some code I wrote earlier in the semester in GNU prolog. I move to the directory that is located. The file name is Project3_Name.pl I first type: gprolog It compiles leaving this message GNU Prolog 1.4.4 (64…
wcm_1348
  • 21
  • 4
0
votes
1 answer

How to use String (atom) terms in Gnu Prolog for java

I'm a newbie in prolog and wanted to write wampus AI with prolog + java , trying to do the logic in prolog and GUI in java but im stuck and a very basic level. basically I have something like this in my knowledge base parent(john, sarah). and i…
0
votes
1 answer

gnu-prolog - initialization predicate failing

In compiling and running the code below (pl_check_input.pl), I get "user directive failed" on the ":- initialization..." line :- dynamic(doit/0). :- initialization(doit). :- include(head). doit :- readFB(user_input), writeFB, halt. :-…
0
votes
0 answers

gprolog error for default functions: error(existence_error...

I keep running into an existence error for many different default functions in prolog (I'm using gprolog). For example... | ?- assert(a(1)). uncaught exception: error(existence_error(procedure,assert/1),top_level/0) | ?- g_assign(GVarName,…
Kendall Weihe
  • 2,021
  • 4
  • 27
  • 53
0
votes
0 answers

Gnu Prolog does not accept any user definitions

I am trying to learn Prolog. I have installed Gnu Prolog 1.4.4 on my Mac. I was directly following the example given in the Gnu Prolog Manual, section 4.2.3, "Consulting a Prolog program," but I am not getting the expected results: Compiled Sep 26…
Amittai Aviram
  • 2,270
  • 3
  • 25
  • 32