Skip to content

Commit

Permalink
add xor processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Archbold committed Aug 19, 2024
1 parent c8e42b8 commit af29a01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/canary/metta_corelib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
metta_atom_corelib_defn( [=, [or, 'False', 'True'], 'True']).
metta_atom_corelib_defn( [=, [or, 'True', 'False'], 'True']).
metta_atom_corelib_defn( [=, [or, 'True', 'True'], 'True']).
metta_atom_corelib_defn( [=, [xor, 'False', 'False'], 'False']).
metta_atom_corelib_defn( [=, [xor, 'False', 'True'], 'True']).
metta_atom_corelib_defn( [=, [xor, 'True', 'False'], 'True']).
metta_atom_corelib_defn( [=, [xor, 'True', 'True'], 'False']).
metta_atom_corelib_defn( [=, [quote, _], 'NotReducible']).
metta_atom_corelib_defn( [=, [reduce, A, B, C], [chain, [eval, A], D, [eval, ['if-error', D, D, [eval, ['if-empty', D, [eval, [subst, A, B, C]], [eval, [reduce, D, B, C]]]]]]]]).
metta_atom_corelib_defn( [=, [subst, A, B, C], [match, A, B, C, ['Error', [subst, A, B, C], "subst expects a variable as a second argument"]]]).
Expand Down Expand Up @@ -129,6 +133,7 @@
metta_atom_corelib_types( [:, let, [->, 'Atom', '%Undefined%', 'Atom', 'Atom']]).
metta_atom_corelib_types( [:, match, [->, 'Atom', 'Atom', 'Atom', '%Undefined%']]).
metta_atom_corelib_types( [:, or, [->, 'Bool', 'Bool', 'Bool']]).
metta_atom_corelib_types( [:, xor, [->, 'Bool', 'Bool', 'Bool']]).
metta_atom_corelib_types( [:, quote, [->, 'Atom', 'Atom']]).
metta_atom_corelib_types( [:, return, [->, 'Atom', 'ReturnType']]).
metta_atom_corelib_types( [:, switch, [->, '%Undefined%', 'Expression', 'Atom']]).
Expand Down Expand Up @@ -178,6 +183,7 @@

op_decl(and, [ 'Bool', 'Bool' ], 'Bool').
op_decl(or, [ 'Bool', 'Bool' ], 'Bool').
op_decl(xor, [ 'Bool', 'Bool' ], 'Bool').
op_decl(case, [ 'Expression', 'Atom' ], 'Atom').

op_decl(apply, [ 'Atom', 'Variable', 'Atom' ], 'Atom').
Expand Down
1 change: 1 addition & 0 deletions src/canary/metta_ontology.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@
properties('&corelib','\\=', [logic, qhelp("Inequality test."), inequality]).
properties('&corelib','==', [logic, qhelp("Equality test."), equality_test]).
properties('&corelib','or', [logic, qhelp("Logical OR."), logical_or]).
properties('&corelib','xor', [logic, qhelp("Logical XOR."), logical_or])
properties('&corelib','and', [logic, qhelp("Logical AND."), logical_and]).
properties('&corelib','not', [logic, qhelp("Logical NOT."), logical_not]).
properties('&corelib','quote', [evaluation_control, qhelp("Prevents evaluation, treating input as literal.")]).
Expand Down

0 comments on commit af29a01

Please sign in to comment.