pub fn substitute_frame_refs(original: CellRef, get_new_frame_ref: &mut dyn FnMut(FrameReference) -> Option<CellRef>) -> CellRef {
    match &*original {
        SafasCell::FrameReference(cell, frame, ref_type)    => if let Some(substitute) = get_new_frame_ref(FrameReference(*cell, *frame, *ref_type)) { substitute } else { original },
        SafasCell::BoundSyntax(syntax)                      => SafasCell::BoundSyntax(syntax.substitute_frame_refs(get_new_frame_ref)).into(),
        SafasCell::List(car, cdr)                           => SafasCell::List(substitute_frame_refs(car.clone(), get_new_frame_ref), substitute_frame_refs(cdr.clone(), get_new_frame_ref)).into(),
        _                                                   => original,
    }
}
///
/// Substitutes frame references in a CellRef binding
///
Substitutes frame references in a CellRef binding
Substitutes frame references in a CellRef binding
pub fn substitute_frame_refs(original: CellRef, get_new_frame_ref: &mut dyn FnMut(FrameReference) -> Option<CellRef>) -> CellRef {
    match &*original {
        SafasCell::FrameReference(cell, frame, ref_type)    => if let Some(substitute) = get_new_frame_ref(FrameReference(*cell, *frame, *ref_type)) { substitute } else { original },
        SafasCell::BoundSyntax(syntax)                      => SafasCell::BoundSyntax(syntax.substitute_frame_refs(get_new_frame_ref)).into(),
        SafasCell::List(car, cdr)                           => SafasCell::List(substitute_frame_refs(car.clone(), get_new_frame_ref), substitute_frame_refs(cdr.clone(), get_new_frame_ref)).into(),
        _                                                   => original,
    }
}
pub fn substitute_frame_refs ( original : CellRef , get_new_frame_ref : & mut dyn FnMut ( FrameReference ) -> Option < CellRef > ) -> CellRef { match & * original { SafasCell :: FrameReference ( cell , frame , ref_type ) => if let Some ( substitute ) = get_new_frame_ref ( FrameReference ( * cell , * frame , * ref_type ) ) { substitute } else { original } , SafasCell :: BoundSyntax ( syntax ) => SafasCell :: BoundSyntax ( syntax . substitute_frame_refs ( get_new_frame_ref ) ) . into ( ) , SafasCell :: List ( car , cdr ) => SafasCell :: List ( substitute_frame_refs ( car . clone ( ) , get_new_frame_ref ) , substitute_frame_refs ( cdr . clone ( ) , get_new_frame_ref ) ) . into ( ) , _ => original , } }
Substitutes frame references in a CellRef binding
Substitutes frame references in a CellRef binding
original
CellRef
get_new_frame_ref
&mut dyn FnMut(FrameReference) -> Option<CellRef>
original
CellRef
get_new_frame_ref
&mut dyn FnMut(FrameReference) -> Option<CellRef>