summaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
authorPeter Mikkelsen <peter@pmikkelsen.com>2021-07-08 21:54:27 +0000
committerPeter Mikkelsen <peter@pmikkelsen.com>2021-07-08 21:54:27 +0000
commitd2a0828140c31514c514b8e4fb9a4d52c389d8fe (patch)
tree01b461851fbae13f1d37fd880fe6ac21922de613 /types.c
parente9f5f2ffcc62eee564d37d5776e701bab548a496 (diff)
Add current_predicate/1 builtin
Diffstat (limited to 'types.c')
-rw-r--r--types.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/types.c b/types.c
index 6f2b33d..0e70abf 100644
--- a/types.c
+++ b/types.c
@@ -38,6 +38,20 @@ isnonemptylist(Term *t)
return 0;
}
+int
+ispredicateindicator(Term *t, int allowvars)
+{
+ if(t->tag == CompoundTerm && runestrcmp(t->text, L"/") == 0 && t->arity == 2){
+ Term *f = t->children;
+ Term *a = f->next;
+ if(allowvars)
+ return (f->tag == VariableTerm || f->tag == AtomTerm) && (a->tag == VariableTerm || a->tag == IntegerTerm);
+ else
+ return (f->tag == AtomTerm) && (a->tag == IntegerTerm);
+ }else
+ return 0;
+}
+
/* Other functions */
Term *
listhead(Term *t)