Conversation
tabled/1 built the table/1 directive by concatenating the raw
predicate name unquoted, e.g. ':- table count-atom/3.'. Since '-'
is a Prolog infix operator, unquoted hyphenated names (like
count-atom) are misread as an arithmetic expression instead of
an atom, raising a 'tabled_mode' domain error.
Fixes this by embedding the name as a quoted atom
(':- table 'count-atom'/3.') and simplifying the implementation
to a single translatePredicate call instead of three.
Aryam-21
force-pushed
the
fix/lib-tabling-hyphen
branch
from
August 28, 2026 05:15
c5d603d to
fb55255
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reproducing the bug (before this fix)
Run this against the unpatched
lib_tabling.metta:This fails with:
Root cause:
tabled/1embeds the predicate name unquoted in thegenerated
:- table Name/Arity.directive. Since-is a Prologinfix operator,
count-atomgets parsed ascount - atominsteadof as an atom.
Fix
Wrap the name in single quotes before embedding it, so it's read
as one atom regardless of its characters:
Verified
Also confirmed end-to-end via
sh run.sh examples/tabling_hyphen.metta—
tabled((count-atom $x $y))now loads with no error.