Exemple #1
0
        public static Query Append <T>(this VarList <T> initial, VarList <T> other, VarList <T> result)
        {
            return((initial <= VarList <T> .Empty & other <= result)
                   | (() =>
            {
                var head = new Var <T>();
                var initialTail = new VarList <T>();
                var resultTail = new VarList <T>();

                return initial <= (head, initialTail)
                & result <= (head, resultTail)
                & initialTail.Append(other, resultTail);
            }));
        }
Exemple #2
0
        public static Query Chain <T>(this Func <VarList <T>, Var <T>, Query> subQuery, int repetitions, VarList <T> input, VarList <T> output = null)
        {
            output ??= new VarList <T>();

            var         queryAccumulator = Query.Success;
            VarList <T> intermediary     = null;

            for (int index = 0; index < repetitions; index++)
            {
                intermediary = new VarList <T>();
                var element = new Var <T>();

                queryAccumulator &= subQuery(input, element) & intermediary <= input.Append(element);
            }

            return(intermediary <= output & queryAccumulator);
        }
Exemple #3
0
 public static Func <VarList <T>, Query> Append <T>(this VarList <T> initial, VarList <T> tail) => result => initial.Append(tail, result);
Exemple #4
0
 public static Query Append <T>(this VarList <T> initial, Var <T> item, VarList <T> result)
 {
     return(initial.Append(VarList.Create(item), result));
 }
Exemple #5
0
 public static Func <VarList <T>, Query> Append <T>(this VarList <T> initial, Var <T> item) => result => initial.Append(item, result);