macro_rules! sym {
($ctx:expr; $name:ident $(, $prop:ident)*) => { ... };
}Expand description
Declare a symbol with mathematical assumptions.
The first argument is the context, the second is the symbol name, and any additional identifiers are assumption variants applied to the symbol.
The declaration goes through Context::symbol_with and propagates
its error with ? (contradictory assumptions such as
sym!(ctx; t, Positive, Negative)), so use the macro in a function
returning Result<_, E> with E: From<SymplexError>.
ยงExamples
use symplex::prelude::*;
use symplex::sym;
let ctx = Context::new();
sym!(ctx; t, Positive, Real);
assert_eq!(ctx.query(&t, Props::POSITIVE), Some(true));
assert_eq!(ctx.query(&t, Props::REAL), Some(true));
// Inferred:
assert_eq!(ctx.query(&t, Props::COMPLEX), Some(true));