Function canrun::goals::cmp::lte

source ·
pub fn lte<A, AV, B, BV>(a: AV, b: BV) -> impl Goalwhere
    A: Unify + PartialOrd<B>,
    B: Unify,
    AV: Into<Value<A>>,
    BV: Into<Value<B>>,
Expand description

Ensure that one value is less than or equal to another.

Example:

use canrun::{unify, LVar, all, Query};
use canrun::cmp::lte;

let (x, y, z) = (LVar::new(), LVar::new(), LVar::new());
let goal = all![
    unify(x, 1),
    unify(y, 2),
    unify(z, 2),
    lte(x, y),
    lte(y, z),
];
let results: Vec<_> = goal.query((x, y, z)).collect();
assert_eq!(results, vec![(1, 2, 2)]);