// FIXME: These two expressions are identical, but I need higher-kinded
// lifetimes to express it :(
These two expressions are identical, but I need higher-kinded
lifetimes to express it :(
These two expressions are identical but I need higher - kinded lifetimes to express it : (
fn eval_one_dimensional_comprehension_dict(
    mut clauses: Vec<ClauseCompiled>,
    add: Box<
        dyn for<'v> Fn(
                &mut SmallMap<Value<'v>, Value<'v>>,
                &mut Evaluator<'v, '_>,
            ) -> Result<(), EvalException<'v>>
            + Send
            + Sync,
    >,
) -> Box<
    dyn for<'v> Fn(
            &mut SmallMap<Value<'v>, Value<'v>>,
            &mut Evaluator<'v, '_>,
        ) -> Result<(), EvalException<'v>>
        + Send
        + Sync,
> {
    if let Some(c) = clauses.pop() {
        let rest = eval_one_dimensional_comprehension_dict(clauses, add);
        box move |accumulator, eval| {
            // println!("eval1 {:?} {:?}", ***e, clauses);
            let iterable = (c.over)(eval)?;
            'f: for i in throw(iterable.iterate(eval.heap()), c.over_span, eval)? {
                (c.var)(i, eval)?;
                for ifc in &c.ifs {
                    if !ifc(eval)?.to_bool() {
                        continue 'f;
                    }
                }
                rest(accumulator, eval)?;
            }
            Ok(())
        }
    } else {
        add
    }
}
fn eval_one_dimensional_comprehension_dict ( mut clauses : Vec < ClauseCompiled > , add : Box < dyn for < ' v > Fn ( & mut SmallMap < Value < ' v > , Value < ' v > > , & mut Evaluator < ' v , ' _ > , ) -> Result < ( ) , EvalException < ' v > > + Send + Sync , > , ) -> Box < dyn for < ' v > Fn ( & mut SmallMap < Value < ' v > , Value < ' v > > , & mut Evaluator < ' v , ' _ > , ) -> Result < ( ) , EvalException < ' v > > + Send + Sync , > { if let Some ( c ) = clauses . pop ( ) { let rest = eval_one_dimensional_comprehension_dict ( clauses , add ) ; box move | accumulator , eval | { // println!("eval1 {:?} {:?}", ***e, clauses); let iterable = ( c . over ) ( eval ) ? ; ' f : for i in throw ( iterable . iterate ( eval . heap ( ) ) , c . over_span , eval ) ? { ( c . var ) ( i , eval ) ? ; for ifc in & c . ifs { if ! ifc ( eval ) ? . to_bool ( ) { continue ' f ; } } rest ( accumulator , eval ) ? ; } Ok ( ( ) ) } } else { add } }
FIXME: These two expressions are identical, but I need higher-kinded
lifetimes to express it :(
FIXME : These two expressions are identical but I need higher - kinded lifetimes to express it : (
clauses
Vec<ClauseCompiled>
add
Box<
        dyn for<'v> Fn(
                &mut SmallMap<Value<'v>, Value<'v>>,
                &mut Evaluator<'v, '_>,
            ) -> Result<(), EvalException<'v>>
            + Send
            + Sync,
    >