Function proto_vulcan::relation::member[][src]

pub fn member<U, E, G>(x: LTerm<U, E>, l: LTerm<U, E>) -> InferredGoal<U, E, G> where
    U: User,
    E: Engine<U>,
    G: AnyGoal<U, E>, 
Expand description

A relation that succeeds for each occurrence of x in list l.

Example

extern crate proto_vulcan;
use proto_vulcan::prelude::*;
use proto_vulcan::relation::member;
fn main() {
    let query = proto_vulcan_query!(|q| {
        member(q, [1, 2, 3])
    });
    let mut iter = query.run();
    assert!(iter.next().unwrap().q == 1);
    assert!(iter.next().unwrap().q == 2);
    assert!(iter.next().unwrap().q == 3);
    assert!(iter.next().is_none());
}