• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IPersistentVector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IPersistentVector的典型用法代码示例。如果您正苦于以下问题:C# IPersistentVector类的具体用法?C# IPersistentVector怎么用?C# IPersistentVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IPersistentVector类属于命名空间,在下文中一共展示了IPersistentVector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Parse

        public static Expr Parse(ParserContext pcon, IPersistentVector form)
        {
            ParserContext pconToUse = pcon.EvEx();
            bool constant = true;

            IPersistentVector args = PersistentVector.EMPTY;
            for (int i = 0; i < form.count(); i++ )
            {
                Expr v = Compiler.Analyze(pconToUse, form.nth(i));
                args = (IPersistentVector)args.cons(v);
                if ( !(v is LiteralExpr) )
                    constant = false;
            }

            Expr ret = new VectorExpr(args);
            if ( form is IObj && ((IObj)form).meta() != null )
                return Compiler.OptionallyGenerateMetaInit(pcon,form, ret);
            else if ( constant )
            {
                IPersistentVector rv = PersistentVector.EMPTY;
                for ( int i=0; i<args.count(); i++ )
                {
                    LiteralExpr ve = (LiteralExpr)args.nth(i);
                    rv = (IPersistentVector)rv.cons(ve.Val);
                }
                return new ConstantExpr(rv);
            }
            else
                return ret;
        }
开发者ID:101v,项目名称:clojure-clr,代码行数:30,代码来源:VectorExpr.cs


示例2: InvokeExpr

        public InvokeExpr(string source, IPersistentMap spanMap, Symbol tag, Expr fexpr, IPersistentVector args)
        {
            _source = source;
            _spanMap = spanMap;
            _fexpr = fexpr;
            _args = args;

            VarExpr varFexpr = fexpr as VarExpr;

            if (varFexpr != null)
            {
                Var fvar = varFexpr.Var;
                Var pvar = (Var)RT.get(fvar.meta(), Compiler.ProtocolKeyword);
                if (pvar != null && Compiler.ProtocolCallsitesVar.isBound)
                {
                    _isProtocol = true;
                    _siteIndex = Compiler.RegisterProtocolCallsite(fvar);
                    Object pon = RT.get(pvar.get(), _onKey);
                    _protocolOn = HostExpr.MaybeType(pon, false);
                    if (_protocolOn != null)
                    {
                        IPersistentMap mmap = (IPersistentMap)RT.get(pvar.get(), _methodMapKey);
                        Keyword mmapVal = (Keyword)mmap.valAt(Keyword.intern(fvar.sym));
                        if (mmapVal == null)
                        {
                            throw new ArgumentException(String.Format("No method of interface: {0} found for function: {1} of protocol: {2} (The protocol method may have been defined before and removed.)",
                                _protocolOn.FullName, fvar.Symbol, pvar.Symbol));
                        }
                        String mname = Compiler.munge(mmapVal.Symbol.ToString());

                        IList<MethodBase> methods = Reflector.GetMethods(_protocolOn, mname, null, args.count() - 1,  false);
                        if (methods.Count != 1)
                            throw new ArgumentException(String.Format("No single method: {0} of interface: {1} found for function: {2} of protocol: {3}",
                                mname, _protocolOn.FullName, fvar.Symbol, pvar.Symbol));
                        _onMethod = (MethodInfo) methods[0];
                    }
                }
            }

            if (tag != null)
                _tag = tag;
            else if (varFexpr != null)
            {
                object arglists = RT.get(RT.meta(varFexpr.Var), Compiler.ArglistsKeyword);
                object sigTag = null;
                for (ISeq s = RT.seq(arglists); s != null; s = s.next())
                {
                    APersistentVector sig = (APersistentVector)s.first();
                    int restOffset = sig.IndexOf(Compiler.AmpersandSym);
                    if (args.count() == sig.count() || (restOffset > -1 && args.count() >= restOffset))
                    {
                        sigTag = Compiler.TagOf(sig);
                        break;
                    }
                }
                _tag = sigTag ?? varFexpr.Tag;
            }
            else
                _tag = null;
        }
开发者ID:EricThorsen,项目名称:clojure-clr,代码行数:60,代码来源:InvokeExpr.cs


示例3: RecurExpr

 public RecurExpr(string source, IPersistentMap spanMap, IPersistentVector loopLocals, IPersistentVector args)
 {
     _loopLocals = loopLocals;
     _args = args;
     _source = source;
     _spanMap = spanMap;
 }
开发者ID:stuman08,项目名称:clojure-clr,代码行数:7,代码来源:RecurExpr.cs


示例4: GenTypedArgs

 internal static Expression[] GenTypedArgs(GenContext context, ParameterInfo[] parms, IPersistentVector args)
 {
     Expression[] exprs = new Expression[parms.Length];
     for (int i = 0; i < parms.Length; i++)
         exprs[i] = GenTypedArg(context,parms[i].ParameterType, (Expr)args.nth(i));
     return exprs;
 }
开发者ID:jlomax,项目名称:clojure-clr,代码行数:7,代码来源:HostExpr.cs


示例5: InvokeExpr

 public InvokeExpr(string source, int line, Symbol tag, Expr fexpr, IPersistentVector args)
 {
     _source = source;
     _line = line;
     _fexpr = fexpr;
     _args = args;
     _tag = tag ?? (fexpr is VarExpr ? ((VarExpr)fexpr).Tag : null);
 }
开发者ID:starapor,项目名称:clojure-clr,代码行数:8,代码来源:InvokeExpr.cs


示例6: TryExpr

 public TryExpr(Expr tryExpr, IPersistentVector catchExprs, Expr finallyExpr, int retLocal, int finallyLocal)
 {
     _tryExpr = tryExpr;
     _catchExprs = catchExprs;
     _finallyExpr = finallyExpr;
     _retLocal = retLocal;
     _finallyLocal = finallyLocal;
 }
开发者ID:kmartin,项目名称:clojure-contrib,代码行数:8,代码来源:TryExpr.cs


示例7: InstanceMethodExpr

        public InstanceMethodExpr(Expr target, string methodName, IPersistentVector args)
        {
            _target = target;
            _methodName = methodName;
            _args = args;

            _method = GetMatchingMethod(target, _args, _methodName);
        }
开发者ID:kmartin,项目名称:clojure-contrib,代码行数:8,代码来源:InstanceMethodExpr.cs


示例8: StaticMethodExpr

        public StaticMethodExpr(Type type, string methodName, IPersistentVector args)
        {
            _type = type;
            _methodName = methodName;
            _args = args;

            _method  = GetMatchingMethod(_type, _args, _methodName);
        }
开发者ID:kmartin,项目名称:clojure-contrib,代码行数:8,代码来源:StaticMethodExpr.cs


示例9: DefineMethod

        private static void DefineMethod(TypeBuilder proxyTB, IPersistentVector sig)
        {
            string mname = (string)sig.nth(0);
            Type[] paramTypes = GenClass.CreateTypeArray((ISeq)sig.nth(1));
            Type retType = (Type)sig.nth(2);

            MethodBuilder mb = proxyTB.DefineMethod(mname, MethodAttributes.Abstract | MethodAttributes.Public| MethodAttributes.Virtual, retType, paramTypes);
        }
开发者ID:starapor,项目名称:clojure-clr,代码行数:8,代码来源:GenInterface.cs


示例10: Parse

        public static Expr Parse(IPersistentVector form)
        {
            IPersistentVector args = PersistentVector.EMPTY;
            for (int i = 0; i < form.count(); i++ )
                args = (IPersistentVector)args.cons(Compiler.GenerateAST(form.nth(i),false));

            Expr ret = new VectorExpr(args);
            return Compiler.OptionallyGenerateMetaInit(form, ret);
        }
开发者ID:starapor,项目名称:clojure-clr,代码行数:9,代码来源:VectorExpr.cs


示例11: StaticInvokeExpr

 public StaticInvokeExpr(Type target, Type retType, Type[] paramTypes, bool variadic, IPersistentVector args, Symbol tag)
 {
     _target = target;
     _retType = retType;
     _paramTypes = paramTypes;
     _variadic = variadic;
     _args = args;
     _tag = tag;
 }
开发者ID:101v,项目名称:clojure-clr,代码行数:9,代码来源:StaticInvokeExpr.cs


示例12: StaticInvokeExpr

 public StaticInvokeExpr(Type target, MethodInfo method, bool variadic, IPersistentVector args, object tag)
 {
     //_target = target;
     _method = method;
     _retType = method.ReturnType;
     _variadic = variadic;
     _args = args;
     _tag = tag;
 }
开发者ID:clojure,项目名称:clojure-clr,代码行数:9,代码来源:StaticInvokeExpr.cs


示例13: StaticMethodExpr

        public StaticMethodExpr(string source, int line, Type type, string methodName, IPersistentVector args)
        {
            _source = source;
            _line = line;
            _type = type;
            _methodName = methodName;
            _args = args;

            _method  = GetMatchingMethod(line, _type, _args, _methodName);
        }
开发者ID:starapor,项目名称:clojure-clr,代码行数:10,代码来源:StaticMethodExpr.cs


示例14: GetMatchingParams

        internal static int GetMatchingParams(string methodName, List<ParameterInfo[]> parmlists, IPersistentVector argexprs, List<Type> rets)
        {
            // Assume matching lengths
            int matchIndex = -1;
            bool tied = false;
            bool foundExact = false;

            for (int i = 0; i < parmlists.Count; i++)
            {
                bool match = true;
                ISeq aseq = argexprs.seq();
                int exact = 0;
                for (int p = 0; match && p < argexprs.count() && aseq != null; ++p, aseq = aseq.next())
                {
                    Expr arg = (Expr)aseq.first();
                    Type atype = arg.HasClrType ? arg.ClrType : typeof(object);
                    Type ptype = parmlists[i][p].ParameterType;
                    if (arg.HasClrType && atype == ptype)
                        exact++;
                    else
                        match = Reflector.ParamArgTypeMatch(ptype, atype);
                }

                if (exact == argexprs.count())
                {
                    if ( !foundExact || matchIndex == -1 || rets[matchIndex].IsAssignableFrom(rets[i]))
                        matchIndex = i;
                    foundExact = true;
                }
                else if (match && !foundExact)
                {
                    if (matchIndex == -1)
                        matchIndex = i;
                    else
                    {
                        if (Reflector.Subsumes(parmlists[i], parmlists[matchIndex]))
                        {
                            matchIndex = i;
                            tied = false;
                        }
                        else if (Array.Equals(parmlists[i], parmlists[matchIndex]))
                            if (rets[matchIndex].IsAssignableFrom(rets[i]))
                                matchIndex = i;
                            else if (!Reflector.Subsumes(parmlists[matchIndex], parmlists[i]))
                                tied = true;
                    }
                }
            }

            if (tied)
                throw new ArgumentException("More than one matching method found: " + methodName);

            return matchIndex;
        }
开发者ID:jlomax,项目名称:clojure-clr,代码行数:54,代码来源:HostExpr.cs


示例15: GenerateTypedDelegate

        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;
        }
开发者ID:arohner,项目名称:clojure-contrib,代码行数:11,代码来源:ClojureConsole.cs


示例16: InstanceMethodExpr

        public InstanceMethodExpr(string source, int line, Expr target, string methodName, IPersistentVector args)
        {
            _source = source;
            _line = line;
            _target = target;
            _methodName = methodName;
            _args = args;

            if (target.HasClrType && target.ClrType == null)
                throw new ArgumentException(String.Format("Attempt to call instance method {0} on nil", methodName));

            _method = GetMatchingMethod(line, target, _args, _methodName);
        }
开发者ID:starapor,项目名称:clojure-clr,代码行数:13,代码来源:InstanceMethodExpr.cs


示例17: InvokeExpr

        public InvokeExpr(string source, IPersistentMap spanMap, Symbol tag, Expr fexpr, IPersistentVector args)
        {
            _source = source;
            _spanMap = spanMap;
            _fexpr = fexpr;
            _args = args;

            if (fexpr is VarExpr)
            {
                Var fvar = ((VarExpr)fexpr).Var;
                Var pvar = (Var)RT.get(fvar.meta(), Compiler.PROTOCOL_KEY);
                if (pvar != null && Compiler.PROTOCOL_CALLSITES.isBound)
                {
                    _isProtocol = true;
                    _siteIndex = Compiler.RegisterProtocolCallsite(fvar);
                    Object pon = RT.get(pvar.get(), _onKey);
                    _protocolOn = HostExpr.MaybeType(pon, false);
                    if (_protocolOn != null)
                    {
                        IPersistentMap mmap = (IPersistentMap)RT.get(pvar.get(), _methodMapKey);
                        Keyword mmapVal = (Keyword)mmap.valAt(Keyword.intern(fvar.sym));
                        if (mmapVal == null)
                        {
                            throw new ArgumentException(String.Format("No method of interface: {0} found for function: {1} of protocol: {2} (The protocol method may have been defined before and removed.)",
                                _protocolOn.FullName, fvar.Symbol, pvar.Symbol));
                        }
                        String mname = Compiler.munge(mmapVal.Symbol.ToString());

                        List<MethodInfo> methods = Reflector.GetMethods(_protocolOn, mname, args.count() - 1,  false);
                        if (methods.Count != 1)
                            throw new ArgumentException(String.Format("No single method: {0} of interface: {1} found for function: {2} of protocol: {3}",
                                mname, _protocolOn.FullName, fvar.Symbol, pvar.Symbol));
                        _onMethod = methods[0];
                    }
                }
                //else if (pvar == null && Compiler.VAR_CALLSITES.isBound
                //    && fvar.Namespace.Name.Name.StartsWith("clojure")
                //    && !RT.booleanCast(RT.get(RT.meta(fvar), _dynamicKey)))
                //{
                //    // Java TODO: more specific criteria for binding these
                //    _isDirect = true;
                //    _siteIndex = Compiler.RegisterVarCallsite(fvar);
                //}
            }

            _tag = tag ?? (fexpr is VarExpr ? ((VarExpr)fexpr).Tag : null);
        }
开发者ID:101v,项目名称:clojure-clr,代码行数:47,代码来源:InvokeExpr.cs


示例18: InvokeExpr

        public InvokeExpr(string source, IPersistentMap spanMap, Symbol tag, Expr fexpr, IPersistentVector args)
        {
            _source = source;
            _spanMap = spanMap;
            _fexpr = fexpr;
            _args = args;

            if (fexpr is VarExpr)
            {
                Var fvar = ((VarExpr)fexpr).Var;
                Var pvar = (Var)RT.get(fvar.meta(), Compiler.PROTOCOL_KEY);
                if (pvar != null && Compiler.PROTOCOL_CALLSITES.isBound)
                {
                    _isProtocol = true;
                    _siteIndex = Compiler.RegisterProtocolCallsite(fvar);
                    Object pon = RT.get(pvar.get(), _onKey);
                    _protocolOn = HostExpr.MaybeType(pon, false);
                    if (_protocolOn != null)
                    {
                        IPersistentMap mmap = (IPersistentMap)RT.get(pvar.get(), _methodMapKey);
                        Keyword mmapVal = (Keyword)mmap.valAt(Keyword.intern(fvar.sym));
                        if (mmapVal == null)
                        {
                            throw new ArgumentException(String.Format("No method of interface: {0} found for function: {1} of protocol: {2} (The protocol method may have been defined before and removed.)",
                                _protocolOn.FullName, fvar.Symbol, pvar.Symbol));
                        }
                        String mname = Compiler.munge(mmapVal.Symbol.ToString());

                        List<MethodBase> methods = Reflector.GetMethods(_protocolOn, mname, null, args.count() - 1,  false);
                        if (methods.Count != 1)
                            throw new ArgumentException(String.Format("No single method: {0} of interface: {1} found for function: {2} of protocol: {3}",
                                mname, _protocolOn.FullName, fvar.Symbol, pvar.Symbol));
                        _onMethod = (MethodInfo) methods[0];
                    }
                }
            }

            _tag = tag ?? (fexpr is VarExpr ? ((VarExpr)fexpr).Tag : null);
        }
开发者ID:davidadsit,项目名称:clojure-clr,代码行数:39,代码来源:InvokeExpr.cs


示例19: InterfaceNames

 static string[] InterfaceNames(IPersistentVector interfaces)
 {
     int icnt = interfaces.count();
     string[] inames = icnt > 0 ? new string[icnt] : null;
     for (int i = 0; i < icnt; i++)
         inames[i] = SlashName((Type)interfaces.nth(i));
     return inames;
 }
开发者ID:christianblunden,项目名称:clojure-clr,代码行数:8,代码来源:NewInstanceExpr.cs


示例20: SetExpr

 public SetExpr(IPersistentVector keys)
 {
     _keys = keys;
 }
开发者ID:kmartin,项目名称:clojure-contrib,代码行数:4,代码来源:SetExpr.cs



注:本文中的IPersistentVector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IPersister类代码示例发布时间:2022-05-24
下一篇:
C# IPersistentMap类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap