fn analyze_symbols_in_fn(
        &mut self,
        body: PersistentList<Value>,
        params: &PersistentVector<Value>,
        frames: &mut Vec<Frame>,
        // record any values captured from the environment that would outlive the lifetime of this particular lambda
        captures: &mut Vec<CaptureSet>,
    ) -> EvaluationResult<Value> {
        let level = frames.len();
        let (parameters, variadic) = self.extract_scope_from_fn_bindings(params, level)?;
        let arity = if variadic {
            parameters.len() - 1
        } else {
            parameters.len()
        };
        let mut frame = Frame::default();
        frame.scopes.push(parameters);

        frames.push(frame);
        // walk the `body`, resolving symbols where possible...
        let mut analyzed_body = Vec::with_capacity(body.len());
        for form in body.iter() {
            let analyzed_form = self.analyze_form_in_fn(form, frames, captures)?;
            analyzed_body.push(analyzed_form);
        }
        frames.pop();
        Ok(Value::Fn(FnImpl {
            body: analyzed_body.into_iter().collect(),
            arity,
            level,
            variadic,
        }))
    }
// Non-local symbols should:
// 1. resolve to a parameter
// 2. resolve to a value in the enclosing environment, which is captured
// otherwise, the lambda is an error
//
// Note: parameters are resolved to (ordinal) reserved symbols
Non-local symbols should:
1. resolve to a parameter
2. resolve to a value in the enclosing environment, which is captured
otherwise, the lambda is an error

parameters are resolved to (ordinal) reserved symbols
Non - local symbols should : 1 . resolve to a parameter 2 . resolve to a value in the enclosing environment which is captured otherwise the lambda is an error parameters are resolved to ( ordinal ) reserved symbols
fn analyze_symbols_in_fn(
        &mut self,
        body: PersistentList<Value>,
        params: &PersistentVector<Value>,
        frames: &mut Vec<Frame>,
        // record any values captured from the environment that would outlive the lifetime of this particular lambda
        captures: &mut Vec<CaptureSet>,
    ) -> EvaluationResult<Value> {
        let level = frames.len();
        let (parameters, variadic) = self.extract_scope_from_fn_bindings(params, level)?;
        let arity = if variadic {
            parameters.len() - 1
        } else {
            parameters.len()
        };
        let mut frame = Frame::default();
        frame.scopes.push(parameters);
        frames.push(frame);
        // walk the `body`, resolving symbols where possible...
        let mut analyzed_body = Vec::with_capacity(body.len());
        for form in body.iter() {
            let analyzed_form = self.analyze_form_in_fn(form, frames, captures)?;
            analyzed_body.push(analyzed_form);
        }
        frames.pop();
        Ok(Value::Fn(FnImpl {
            body: analyzed_body.into_iter().collect(),
            arity,
            level,
            variadic,
        }))
    }
fn analyze_symbols_in_fn ( & mut self , body : PersistentList < Value > , params : & PersistentVector < Value > , frames : & mut Vec < Frame > , // record any values captured from the environment that would outlive the lifetime of this particular lambda captures : & mut Vec < CaptureSet > , ) -> EvaluationResult < Value > { let level = frames . len ( ) ; let ( parameters , variadic ) = self . extract_scope_from_fn_bindings ( params , level ) ? ; let arity = if variadic { parameters . len ( ) - 1 } else { parameters . len ( ) } ; let mut frame = Frame :: default ( ) ; frame . scopes . push ( parameters ) ; frames . push ( frame ) ; // walk the `body`, resolving symbols where possible... let mut analyzed_body = Vec :: with_capacity ( body . len ( ) ) ; for form in body . iter ( ) { let analyzed_form = self . analyze_form_in_fn ( form , frames , captures ) ? ; analyzed_body . push ( analyzed_form ) ; } frames . pop ( ) ; Ok ( Value :: Fn ( FnImpl { body : analyzed_body . into_iter ( ) . collect ( ) , arity , level , variadic , } ) ) }
Non-local symbols should:
1. resolve to a parameter
2. resolve to a value in the enclosing environment, which is captured
otherwise, the lambda is an error
Non - local symbols should : 1 . resolve to a parameter 2 . resolve to a value in the enclosing environment which is captured otherwise the lambda is an error
&mut self
body
PersistentList<Value>
params
&PersistentVector<Value>
frames
&mut Vec<Frame>
captures
&mut Vec<CaptureSet>