Skip to content

Commit

Permalink
Merge pull request #269 from vsbogd/fix-arg-type-match-188-v2
Browse files Browse the repository at this point in the history
Fix type matching for the function call arguments in case of parameterized function type
  • Loading branch information
vsbogd authored Apr 11, 2023
2 parents 8a58ba4 + ab03b7b commit fc1ec1f
Show file tree
Hide file tree
Showing 4 changed files with 257 additions and 148 deletions.
1 change: 1 addition & 0 deletions lib/src/atom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ pub trait GroundedAtom : mopa::Any + Debug + Display {
fn as_any_ref(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;

// TODO: type_() should return Vec<Atom> because of type non-determinism
fn type_(&self) -> Atom;
fn execute(&self, args: &mut Vec<Atom>) -> Result<Vec<Atom>, ExecError>;
fn match_(&self, other: &Atom) -> matcher::MatchResultIter;
Expand Down
2 changes: 2 additions & 0 deletions lib/src/metta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub const INCORRECT_NUMBER_OF_ARGUMENTS_SYMBOL : Atom = sym!("IncorrectNumberOfA
pub const NOT_REDUCIBLE_SYMBOL : Atom = sym!("NotReducible");
pub const NO_VALID_ALTERNATIVES : Atom = sym!("NoValidAlternatives");

// TODO: use stdlib to parse input text
pub fn metta_space(text: &str) -> GroundingSpace {
let tokenizer = common_tokenizer();
let mut parser = SExprParser::new(text);
Expand All @@ -55,6 +56,7 @@ fn common_tokenizer() -> Tokenizer {
tokenizer
}

// TODO: use stdlib to parse input text
pub fn metta_atom(atom: &str) -> Atom {
let tokenizer = common_tokenizer();
let mut parser = SExprParser::new(atom);
Expand Down
Loading

0 comments on commit fc1ec1f

Please sign in to comment.