Skip to content

Commit

Permalink
Merge pull request #808 from vsbogd/fix-minimal-wording
Browse files Browse the repository at this point in the history
Fix some places where word minimal is used after renaming
  • Loading branch information
vsbogd authored Nov 22, 2024
2 parents ff5d067 + de74f5b commit ccd0308
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 0 additions & 2 deletions docs/minimal-metta.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ Evaluate atom in a loop until result is calculated:
(eval (reduce $res $var $templ)) )))))
```

[Link](../lib/src/metta/runner/stdlib_minimal.rs) to the full code of the interpreter in MeTTa.

# Properties

## Turing completeness
Expand Down
4 changes: 2 additions & 2 deletions lib/benches/interpreter_minimal.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(test)]
mod interpreter_minimal_bench {
mod interpreter_bench {

extern crate test;

Expand All @@ -8,7 +8,7 @@ use test::Bencher;
use hyperon::*;
use hyperon::space::grounding::*;
use hyperon::metta::*;
use hyperon::metta::interpreter_minimal::*;
use hyperon::metta::interpreter::*;

fn chain_atom(size: isize) -> Atom {
let mut atom = Atom::expr([CHAIN_SYMBOL, Atom::sym("A"), Atom::var("x"), Atom::var("x")]);
Expand Down
10 changes: 5 additions & 5 deletions lib/src/metta/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl<T: Space> std::fmt::Display for InterpreterState<T> {
}

/// Initialize interpreter and returns the starting interpreter state.
/// See [crate::metta::interpreter_minimal] for algorithm explanation.
/// See [crate::metta::interpreter] for algorithm explanation.
///
/// # Arguments
/// * `space` - atomspace to query for interpretation
Expand All @@ -246,7 +246,7 @@ pub fn interpret_init<T: Space>(space: T, expr: &Atom) -> InterpreterState<T> {
}

/// Perform next step of the interpretation return the resulting interpreter
/// state. See [crate::metta::interpreter_minimal] for algorithm explanation.
/// state. See [crate::metta::interpreter] for algorithm explanation.
///
/// # Arguments
/// * `state` - interpreter state from the previous step.
Expand Down Expand Up @@ -558,13 +558,13 @@ fn query<'a, T: Space>(space: T, prev: Option<Rc<RefCell<Stack>>>, to_eval: Atom
let var_x = &VariableAtom::new("X").make_unique();
let query = Atom::expr([EQUAL_SYMBOL, to_eval.clone(), Atom::Variable(var_x.clone())]);
let results = space.query(&query);
log::debug!("interpreter_minimal::query: query: {}", query);
log::debug!("interpreter_minimal::query: results.len(): {}, bindings.len(): {}, results: {} bindings: {}",
log::debug!("interpreter::query: query: {}", query);
log::debug!("interpreter::query: results.len(): {}, bindings.len(): {}, results: {} bindings: {}",
results.len(), bindings.len(), results, bindings);
let call_stack = call_to_stack(to_eval, vars, prev.clone());
let result = |res, bindings| eval_result(prev.clone(), res, &call_stack, bindings);
let results: Vec<InterpretedAtom> = results.into_iter().flat_map(|b| {
log::debug!("interpreter_minimal::query: b: {}", b);
log::debug!("interpreter::query: b: {}", b);
b.merge_v2(&bindings).into_iter()
}).filter_map(move |b| {
b.resolve(&var_x).map_or(None, |res| {
Expand Down

0 comments on commit ccd0308

Please sign in to comment.