Esempio n. 1
0
        public void VerifyISeqRestMaintainsMeta(ISeq s)
        {
            IPersistentMap meta = ((IMeta)s).meta();

            for (; s.rest() != null; s = s.rest())
                Expect(((IMeta)s.rest()).meta(), EqualTo(meta));
        }
 /// <summary>
 /// Create a <see cref="PersistentVector">PersistentVector</see> from an <see cref="ISeq">ISeq</see>.
 /// </summary>
 /// <param name="items">A sequence of items.</param>
 /// <returns>An initialized vector.</returns>
 public static PersistentVector create(ISeq items)
 {
     IPersistentVector ret = EMPTY;
     for (; items != null; items = items.next())
         ret = ret.cons(items.first());
     return (PersistentVector)ret;
 }
Esempio n. 3
0
        public static Type GenerateInterface(string iName, ISeq extends, ISeq methods)
        {
            GenContext context = new GenContext(iName, CompilerMode.File);

            //            GenContext context = (GenContext)Compiler.COMPILER_CONTEXT.deref();
            //            if (context == null)
            //            {
            //#if DEBUG
            //                context = new GenContext(iName, CompilerMode.File);
            //#else
            //                throw new InvalidOperationException("No compiler context on the stack.");
            //#endif
            //            }

            Type[] interfaceTypes = GenClass.CreateTypeArray(extends == null ? null : extends.seq());

            TypeBuilder proxyTB = context.ModuleBldr.DefineType(
                iName,
                TypeAttributes.Interface | TypeAttributes.Public | TypeAttributes.Abstract,
                null,
                interfaceTypes);

            DefineMethods(proxyTB, methods);

            Type t = proxyTB.CreateType();
            context.AssyBldr.Save(iName  + ".dll");
            return t;
        }
Esempio n. 4
0
 /// <summary>
 /// Initialize from given metatadata, plus first, restFn, rest.
 /// </summary>
 /// <param name="meta">The metadata to attach</param>
 /// <param name="first">The first of the sequence.</param>
 /// <param name="restFn">The function to generate the next value.</param>
 /// <param name="rest">The rest of the sequence..</param>
 FnSeq(IPersistentMap meta, object first, IFn restFn, ISeq rest)
     : base(meta)
 {
     _first = first;
     _restFn = restFn;
     _rest = rest;
 }
Esempio n. 5
0
        public static Type GenerateProxyClass(Type superclass, ISeq interfaces, string className)
        {
            //Console.WriteLine("Defining proxy class {0} with base {1}", className, superclass);

            // define the class
            List<Type> interfaceTypes = new List<Type>();
            interfaceTypes.Add(typeof(IProxy));

            for (ISeq s = interfaces; s != null; s = s.next())
                interfaceTypes.Add((Type)s.first());

            TypeBuilder proxyTB = _context.ModuleBldr.DefineType(
                className,
                TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed,
                superclass,
                interfaceTypes.ToArray());

            DefineCtors(proxyTB, superclass);
            FieldBuilder mapField = AddIProxyMethods(proxyTB);

            HashSet<Type> allInterfaces = GetAllInterfaces(interfaces);
            HashSet<MethodBuilder> specialMethods = new HashSet<MethodBuilder>();

            AddInterfaceMethods(proxyTB, mapField, superclass, allInterfaces, specialMethods);
            AddInterfaceProperties(proxyTB, superclass, allInterfaces, specialMethods ); // Must follow AddInterfaceMethods

            return proxyTB.CreateType();
        }
Esempio n. 6
0
 public static PersistentTreeSet create(ISeq init)
 {
     PersistentTreeSet ret = EMPTY;
    for (ISeq s = init; s != null; s = s.next() )
         ret = (PersistentTreeSet)ret.cons(s.first());
     return ret;
 }
Esempio n. 7
0
 /// <summary>
 /// Create a <see cref="PersistentHashSet">PersistentHashSet</see> initialized from an <see cref="ISeq">ISeq</see> of items.
 /// </summary>
 /// <param name="items">An <see cref="ISeq">ISeq</see> of items</param>
 /// <returns>A <see cref="PersistentHashSet">PersistentHashSet</see>.</returns>
 public static PersistentHashSet create(ISeq items)
 {
     PersistentHashSet ret = EMPTY;
     for (; items != null; items = items.next())
         ret = (PersistentHashSet)ret.cons(items.first());
     return ret;
 }
Esempio n. 8
0
 public static PersistentTreeSet create(IComparer comp, ISeq init)
 {
     PersistentTreeSet ret = new PersistentTreeSet(null, new PersistentTreeMap(null, comp));
     for (ISeq s = init; s != null; s = s.next())
         ret = (PersistentTreeSet)ret.cons(s.first());
     return ret;
 }
Esempio n. 9
0
 protected MemberDef(IImSeq<Annotation> annotations, ISeq<CustomAttribute> customAttributes, string name, bool isStatic)
 {
     Annotations = annotations ?? Constants.EmptyAnnotations;
     CustomAttributes = customAttributes ?? new Seq<CustomAttribute>();
     Name = name;
     IsStatic = isStatic;
 }
Esempio n. 10
0
 /// <summary>
 /// Construct a <see cref="StreamSeq">StreamSeq</see> from metadata and first/rest.
 /// </summary>
 /// <param name="meta">The metadata to attach</param>
 /// <param name="first">The first item.</param>
 /// <param name="rest">The rest of the sequence.</param>
 StreamSeq(IPersistentMap meta, Object first, ISeq rest)
     : base(meta)
 {
     _first = first;
     _rest = rest;
     _stream = null;
 }
Esempio n. 11
0
 public static PersistentHashSet create(ISeq items)
 {
     ITransientSet ret = (ITransientSet)EMPTY.asTransient(); 
     for (; items != null; items = items.next())
         ret = (ITransientSet)ret.conj(items.first());
     return (PersistentHashSet)ret.persistent();
 }
Esempio n. 12
0
        // This naming convention drawn from the Java code.
        internal void ComputeNames(ISeq form, string name)
        {
            ObjMethod enclosingMethod = (ObjMethod)Compiler.MethodVar.deref();

            string baseName = enclosingMethod != null
                ? enclosingMethod.Objx.Name
                : Compiler.munge(Compiler.CurrentNamespace.Name.Name) + "$";

            Symbol nm = RT.second(form) as Symbol;

            if (nm != null )
            {
                name = nm.Name + "__" + RT.nextID();
            }
            else
            {
                if (name == null)
                    name = "fn__" + RT.nextID();
                else if (enclosingMethod != null)
                    name += "__" + RT.nextID();
            }

            string simpleName = Compiler.munge(name).Replace(".", "_DOT_");

            Name = baseName + simpleName;
            InternalName = Name.Replace('.', '/');
        }
Esempio n. 13
0
        public void VerifyISeqCons(ISeq s, object newVal, IList<object> values)
        {
            ISeq newSeq = s.cons(newVal);

            Expect(newSeq.first(), EqualTo(newVal));
            VerifyISeqContents(newSeq.rest(), values);
        }
Esempio n. 14
0
 public override ISeq next()
 {
     if (_next == null)
     {
         _next = new Iterate(_f, first(), UNREALIZED_SEED);
     }
     return _next;
 }
Esempio n. 15
0
 public static Expr Parse(ISeq form)
 {
     Expr fexpr = Compiler.GenerateAST(form.first(),false);
     IPersistentVector args = PersistentVector.EMPTY;
     for ( ISeq s = RT.seq(form.next()); s != null; s = s.next())
         args = args.cons(Compiler.GenerateAST(s.first(),false));
     return new InvokeExpr((string)Compiler.SOURCE.deref(),(int)Compiler.LINE.deref(),Compiler.TagOf(form),fexpr,args);
 }
Esempio n. 16
0
 private Cycle(IPersistentMap meta, ISeq all, ISeq prev, ISeq current, ISeq next)
     :base(meta)
 {
     _all = all;
     _prev = prev;
     _current = current;
     _next = next;
 }
Esempio n. 17
0
 public static Expr Parse(ISeq form)
 {
     Expr fexpr = Compiler.GenerateAST(form.first());
     IPersistentVector args = PersistentVector.EMPTY;
     for ( ISeq s = RT.seq(form.next()); s != null; s = s.next())
         args = args.cons(Compiler.GenerateAST(s.first()));
     return new InvokeExpr(Compiler.TagOf(form),fexpr,args);
 }
Esempio n. 18
0
 private Iterate(IPersistentMap meta, IFn f, Object prevSeed, Object seed, ISeq next)
     :base(meta)
 {
     _f = f;
     _prevSeed = prevSeed;
     _seed = seed;
     _next = next;
 }
Esempio n. 19
0
 public ISeq sequence()
 {
     if (_sequence == NO_SEQ)
     {
         tap();
         _sequence = makeSequence(_tap);
     }
     return _sequence;
 }
Esempio n. 20
0
 // realization for use of current
 ISeq Current()
 {
     if (_current == null)
     {
         ISeq c = _prev.next();
         _current = (c == null) ? _all : c;
     }
     return _current;
 }
Esempio n. 21
0
        public void VerifyISeqContents(ISeq s, IList<object> values)
        {
            int i=0;

            for (; s != null; s = s.rest(), i++)
                Expect(s.first(), EqualTo(values[i]));

            Expect(i, EqualTo(values.Count));
        }
Esempio n. 22
0
 public override ISeq next()
 {
     if (_next == null)
     {
         if (_count > 1)
             _next = new Repeat(_count - 1, _val);
         else if (_count == INFINITE)
             _next = this;
     }
     return _next;
 }
Esempio n. 23
0
        public Delegate GenerateTypedDelegate(Type delegateType, Symbol optName, IPersistentVector argList, ISeq body)
        {
            ScriptSource scriptSource = Engine.CreateScriptSourceFromString("<internal>");

            LambdaExpression ast = Generator.GenerateTypedDelegateExpression(GetLanguageContext(), delegateType, optName, argList, body);
            return ast.Compile();

            //ast = new GlobalLookupRewriter().RewriteLambda(ast);  -- doesn't work unless no args
            //ScriptCode code = new ScriptCode(ast, GetSourceUnit(scriptSource));
            //return code;
        }
 /// <summary>
 /// Create a struct from a struct definition and values (in order) for the fixed keys.
 /// </summary>
 /// <param name="def">A struct definition</param>
 /// <param name="valseq">A sequence of values for the fixed keys (in definition order).</param>
 /// <returns>A <see cref="PersistentStructMap">PersistentStructMap</see>.</returns>
 public static PersistentStructMap construct(Def def, ISeq valseq)
 {
     object[] vals = new object[def.Keyslots.count()];
     IPersistentMap ext = PersistentHashMap.EMPTY;
     for (int i = 0; i < vals.Length && valseq != null; valseq = valseq.rest(), i++)
     {
         vals[i] = valseq.first();
     }
     if (valseq != null)
         throw new ArgumentException("Too many arguments to struct constructor");
     return new PersistentStructMap(null, def, vals, ext);
 }
Esempio n. 25
0
        public static Type GenerateInterface(string iName, IPersistentMap attributes, Seqable extends, ISeq methods)
        {
            iName = iName.Replace('-', '_');

            GenContext context;

            if (Compiler.IsCompiling)
            {
                //string path = (string)Compiler.COMPILE_PATH.deref();
                //if (path == null)
                //    throw new Exception("*compile-path* not set");
                //context = new GenContext(iName, ".dll", path, CompilerMode.File);
                context = (GenContext)Compiler.CompilerContextVar.deref();
            }
            else
                // TODO: In CLR4, should create a collectible type?
                context = GenContext.CreateWithExternalAssembly(iName+"_"+RT.nextID(), ".dll", false);

            for (ISeq s = RT.seq(extends); s != null; s = s.next())
            {
                object f = s.first();
                string name = f as String ?? ((Named)f).getName();

                if (name.Contains("-"))
                    throw new ArgumentException("Interface methods must not contain '-'");
            }


            Type[] interfaceTypes = GenClass.CreateTypeArray(extends == null ? null : extends.seq());

            TypeBuilder proxyTB = context.ModuleBuilder.DefineType(
                iName,
                TypeAttributes.Interface | TypeAttributes.Public | TypeAttributes.Abstract,
                null,
                interfaceTypes);

            // Should we associate source file info?
            // See Java committ 8d6fdb, 2015.07.17, related to CLJ-1645
            // TODO: part of check on debug info

            SetCustomAttributes(proxyTB, attributes);

            DefineMethods(proxyTB, methods);

            Type t = proxyTB.CreateType();

            //if ( Compiler.IsCompiling )
            //    context.SaveAssembly();

            Compiler.RegisterDuplicateType(t);

            return t;
        }
Esempio n. 26
0
 public AssemblyDef(Global global, IImSeq<Annotation> annotations, ISeq<CustomAttribute> customAttributes, AssemblyName name, IImSeq<AssemblyName> references, IImSeq<TypeDef> types, MethodRef entryPoint)
 {
     Annotations = annotations ?? Constants.EmptyAnnotations;
     CustomAttributes = customAttributes ?? new Seq<CustomAttribute>();
     Name = name;
     References = references ?? Constants.EmptyStrongAssemblyNames;
     Types = types ?? Constants.EmptyTypeDefs;
     EntryPoint = entryPoint;
     nameToTypeDefCache = new Map<TypeName, TypeDef>();
     if (types != null)
     {
         foreach (var t in types)
             nameToTypeDefCache.Add(t.EffectiveName(global), t);
     }
 }
Esempio n. 27
0
        // This naming convention drawn from the Java code.
        internal void ComputeNames(ISeq form, string name)
        {
            ObjMethod enclosingMethod = (ObjMethod)Compiler.MethodVar.deref();

            string baseName = enclosingMethod != null
                ? (enclosingMethod.Objx.Name + "$")
                : Compiler.munge(Compiler.CurrentNamespace.Name.Name) + "$";

            if (RT.second(form) is Symbol)
                name = ((Symbol)RT.second(form)).Name;

            string simpleName = name != null ?
                        (Compiler.munge(name).Replace(".", "_DOT_")
                        + (enclosingMethod != null ? "__" + RT.nextID() : ""))
                        : ("fn"
                          + "__" + RT.nextID());            

            _name = baseName + simpleName;
            InternalName = _name.Replace('.', '/');
        }
Esempio n. 28
0
        public static Type GenerateInterface(string iName, IPersistentMap attributes, ISeq extends, ISeq methods)
        {
            iName = iName.Replace('-', '_');

            GenContext context;

            if (Compiler.IsCompiling)
            {
                //string path = (string)Compiler.COMPILE_PATH.deref();
                //if (path == null)
                //    throw new Exception("*compile-path* not set");
                //context = new GenContext(iName, ".dll", path, CompilerMode.File);
                context = (GenContext)Compiler.COMPILER_CONTEXT.deref();
            }
            else
                // TODO: In CLR4, should create a collectible type?
                context = GenContext.CreateWithExternalAssembly(iName, ".dll", false);

            Type[] interfaceTypes = GenClass.CreateTypeArray(extends == null ? null : extends.seq());

            TypeBuilder proxyTB = context.ModuleBuilder.DefineType(
                iName,
                TypeAttributes.Interface | TypeAttributes.Public | TypeAttributes.Abstract,
                null,
                interfaceTypes);

            SetCustomAttributes(proxyTB, attributes);

            DefineMethods(proxyTB, methods);

            Type t = proxyTB.CreateType();

            //if ( Compiler.IsCompiling )
            //    context.SaveAssembly();

            Compiler.RegisterDuplicateType(t);

            return t;
        }
Esempio n. 29
0
 // do we need this?
 protected static ISeq FindKey(object key, ISeq args)
 {
     while (args != null)
     {
         if (key == args.first())
             return args.next();
         args = RT.next(args);
         args = RT.next(args);
     }
     return null;
 }
Esempio n. 30
0
 /// <summary>
 /// Initializes a <see cref="Cons">Cons</see> with null metadata and given first/rest.
 /// </summary>
 /// <param name="first">The first value.</param>
 /// <param name="more">The rest of the sequence.</param>
 public Cons(object first, ISeq more)
 {
     _first = first;
     _more  = more;
 }
Esempio n. 31
0
 public object applyTo(ISeq arglist)
 {
     return(AFn.ApplyToHelper(this, arglist));
 }
Esempio n. 32
0
        public static object ApplyToHelper(IFn fn, ISeq argList)
        {
            switch (RT.BoundedLength(argList, 20))
            {
            case 0:
                argList = null;
                return(fn.invoke());

            case 1:
                return(fn.invoke(Util.Ret1(argList.first(), argList = null)));

            case 2:
                return(fn.invoke(argList.first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 3:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 4:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 5:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 6:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 7:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 8:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 9:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 10:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 11:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 12:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 13:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 14:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 15:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 16:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 17:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 18:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 19:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            case 20:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , Util.Ret1((argList = argList.next()).first(), argList = null)
                                 ));

            default:
                return(fn.invoke(argList.first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , (argList = argList.next()).first()
                                 , RT.SeqToArray <object>(Util.Ret1(argList.next(), argList = null))));
            }
        }
Esempio n. 33
0
 public object alter(IFn fn, ISeq args)
 {
     set(fn.applyTo(RT.cons(deref(), args)));
     return(this);
 }
Esempio n. 34
0
 /// <summary>
 /// Initializes a <see cref="Cons">Cons</see> with the given metadata and first/rest.
 /// </summary>
 /// <param name="meta">The metadata to attach.</param>
 /// <param name="first">The first value.</param>
 /// <param name="more">The rest of the sequence.</param>
 public Cons(IPersistentMap meta, object first, ISeq more)
     : base(meta)
 {
     _first = first;
     _more  = more;
 }
 /// <summary>
 /// Initialize a <see cref="Def">Def</see>.
 /// </summary>
 /// <param name="keys">The fixed keys.</param>
 /// <param name="keyslots">The map of keys/values for the fixed keys.</param>
 public Def(ISeq keys, IPersistentMap keyslots)
 {
     _keys     = keys;
     _keyslots = keyslots;
 }
Esempio n. 36
0
        public override object applyTo(ISeq args)
        {
            if (RT.BoundedLength(args, _reqArity) <= _reqArity)
                return base.applyTo(args);

            switch (_reqArity)
            {
                case 0:
                    return doInvoke(args);
                case 1:
                    return doInvoke(args.first()
                            , args.next());
                case 2:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , args.next());
                case 3:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 4:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 5:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 6:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 7:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 8:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 9:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 10:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 11:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 12:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 13:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 14:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 15:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 16:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 17:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 18:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 19:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());
                case 20:
                    return doInvoke(args.first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , (args = args.next()).first()
                            , args.next());

            }
            throw WrongArityException();
        }
Esempio n. 37
0
 public virtual object applyTo(ISeq arglist)
 {
     return(ApplyToHelper(this, Util.Ret1(arglist, arglist = null)));
 }