Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some places where word minimal is used after renaming #808

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading