Esempio n. 1
0
        public static bool Any(IApply predicate, IEnumerable seq, params object[] args)
        {
            var kwargs = ParseKwargs(args, new string[] { "key" });
            var key    = GetClosure(kwargs[0]);

            return(SeqBase.Any(predicate, seq, key));
        }
Esempio n. 2
0
        public static bool EvalFeatureExpr(object expr)
        {
            if (expr == null)
            {
                return(false);
            }
            else if (expr is bool)
            {
                return((bool)expr);
            }
            else if (expr is Symbol)
            {
                return(HasFeature(((Symbol)expr).Name));
            }
            else if (expr is Cons)
            {
                var list = (Cons)expr;
                var oper = First(list) as Symbol;
                if (oper != null)
                {
                    if (oper.Name == "and")
                    {
                        return(SeqBase.Every(EvalFeatureExpr, list.Cdr));
                    }
                    else if (oper.Name == "or")
                    {
                        return(SeqBase.Any(EvalFeatureExpr, list.Cdr));
                    }
                    else if (oper.Name == "not")
                    {
                        return(!EvalFeatureExpr(Second((Cons)expr)));
                    }
                }
            }

            throw new LispException("Invalid feature expression");
        }
Esempio n. 3
0
 public static bool Any(IApply predicate, IEnumerable seq)
 {
     return(SeqBase.Any(predicate, seq));
 }