Beispiel #1
0
        private IValue ListContains(List <IValue> arguments, Scope s)
        {
            ListTable left  = (ListTable)arguments[0];
            IValue    right = arguments[1];

            var list = left.AsList();

            return(list.Contains(right) ? Bool.True : Bool.False);
        }
Beispiel #2
0
        private IValue AreEqual(List <IValue> arguments, Scope s)
        {
            ListTable left  = arguments[0] as ListTable;
            ListTable right = arguments[1] as ListTable;

            if (left == null || right == null)
            {
                return(Bool.False);
            }
            return(left.AsList().SequenceEqual(right.AsList()) ? Bool.True : Bool.False);
        }
Beispiel #3
0
        private IValue PopEnd(List <IValue> arguments, Scope s)
        {
            ListTable left = (ListTable)arguments[0];

            if (left.Count < 1)
            {
                return(Value.Nil);
            }

            var    list  = left.AsList();
            IValue first = list.First();

            list.RemoveAt(0);
            return(first);
        }