pub struct Magma<'a, T> { /* private fields */ }Expand description
A set with an associated binary operation.
This is a representation of the simplest algebraic structure: the magma.
There are no specific properties required of its components, so its
construction involves nothing more than a set (specifically an
AlgaeSet and a binary operation (anything implementing
BinaryOperation).
Examples
use algae_rs::algaeset::AlgaeSet;
use algae_rs::mapping::{BinaryOperation, AbelianOperation};
use algae_rs::magma::{Magmoid, Magma};
let mut add = AbelianOperation::new(&|a, b| a + b);
let mut magma = Magma::new(
AlgaeSet::<i32>::all(),
&mut add
);
let magma_sum = magma.with(1, 2);
assert!(magma_sum.is_ok());
assert!(magma_sum.unwrap() == 3);Implementations§
Trait Implementations§
source§impl<'a, T> From<Quasigroup<'a, T>> for Magma<'a, T>
impl<'a, T> From<Quasigroup<'a, T>> for Magma<'a, T>
source§fn from(quasi: Quasigroup<'a, T>) -> Magma<'a, T>
fn from(quasi: Quasigroup<'a, T>) -> Magma<'a, T>
Converts to this type from the input type.
source§impl<'a, T> From<UnitalMagma<'a, T>> for Magma<'a, T>
impl<'a, T> From<UnitalMagma<'a, T>> for Magma<'a, T>
source§fn from(magma: UnitalMagma<'a, T>) -> Magma<'a, T>
fn from(magma: UnitalMagma<'a, T>) -> Magma<'a, T>
Converts to this type from the input type.