@@ -42,8 +42,22 @@ impl std::fmt::Display for Identifier {
4242 }
4343}
4444
45- /// The evaluation scope for an expression, all variables are evaluated relatively to the data it contains.
46- /// It allows for expressions to access fields and previously defined data by [`Identifier`].
45+ /// Scope define the evaluation context/scope that an expression uses when being evaluated.
46+ /// There is a special `Identifier` (`Identity`) which is used to bind the initial array being evaluated
47+ ///
48+ /// Other identifier can be bound with variables either before execution or while executing (see `Let`).
49+ /// Values can be extracted from the scope using the `Var` expression.
50+ ///
51+ /// ```code
52+ /// <let x = lit(1) in var(Identifier::Identity) + var(x), { Identity -> Primitive[1,2,3]> ->
53+ /// <var(Identifier::Identity) + var(x), { Identity -> Primitive[1,2,3], x -> ConstantArray(1)> ->
54+ /// <Primitive[1,2,3] + var(x), { Identity -> Primitive[1,2,3], x -> ConstantArray(1)> ->
55+ /// <Primitive[1,2,3] + ConstantArray(1), { Identity -> Primitive[1,2,3], x -> ConstantArray(1)> ->
56+ /// <Primitive[2,3,4], { Identity -> Primitive[1,2,3], x -> ConstantArray(1)>
57+ /// ```
58+ ///
59+ /// Other values can be bound before execution e.g.
60+ /// `<var("x") + var("y") + var("z"), x -> ..., y -> ..., z -> ...>`
4761#[ derive( Clone , Default ) ]
4862pub struct Scope {
4963 array_len : usize ,
0 commit comments