Skip to content

Commit

Permalink
Merge pull request trueagi-io#759 from vsbogd/workshop
Browse files Browse the repository at this point in the history
Various fixes
  • Loading branch information
vsbogd authored Aug 16, 2024
2 parents 5db26f3 + ad022fa commit 72a5512
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ FROM python:3.10-slim-bookworm AS os

FROM os AS build

RUN apt update && \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
TZ=UTC \
apt install -y sudo git curl cmake build-essential \
apt-get install -y sudo git curl cmake build-essential \
pkg-config libssl-dev zlib1g-dev && \
rm -rf /var/lib/apt/lists/*

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,14 @@ For example, to log all hyperon messages at the `debug` level and
below, while running `script.metta`, you may type:

```
RUST_LOG=hyperon=debug metta script.metta
RUST_LOG=hyperon=debug metta-py script.metta
```

Or, to log all hyperon messages at the `trace` level and below,
restricted to module `metta` and submodule `types`, you may type:

```
RUST_LOG=hyperon::metta::types=trace metta script.metta
RUST_LOG=hyperon::metta::types=trace metta-py script.metta
```

By default all log messages are directed to stderr.
Expand Down
20 changes: 14 additions & 6 deletions lib/src/metta/interpreter_minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,13 @@ fn query<'a, T: Space>(space: T, prev: Option<Rc<RefCell<Stack>>>, to_eval: Atom
log::debug!("interpreter_minimal::query: b: {}", b);
b.merge_v2(&bindings).into_iter()
}).filter_map(move |b| {
let res = b.resolve(&var_x).unwrap();
if b.has_loops() {
None
} else {
Some(result(res, b))
}
b.resolve(&var_x).map_or(None, |res| {
if b.has_loops() {
None
} else {
Some(result(res, b))
}
})
})
.collect()
}
Expand Down Expand Up @@ -1410,6 +1411,13 @@ mod tests {
assert_eq!(result, vec![metta_atom("NotReducible")]);
}

#[test]
fn interpret_atom_evaluate_pure_expression_variable_in_space() {
let space = space("$t (= (foo $a B) $a)");
let result = call_interpret(&space, &metta_atom("(eval (foo A $b))"));
assert_eq!(result, vec![metta_atom("A")]);
}

#[test]
fn interpret_atom_evaluate_pure_expression_variable_name_conflict() {
let space = space("(= (foo ($W)) True)");
Expand Down

0 comments on commit 72a5512

Please sign in to comment.