Skip to content

Commit

Permalink
Converting Atom.is_error() in atoms.py into atom_is_error() in ba…
Browse files Browse the repository at this point in the history
…se.py, because error expressions are not part of the core MeTTa spec
  • Loading branch information
luketpeterson committed Oct 12, 2023
1 parent 3ac2582 commit 205b4d0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 0 additions & 3 deletions python/hyperon/atoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ def __repr__(self):
"""Renders a human-readable text description of the Atom."""
return hp.atom_to_str(self.catom)

def is_error(self):
return hp.atom_is_error(self.catom)

def get_type(self):
"""Gets the type of the current Atom instance"""
return hp.atom_get_type(self.catom)
Expand Down
4 changes: 4 additions & 0 deletions python/hyperon/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,3 +485,7 @@ def get_atom_types(gnd_space, atom):
"""Provides all types for the given Atom in the context of the given Space."""
result = hp.get_atom_types(gnd_space.cspace, atom.catom)
return [Atom._from_catom(catom) for catom in result]

def atom_is_error(atom):
"""Checks whether an Atom is an error expression"""
return hp.atom_is_error(atom.catom)
2 changes: 1 addition & 1 deletion repl/src/py_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get_config_atom(metta, config_name):
result = metta.run("!(get-state " + config_name + ")")
try:
atom = result[0][0]
if (atom.is_error()):
if (atom_is_error(atom)):
return None
else:
return atom
Expand Down

0 comments on commit 205b4d0

Please sign in to comment.