Skip to main content

ValueAlgebra

Trait ValueAlgebra 

Source
pub trait ValueAlgebra: TowerValue {
    // Required methods
    fn add(a: Self, b: Self) -> Result<Self, String>;
    fn subtract(a: Self, b: Self) -> Result<Self, String>;
    fn multiply(a: Self, b: Self) -> Result<Self, String>;
    fn exact_divide(a: Self, b: Self) -> Result<Self, String>;
    fn modulo(a: Self, b: Self) -> Result<Self, String>;
    fn holds(rel: Rel, a: &Self, b: &Self) -> Result<bool, String>;
    fn power(a: Self, b: Self) -> Result<Self, String>;
    fn floor(v: Self) -> Result<Self, String>;
    fn ceil(v: Self) -> Result<Self, String>;
    fn list(values: Vec<Self>) -> Self;
    fn shape(&self) -> Shape<Self>;
}
Expand description

A value model’s whole arithmetic and its lists: what the supertask runtime computes with. Each operation is the language’s own on that model, exact types and standard numbers alike.

Required Methods§

Source

fn add(a: Self, b: Self) -> Result<Self, String>

Source

fn subtract(a: Self, b: Self) -> Result<Self, String>

Source

fn multiply(a: Self, b: Self) -> Result<Self, String>

Source

fn exact_divide(a: Self, b: Self) -> Result<Self, String>

/ in an exact context: field division, integers included.

Source

fn modulo(a: Self, b: Self) -> Result<Self, String>

The language’s %.

Source

fn holds(rel: Rel, a: &Self, b: &Self) -> Result<bool, String>

Whether a rel b holds, decided: an answer that depends on the residue, or a provisional one, is the refusal of the branch.

Source

fn power(a: Self, b: Self) -> Result<Self, String>

The language’s **.

Source

fn floor(v: Self) -> Result<Self, String>

The language’s floor.

Source

fn ceil(v: Self) -> Result<Self, String>

The language’s ceiling.

Source

fn list(values: Vec<Self>) -> Self

Source

fn shape(&self) -> Shape<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§