Search in sources :

Example 11 with Var

use of catdata.aql.Var in project fql by CategoricalData.

the class TyExpRaw method eval.

@Override
public synchronized TypeSide<Ty, Sym> eval(AqlEnv env) {
    AqlOptions ops = new AqlOptions(options, col, env.defaults);
    // changed my mind: do not defer equation checking since invokes javascript
    // col.
    AqlJs<Ty, Sym> js = new AqlJs<>(col.syms, col.java_tys, col.java_parsers, col.java_fns);
    for (Triple<List<Pair<String, String>>, RawTerm, RawTerm> eq : eqs) {
        try {
            Triple<Ctx<Var, Chc<Ty, Void>>, Term<Ty, Void, Sym, Void, Void, Void, Void>, Term<Ty, Void, Sym, Void, Void, Void, Void>> tr = infer1x(yyy(eq.first), eq.second, eq.third, null, col, "", js);
            col.eqs.add(new Eq<>(tr.first, tr.second, tr.third));
        } catch (RuntimeException ex) {
            ex.printStackTrace();
            throw new LocException(find("equations", eq), "In equation " + eq.second + " = " + eq.third + ", " + ex.getMessage());
        }
    }
    for (Pair<Integer, TyExp<Ty, Sym>> k : imports) {
        TypeSide<Ty, Sym> v = k.second.eval(env);
        col.addAll(v.collage());
    }
    Set<Triple<Ctx<Var, Ty>, Term<Ty, Void, Sym, Void, Void, Void, Void>, Term<Ty, Void, Sym, Void, Void, Void, Void>>> eqs0 = col.eqsAsTriples().stream().map(x -> new Triple<>(xxx(x.first), x.second, x.third)).collect(Collectors.toSet());
    TypeSide<Ty, Sym> ret = new TypeSide<Ty, Sym>(col.tys, col.syms.map, eqs0, col.java_tys.map, col.java_parsers.map, col.java_fns.map, ops);
    return ret;
}
Also used : AqlOptions(catdata.aql.AqlOptions) Ctx(catdata.Ctx) TypeSide(catdata.aql.TypeSide) RawTerm(catdata.aql.RawTerm) En(catdata.aql.exp.SchExpRaw.En) Sym(catdata.aql.exp.TyExpRaw.Sym) Chc(catdata.Chc) HashMap(java.util.HashMap) Function(java.util.function.Function) HashSet(java.util.HashSet) Map(java.util.Map) AqlJs(catdata.aql.AqlJs) Collage(catdata.aql.Collage) Eq(catdata.aql.Eq) Term(catdata.aql.Term) LinkedList(java.util.LinkedList) Pair(catdata.Pair) Collection(java.util.Collection) Kind(catdata.aql.Kind) Util(catdata.Util) Set(java.util.Set) Collectors(java.util.stream.Collectors) List(java.util.List) Var(catdata.aql.Var) Entry(java.util.Map.Entry) Triple(catdata.Triple) Ty(catdata.aql.exp.TyExpRaw.Ty) Ctx(catdata.Ctx) Var(catdata.aql.Var) AqlJs(catdata.aql.AqlJs) LinkedList(java.util.LinkedList) List(java.util.List) TypeSide(catdata.aql.TypeSide) Ty(catdata.aql.exp.TyExpRaw.Ty) Sym(catdata.aql.exp.TyExpRaw.Sym) RawTerm(catdata.aql.RawTerm) Term(catdata.aql.Term) RawTerm(catdata.aql.RawTerm) Triple(catdata.Triple) AqlOptions(catdata.aql.AqlOptions)

Aggregations

Var (catdata.aql.Var)11 Ctx (catdata.Ctx)9 Pair (catdata.Pair)9 Chc (catdata.Chc)8 Triple (catdata.Triple)8 En (catdata.aql.exp.SchExpRaw.En)8 Sym (catdata.aql.exp.TyExpRaw.Sym)8 Ty (catdata.aql.exp.TyExpRaw.Ty)8 AqlOptions (catdata.aql.AqlOptions)7 Collage (catdata.aql.Collage)7 RawTerm (catdata.aql.RawTerm)7 Att (catdata.aql.exp.SchExpRaw.Att)7 Fk (catdata.aql.exp.SchExpRaw.Fk)7 LinkedList (java.util.LinkedList)7 Term (catdata.aql.Term)6 HashSet (java.util.HashSet)6 List (java.util.List)6 Collection (java.util.Collection)5 Eq (catdata.aql.Eq)4 Schema (catdata.aql.Schema)4