trueagi-io / metta-wam

A Hyperon MeTTa Interpreter/Transpilier that targets the Warren Abstract Machine
8 stars 11 forks source link

Different behaviors of eval from Rust interpreter #155

Open vulecoff opened 2 weeks ago

vulecoff commented 2 weeks ago

The following code has different behaviors in Mettalog and Rust interpreter

(= ((f $x) $y) (f $x $y))
(= ((f $x $y) $z) (f $x $y $z))
!(eval (((f 1) 2) 3) )

This is reduced to (f 1 2 3) in MettaLog, and unreduced in Rust Interp (eval (((f 1) 2) 3) ).

I'm not sure which one is the expected behavior. Since eval is supposed to make one step of evaluation, it will find a match for the entire outer expression, rather than attempt to reduce its sub-expression. So Rust interp's behavior may be the correct one here.

As another example, !(eval (C (+ 1 2))) is left unreduced in Rust, but reduced to (C 3) in Mettalog.