[−][src]Struct l_group_formulas::free_group_term::FreeGroupTerm
An element of the group algebra.
Examples
To use this, import
use l_group_formulas::free_group_term::*; use l_group_formulas::literal::*; use l_group_formulas::*;
Constructing a free group term goes like this.
let term = Literal::from('x') * Literal::from('y');
In this case, term
encodes the element xy of a free group.
Terms constructed using FreeGrouPTerm::new
automatically get reduced:
let term = Literal::from('x') * Literal::from('x').inverse(); assert_eq!(String::from("e"), term.to_string());
Can also be constructed from strings:
FreeGroupTerm::from(&str)
parses a free group term from a string.
This ignores all non-alphanumeric characters, such as *
. Perhaps dangerously,
this also ignores symbols like ^
, and treats v
as the name of a symbol.
The input is parsed by
Examples
Basic usage:
use l_group_formulas::literal::Literal; use l_group_formulas::free_group_term::FreeGroupTerm; // this is equivalent to: // let string = "X31yz39"; let string = "X3 1*yz39 "; let x = Literal::new('x', 31, true); let y = Literal::new('y', 0, false); let z = Literal::new('z', 39, false); let term = FreeGroupTerm::new(vec![x, y, z]); assert_eq!(term, FreeGroupTerm::from(string));
Fields
literals: Vec<Literal>
Implementations
impl FreeGroupTerm
[src]
pub fn new(literals: Vec<Literal>) -> FreeGroupTerm
[src]
Trait Implementations
impl Clone for FreeGroupTerm
[src]
fn clone(&self) -> FreeGroupTerm
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for FreeGroupTerm
[src]
impl Eq for FreeGroupTerm
[src]
impl<'_> From<&'_ str> for FreeGroupTerm
[src]
fn from(s: &str) -> FreeGroupTerm
[src]
impl From<FreeGroupTerm> for LGroupTerm
[src]
fn from(x: FreeGroupTerm) -> LGroupTerm
[src]
impl From<FreeGroupTerm> for ShortFreeGroupTerm
[src]
fn from(term: FreeGroupTerm) -> ShortFreeGroupTerm
[src]
ignores everything after the third symbol
impl From<Literal> for FreeGroupTerm
[src]
fn from(x: Literal) -> FreeGroupTerm
[src]
impl From<ShortFreeGroupTerm> for FreeGroupTerm
[src]
fn from(t: ShortFreeGroupTerm) -> FreeGroupTerm
[src]
impl From<char> for FreeGroupTerm
[src]
fn from(c: char) -> FreeGroupTerm
[src]
impl Mul<FreeGroupTerm> for FreeGroupTerm
[src]
type Output = FreeGroupTerm
The resulting type after applying the *
operator.
fn mul(self, other: FreeGroupTerm) -> FreeGroupTerm
[src]
impl Mul<Literal> for FreeGroupTerm
[src]
type Output = FreeGroupTerm
The resulting type after applying the *
operator.
fn mul(self, other: Literal) -> FreeGroupTerm
[src]
impl MulAssign<FreeGroupTerm> for FreeGroupTerm
[src]
fn mul_assign(&mut self, rhs: FreeGroupTerm)
[src]
impl Ord for FreeGroupTerm
[src]
fn cmp(&self, other: &FreeGroupTerm) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<FreeGroupTerm> for FreeGroupTerm
[src]
fn eq(&self, other: &FreeGroupTerm) -> bool
[src]
fn ne(&self, other: &FreeGroupTerm) -> bool
[src]
impl PartialOrd<FreeGroupTerm> for FreeGroupTerm
[src]
fn partial_cmp(&self, other: &FreeGroupTerm) -> Option<Ordering>
[src]
fn lt(&self, other: &FreeGroupTerm) -> bool
[src]
fn le(&self, other: &FreeGroupTerm) -> bool
[src]
fn gt(&self, other: &FreeGroupTerm) -> bool
[src]
fn ge(&self, other: &FreeGroupTerm) -> bool
[src]
impl Reducable for FreeGroupTerm
[src]
fn reduced(self) -> FreeGroupTerm
[src]
impl StructuralEq for FreeGroupTerm
[src]
impl StructuralPartialEq for FreeGroupTerm
[src]
impl Term for FreeGroupTerm
[src]
fn inverse(&self) -> FreeGroupTerm
[src]
impl ToString for FreeGroupTerm
[src]
Auto Trait Implementations
impl RefUnwindSafe for FreeGroupTerm
impl Send for FreeGroupTerm
impl Sync for FreeGroupTerm
impl Unpin for FreeGroupTerm
impl UnwindSafe for FreeGroupTerm
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,