Replies: 2 comments
-
Even without a module system, we need The reason is that it lets the compiler and development tools deduce statically which predicates are called when a partial goal is specified as an argument of a meta-predicate. You need this information for example when implementing a cross-referencer, or to detect which predicates are certainly called etc. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is this information correct?
Supported (please correct any inaccuracies)
+
?
-
:
I
(integer)Not supported
^
//
Curried/Partial Predicates
A predicate is often denoted
P/N
, whereP
is the name of thepredicate and
N
is the arrity. A partial predicate is a predicateP/M
whereN #= I + M
. In this case, as in the example below,I
isthe number in the metapredicate directive and
M
is the number ofpartial predicates.
So given
In this case, we have
bar/N
whereN=3
. It is a partial goal tofoo/3
's first argument asbar(1,3)
wwhich isbar/M
, whereM=2
.Since
foo/3
's meta predicate directive specifies the first argumentas 1, as in
meta_predicate(I, ?, ?)
(note: not valid syntax,for explanatory purposes only) where
I=1
, andN#=M+I => 3#=2+I => I #= 1
, we see that one additional argument is tobe supplied.
Questions, mostly answered
Questions: ==========^
... is this a thing? The word "annotation" doesn't even showup in the ISO-standard. (but I don't see metapredicates there
either...). Saw this on the SWIPL docs:
https://www.swi-prolog.org/pldoc/man?section=metapred
( Edlt: No, see metapredicate spec #2617 (comment) )
The numerical value doesn't seem to do anything, it also doesn't
matter if you use and of the other values either? (Edit: see metapredicate spec #2617 (comment))
It seems like the most important thing metapredicates do from a
technical standpoint is attach module information when required? (Edit: see metapredicate spec #2617 (comment))
#2617 (comment)
Beta Was this translation helpful? Give feedback.
All reactions