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 value only
Default value: implementation defined
Changeable: No
Description: The maximum arity allowed for any compound term, or
unbounded
when the processor has no limit for the number of arguments for a compound term.
So Prolog systems may or may not impose an upper limit on max_arity
... but what about the lower limit? Is, say, 5
okay?
NO!
ISO/IEC 13211-1:1995/Cor.2:2012, Technical Corrigendum 2, defines call/2..8
as:
8.15.4 call/2..8
...
NOTE — A standard-conforming processor may implement call/N in one of the following ways because error condition d is implementation dependent (3.91).
- Implement only the seven built-in predicates call/2 up to call/8.
- Implement call/2..N up to any N that is within 8..max_arity (7.11.2.3). Produce existence errors for larger arities below max_arity.
- Implement call/9 and above only for certain execution modes.
All of these ways only imply Max_arity >= 8
—but nothing more.
So my question has (at least) two sides:
Prolog User:
"What is the maximum arity I may use if I want to avoid vendor lock-in?"Prolog Implementor:
"What is the smallestMax_arity
I must support if I aim1 at ISO-Prolog conformity?"
Right now, I'm quite sure the answer is this:
Yes,
Max_arity = 8
is okay.
But is it in fact so? Are there clues I am missing?
Footnotes:
1) I do.