[][src]Macro mini_kanren::run

macro_rules! run {
    (*, ($($x:ident),*), $($body:tt)*) => { ... };
    (*, $q:ident, $($g:expr),* $(,)?) => { ... };
    ($n:expr, ($($x:ident),*), $($body:tt)*) => { ... };
    ($n:tt, $q:ident, $($g:expr),* $(,)?) => { ... };
    (($($x:ident),*), $($body:tt)*) => { ... };
    ($q:ident, $($g:expr),* $(,)?) => { ... };
    (@ $n:tt, ($($x:ident),*), $($g:expr),* $(,)?) => { ... };
    (@ *, $q:ident, $($g:expr),* $(,)?) => { ... };
    (@ iter, $q:ident, $($g:expr),* $(,)?) => { ... };
    (@ $n:expr, $q:ident, $($g:expr),* $(,)?) => { ... };
}

Run one or more goals.

The syntax run!(n, var(s), goal1, goal2, ...) produces at most n solutions in Scheme you wold write (run n var(s) goal1 goal2 ...). The syntax run!(*, var(s), goal1, goal2, ...) produces all solutions in Scheme you wold write (run* var(s) goal1 goal2 ...). The latter may result in an infinite recursion which eventually crashes with a stack overflow.

We support an additional syntax run!(var(s), goal1, goal2, ...) that returns a (possibly infinite) iterator over all solutions.