コード例 #1
0
        public object Apply(Interpreter i, Pair args, Environment env)
        {
            string s1 = (string)List.First(args);
            string s2 = (string)List.Second(args);

            return(Boolean.Create(s1 == s2));
        }
コード例 #2
0
        public object Apply(Interpreter i, Pair args, Environment env)
        {
            long len = List.Length(args);

            if (len < 2)
            {
                throw new System.Exception("= expects at least 2 arguments");
            }
            else
            {
                long currentInt  = (long)args.Head;
                Pair currentPair = (Pair)args.Tail;
                while (currentPair != Pair.EmptyList)
                {
                    long nextInt = (long)List.First(currentPair);
                    if (currentInt != nextInt)
                    {
                        return(Boolean.Create(false));
                    }
                    currentPair = (Pair)currentPair.Tail;
                }

                return(Boolean.Create(true));
            }
        }
コード例 #3
0
        public object Apply(Interpreter i, Pair args, Environment env)
        {
            Symbol s    = (Symbol)List.First(args);
            Symbol prop = (Symbol)List.Second(args);

            return((s.Properties.Contains(prop)) ?
                   s.Properties[prop] : Boolean.Create(false));
        }
コード例 #4
0
        public object Apply(Interpreter i, Pair args, Environment env)
        {
            object o1 = List.First(args);
            object o2 = List.Second(args);

            return(Boolean.Create(
                       (o1 is long && o2 is long) ? (long)o1 == (long)o2 :
                       (o1 is Character && o2 is Character) ?
                       (Character)o1 == (Character)o2 : o1 == o2
                       ));
        }
コード例 #5
0
        public object Apply(Interpreter i, Pair args, Environment env)
        {
            object n1 = List.First(args);
            object n2 = List.Second(args);

            if (n1 is long && n2 is long)
            {
                long i1 = (long)n1;
                long i2 = (long)n2;
                return(Boolean.Create(i1 < i2));
            }

            throw new System.Exception("Unrecognized <");
        }
コード例 #6
0
 public object Apply(Interpreter i, Pair args, Environment env)
 {
     return(Boolean.Create(List.First(args) is Character));
 }
コード例 #7
0
        public object Apply(Interpreter i, Pair args, Environment env)
        {
            Symbol s = (Symbol)List.First(args);

            return(Boolean.Create(s.IsGenSym()));
        }
コード例 #8
0
        public object Apply(Interpreter i, Pair args, Environment env)
        {
            int n = (int)List.First(args);

            return(Boolean.Create(n == 0));
        }
コード例 #9
0
        public object Apply(Interpreter i, Pair args, Environment env)
        {
            object o = List.First(args);

            return(Boolean.Create(o != Pair.EmptyList && o is Pair));
        }
コード例 #10
0
 public object Apply(Interpreter i, Pair args, Environment env)
 {
     return(Boolean.Create(List.First(args) == Pair.EmptyList));
 }
コード例 #11
0
        public object Apply(Interpreter i, Pair args, Environment env)
        {
            object o = List.First(args);

            return(Boolean.Create(o == Boolean.TRUE || o == Boolean.FALSE));
        }
コード例 #12
0
 public object Apply(Interpreter i, Pair args, Environment env)
 {
     return(Boolean.Create(List.First(args) == List.Second(args)));
 }