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

Why doesn't gnu prolog support the "false" predicate? (I've changed to swi)

I've been using the gprolog thingy to do some things in prolog. But now when testing some more code I discovered that it does not support "false". Which is supported by swi?
Algific
  • 1,470
  • 2
  • 18
  • 33
4
votes
2 answers

Representation of negative integers

Does ISO-Prolog have any prescriptions / recommendations regarding the representation of negative integers and operations on them? 2's complement, maybe? Asking as a programmer/user: Are there any assumptions I can safely make when performing…
repeat
  • 18,496
  • 4
  • 54
  • 166
4
votes
1 answer

Testing "Safe term order" predicate

In a recent question (How to define (and name) the corresponding safe term comparison predicates in ISO Prolog?) @false asked for an implementation of the term ordering predicate lt/2, a variant of the ISO builtin (@<)/2. The truth value of…
repeat
  • 18,496
  • 4
  • 54
  • 166
4
votes
1 answer

throw without catch in ISO Prolog

I am struggling with what is the precise semantics of throw/1 without a suitable catch/3 in ISO Prolog. I am reading the ISO Prolog specification, and it seems to me that the execution will end up in an infinite recursion. (Note that you must have…
ZbynekZ
  • 1,532
  • 10
  • 16
4
votes
1 answer

Prolog operator priority

The user input is given in the format a:b>c>d>e... and so on. I would like to parse the input into :(a,>(b,>(c,>(d,e))) would that be possible and is there any suggestion to do that? I tested with this prepare:- op(750,xfx,user:(:)), % change…
CHT
  • 137
  • 1
  • 6
4
votes
1 answer

How truncate file length in Prolog?

How do I truncate the file length in Prolog? I only find a set_stream_position/2 predicate in the ISO standard. But I don't find a set_stream_length/2 predicate in the major Prolog systems. Similarly there is a stream property position/1, but…
user502187
3
votes
1 answer

What is the use of prolog pairs in or outside lists

I encountered several times Key-Value pairs in the SWI-PL doc but couldn't get a good info about them. Is this something standard in prolog or is it just a swi pl only extension ? Mainly found here :…
m09
  • 7,490
  • 3
  • 31
  • 58
3
votes
1 answer

Why does prolog use =< and not <=?

The numerical comparison operators in prolog are pretty much the same as every other language. operator meaning X > Y X greater than Y X < Y X less than Y X >= Y X greater than or equal to Y X =< Y ( not <= ) X less than or equal to…
3
votes
2 answers

at_end_of_stream on stdin in Prolog

I ask SICStus Prolog ?- at_end_of_stream. on the top-level and immediately I get: no. GNU Prolog and Scryer Prolog do the same. Traella Prolog and SWI-Prolog, however, choose to wait for input before answering, and rumor has it that behaving like…
repeat
  • 18,496
  • 4
  • 54
  • 166
3
votes
2 answers

End_of_stream property after opening empty file

I'm running the following query in a directory having an empty file empty: ?- member(EOF_action,[error,eof_code,reset]), open(empty,read,S,[eof_action(EOF_action)]), stream_property(S,end_of_stream(EOS)), close(S). Here's what I get from…
repeat
  • 18,496
  • 4
  • 54
  • 166
3
votes
1 answer

Safe sorting of terms

Standard term order takes variables as syntactic objects only. As a consequence beside other problems, sort/2 breaks the common assumptions of a relational definition. Neither can answer substitutions be a guarantee for solutions nor are ground…
false
  • 10,264
  • 13
  • 101
  • 209
3
votes
1 answer

What is the right error for corner cases of datetime conversion?

TL;DR:     The predicate datime/2 (offered by SICStus Prolog and SWI-Prolog) relates UNIX time to a record containing year, month, day, hour, minute, and second. For some corner cases I got weird answers which made me wonder: Which error(s) should…
repeat
  • 18,496
  • 4
  • 54
  • 166
3
votes
3 answers

Proper handling of denormal floats in ISO-Prolog

Denormal floats are something special: What does the ISO-Prolog standard say on how these should be handled? It is clear to me that raising a evaluation_error(underflow) exception whenever these denormals occur is a proper way of dealing with them,…
repeat
  • 18,496
  • 4
  • 54
  • 166
3
votes
1 answer

current_predicate in SICStus Prolog

SICStus Prolog offers both current_predicate/1 and current_predicate/2. The manual page states: current_predicate(?PredSpec) Unifies PredSpec with a predicate specifications of the form Name/Arity. current_predicate(?Name, ?Term) Unifies Name with…
repeat
  • 18,496
  • 4
  • 54
  • 166
3
votes
3 answers

The smallest `max_arity` of compound terms in ISO Prolog programs

Prolog systems aiming at iso-prolog conformity do not have to support compound terms with arbitrarily large arities. The Prolog flag max_arity reflects this. According to ISO/IEC 13211-1:1995: 7.11.2.3 Flag: max_arity Possible values: The default…
repeat
  • 18,496
  • 4
  • 54
  • 166