Function canrun::collections::lmap::superset

source ·
pub fn superset<K, V, A, B>(a: A, b: B) -> impl Goalwhere
    K: Unify + Eq + Hash + Debug,
    V: Unify + Debug,
    A: Into<Value<LMap<K, V>>>,
    B: Into<Value<LMap<K, V>>>,
Expand description

Assert that LMap a is a superset of LMap b.

This means that all of the keys in b unify with keys in a AND the corresponding values also unify. This is the opposite of subset.

Example:

use canrun::{LVar, Query};
use canrun::lmap::{lmap, superset};

let x = LVar::new();
let goal = superset(lmap! {x => 2, 3 => 4}, lmap! {1 => 2});
let results: Vec<_> = goal.query(x).collect();
assert_eq!(results, vec![1]);