Questions tagged [iso-prolog]

ISO/IEC has standardized Prolog. The standard is maintained by ISO/IEC JTC1/SC22/WG17.

ISO/IEC has standardized Prolog. The standard is maintained by ISO/IEC JTC1/SC22/WG17.

The currently valid Prolog standard documents can be obtained from national member bodies like ANSI or directly from ISO. Overview of defined features.

Stack Overflow contributions about the standard documents:

143 questions
3
votes
2 answers

Prolog jargon: id(X,X). fact or rule?

In Prolog, this is unambiguously a fact: foo(bar). And this is unambiguously a rule: foo(X) :- bar(X). But what about a clause that has both non-singleton variables and no :- such as identity(X,X). or more realistically something…
Elliot Way
  • 243
  • 1
  • 9
3
votes
1 answer

Why is prolog unification depth-first-search instead of breadth-first-search?

I just started learning about prolog and I was wondering why it's dfs instead of bfs and why there isn't an easy way to change it. Does ISO prolog mandate it?
nosefouratyou
  • 331
  • 1
  • 8
3
votes
1 answer

How is a integer created as a character code constant?

I am building some test cases for integer/1 using SWI-Prolog. ISO/IEC 13211-1 gives a BNF definition for integer and one of the alternatives for integer is for a character code constant. I am able to create and test examples of all the other…
Guy Coder
  • 24,501
  • 8
  • 71
  • 136
3
votes
1 answer

Behavior of cuts in negation

The following code, as expected, outputs 123 because of backtracking: between(1,3,X), write(X), false. This one with the cut outputs 1, also as expected: between(1,3,X), write(X), !, false. But this one outputs 123 surprisingly: between(1,3,X),…
Fatalize
  • 3,513
  • 15
  • 25
3
votes
1 answer

Listing predicates within a given library module

Is there a means to list all the predicates that are defined in a given library module for SICStus Prolog? e.g. if I load the lists module: | ?- use_module(library(lists)). is there another predicate I can run from the prompt to tell me what…
bph
  • 10,728
  • 15
  • 60
  • 135
3
votes
2 answers

Unable to create Fact in Jekejeke Prolog

I'm using the Seven Languages In Seven Weeks Prolog tutorial and trying to run through some examples using the Android Jekejeke Runtime. For example, if I add likes(wallace, grommit). from the tutorial, I get. Error: Undefined, private or package…
matt freake
  • 4,877
  • 4
  • 27
  • 56
3
votes
3 answers

Replacing white spaces in prolog

Is it possible in prolog to replace all white spaces of a string with some given character? Example- If I have a variable How are you today? and I want How_are_you_today?
user4075334
3
votes
1 answer

What kind of meta argument is the first argument of predicate_property/2?

In other words, should it be 0 or : or something else? The Prolog systems SICStus, YAP, and SWI all indicate this as :. Is this appropriate? Shouldn't it be rather a 0 which means a term that can be called by call/1? To check your system type: | ?-…
false
  • 10,264
  • 13
  • 101
  • 209
3
votes
4 answers

Is there an ISO-Prolog reference implementation?

Java has a reference implementation. Does ISO-Prolog have a reference implementation? I do have INCITS/ISO/IEC 13211-1:1995 (R 2007) so no need to suggest that. EDIT Of note: Conformity Testing I: Syntax
Guy Coder
  • 24,501
  • 8
  • 71
  • 136
3
votes
1 answer

Why am I getting a type error on pi in Prolog?

I am using pi as part of a Prolog program I am writing. Here is my only mention of pi in the whole program: ArcDistance is ((Degree/ 360) * Diameter * pi). However, when I run the program, I get the following error: uncaught exception:…
user1462294
  • 167
  • 4
  • 13
3
votes
3 answers

About Prolog syntax

Sometimes I see terms like: X = a:b or X = a-b I can do requests like X = Y:Z and the compiler unifies Y with a and Z with b, as expected. Now my answer: Which characters (or sequence of characters) am I allowed to use to combine two…
mrbela
  • 4,477
  • 9
  • 44
  • 79
3
votes
2 answers

Atom escaping rules in Prolog

I need to export to a file a Prolog program expressed using an arbitrary term representation in Java. The idea is that a Prolog interpreter should be able to consult the generated file afterwards. My question is about the correct way to write in the…
Sergio
  • 8,532
  • 11
  • 52
  • 94
3
votes
2 answers

Standard way to see what phrase/3 translates?

I am trying to dig into the GNU Prolog behaviour of: test(X,I,O) :- phrase(X,I,O). ?- test(("a",!,"b"),"ab",""). Is there a standard way to see to what phrase/3 translates? According to the ISO DCG proposal (*), there is the requirement that we…
user502187
3
votes
2 answers

Generating a new atom based on existing atom within a list

I would like to know how to generate a new atom in a list based on existing atom in another list. Given list: L=[a,b,c,d] I would like to produce a new list, for example: P=[a_,b_,c_,d_] In other words something similar to string addition,…
Roger
  • 31
  • 2
2
votes
2 answers

Term order for complex Abstract Syntax Tree

I have a question about abstract syntax trees. In particular I want to sort several trees with an particular term order. How can one define a term order for an AST with the following properties: For allmost all terms, the order behaves exactly like…