1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! Standalone unification entry point over the kernel `Expr` graph.
//!
//! [`unify_exprs`] unifies two terms once and reports the result as a kernel
//! `ShapeMatch`, the same accept/reject surface used by the `Shape` protocol;
//! see the [`README`](https://docs.rs/sim-runtime).
use ;
use crate::;
/// Unifies two expressions and reports the result as a kernel `ShapeMatch`.
///
/// On success the returned match is accepting and its captures hold the
/// variable bindings; on a structural mismatch it is a rejecting match. The
/// occurs-check policy comes from `config`.
///
/// # Examples
///
/// ```
/// use std::sync::Arc;
/// use sim_kernel::{Cx, DefaultFactory, EagerPolicy, Expr, Symbol};
/// use sim_lib_logic::{LogicConfig, unify_exprs};
///
/// let mut cx = Cx::new(Arc::new(EagerPolicy), Arc::new(DefaultFactory));
/// let left = Expr::List(vec![
/// Expr::Symbol(Symbol::new("point")),
/// Expr::Local(Symbol::new("x")),
/// ]);
/// let right = Expr::List(vec![
/// Expr::Symbol(Symbol::new("point")),
/// Expr::Symbol(Symbol::new("origin")),
/// ]);
/// let matched = unify_exprs(&mut cx, &LogicConfig::default(), &left, &right).unwrap();
/// assert!(matched.accepted);
/// ```
pub