check_type

Function check_type 

Source
pub fn check_type(space: &DynSpace, atom: &Atom, typ: &Atom) -> bool
Expand description

Checks if passed atom has the given typ in context of the given space. This function can be used for a simple type check when there is no need to know type parameters.

ยงExamples

use hyperon_atom::expr;
use hyperon::metta::runner::*;
use hyperon::metta::text::SExprParser;
use hyperon::metta::types::check_type;

let metta = Metta::new(None);
metta.run(SExprParser::new("(: a A) (: a B)")).unwrap();

assert!(check_type(&metta.space(), &expr!("a"), &expr!("B")));