Exemplo n.º 1
0
        public static Zen <TResult> Create(
            Zen <IList <T> > listExpr,
            Zen <TResult> empty,
            Func <Zen <T>, Zen <IList <T> >, Zen <TResult> > cons)
        {
            CommonUtilities.Validate(listExpr);
            CommonUtilities.Validate(empty);
            CommonUtilities.Validate(cons);

            return(Simplify(listExpr, empty, cons));
        }
Exemplo n.º 2
0
        public static Zen <bool> Create(Zen <bool> expr)
        {
            CommonUtilities.Validate(expr);

            if (hashConsTable.TryGetValue(expr, out var value))
            {
                return(value);
            }

            var ret = Simplify(expr);

            hashConsTable[expr] = ret;
            return(ret);
        }
Exemplo n.º 3
0
        public static Zen <T> Create(Zen <T> expr)
        {
            CommonUtilities.Validate(expr);
            CommonUtilities.ValidateIsIntegerType(typeof(T));

            if (hashConsTable.TryGetValue(expr, out var value))
            {
                return(value);
            }

            var ret = Simplify(expr);

            hashConsTable[expr] = ret;
            return(ret);
        }
Exemplo n.º 4
0
        public static Zen <TTo> CreateMulti(Zen <TFrom> expr, ImmutableList <Func <object, object> > converters)
        {
            CommonUtilities.Validate(expr);
            var key = (expr, converters);

            if (hashConsTable.TryGetValue(key, out var value))
            {
                return(value);
            }

            var ret = Simplify(expr, converters);

            hashConsTable[key] = ret;
            return(ret);
        }