pub fn get<T, IntoT, Index, Collection>(
item: IntoT,
index: Index,
collection: Collection,
) -> Get<T>
Expand description
Create a Goal
that attempts to unify a Value<T>
with
the item at a specific index in a LVec<T>
.
ยงExamples:
use canrun::{LVar, all, unify, lvec, Query};
let needle = LVar::new();
let index = LVar::new();
let haystack = LVar::new();
let goal = all![
unify(index, 0),
unify(&haystack, lvec![1, 2, 3]),
lvec::get(needle, index, haystack),
];
let results: Vec<_> = goal.query(needle).collect();
assert_eq!(results, vec![1]);