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

Stdlib separation #812

Merged
merged 8 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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: 1 addition & 1 deletion lib/src/metta/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::atom::matcher::*;
use crate::space::*;
use crate::metta::*;
use crate::metta::types::*;
use crate::metta::runner::stdlib::IfEqualOp;
use crate::metta::runner::stdlib::core_mod::IfEqualOp;
use crate::common::collections::CowArray;

use std::fmt::{Debug, Display, Formatter};
Expand Down
27 changes: 1 addition & 26 deletions lib/src/metta/runner/arithmetics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,34 +308,9 @@ macro_rules! def_binary_bool_op {
def_binary_bool_op!(AndOp, and, &&);
def_binary_bool_op!(OrOp, or, ||);

// NOTE: xor and flip are absent in Python intentionally for conversion testing
// NOTE: xor is absent in Python intentionally for conversion testing
def_binary_bool_op!(XorOp, xor, ^);

#[derive(Clone, PartialEq, Debug)]
pub struct FlipOp{}

impl Display for FlipOp {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "flip")
}
}

impl Grounded for FlipOp {
fn type_(&self) -> Atom {
Atom::expr([ARROW_SYMBOL, ATOM_TYPE_BOOL])
}

fn as_execute(&self) -> Option<&dyn CustomExecute> {
Some(self)
}
}

impl CustomExecute for FlipOp {
fn execute(&self, _args: &[Atom]) -> Result<Vec<Atom>, ExecError> {
Ok(vec![Atom::gnd(Bool(rand::random()))])
}
}


#[derive(Clone, PartialEq, Debug)]
pub struct NotOp{}
Expand Down
Loading
Loading