Skip to content

Commit 27dc35f

Browse files
committed
Evaluate expression with non-exec grounded atom on the first position
1 parent 2ee05be commit 27dc35f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/src/metta/interpreter.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ fn eval_impl<'a, T: Space>(to_eval: Atom, space: T, bindings: Bindings, prev: Op
464464
match atom_as_slice(&to_eval) {
465465
Some([Atom::Grounded(op), args @ ..]) => {
466466
match op.as_grounded().as_execute() {
467-
None => finished_result(return_not_reducible(), bindings, prev),
467+
None => query(space, prev, to_eval, bindings, vars),
468468
Some(executable) => {
469469
let exec_res = executable.execute(args);
470470
log::debug!("eval: execution results: {:?}", exec_res);
@@ -1559,6 +1559,14 @@ mod tests {
15591559
assert_eq!(result, vec![NOT_REDUCIBLE_SYMBOL]);
15601560
}
15611561

1562+
#[test]
1563+
fn interpret_atom_evaluate_non_executable_grounded_atom_on_a_first_position() {
1564+
let space = space("(= ($x > $y) (> $x $y))");
1565+
1566+
let result = call_interpret(space, &expr!("eval" ({1} ">" {2})));
1567+
assert_eq!(result, vec![expr!(">" {1} {2})]);
1568+
}
1569+
15621570

15631571
#[test]
15641572
fn interpret_atom_chain_incorrect_args() {

0 commit comments

Comments
 (0)