Exemple #1
0
        public static Shelisp.Object Frassoc(L l, Shelisp.Object val, Shelisp.Object alist)
        {
            if (!L.LISTP(alist))
                throw new WrongTypeArgumentException ("listp", alist);

            if (L.NILP(alist))
                return L.Qnil;

            foreach (var el in L.CONS(alist)) {
                if (!L.LISTP(el))
                    continue;
                var cdr = L.CDR(el);
                if (val.LispEqual (cdr))
                    return el;
            }
            return L.Qnil;
        }
Exemple #2
0
        public static Shelisp.Object Fmember(L l, Shelisp.Object obj, Shelisp.Object list)
        {
            if (!L.LISTP (list))
                throw new WrongTypeArgumentException ("listp", list);

            while (L.CONSP (list)) {
                if (obj.LispEqual (L.CAR(list)))
                    return list;
                list = L.CDR (list);
            }

            return L.Qnil;
        }
Exemple #3
0
 private static bool compare_equal(Shelisp.Object obj1, Shelisp.Object obj2, long hash1, long hash2)
 {
     return hash1 == hash2 && obj1.LispEqual (obj2);
 }
Exemple #4
0
        public static Shelisp.Object Fequal(L l, Shelisp.Object o1, Shelisp.Object o2)
        {
            if (L.NILP(o1))
                return L.NILP(o2) ? L.Qt : L.Qnil;

            return o1.LispEqual (o2) ? L.Qt : L.Qnil;
        }
Exemple #5
0
 public static AssertResult NotEqual(Shelisp.Object o1, Shelisp.Object o2, string description = null)
 {
     return (o1.LispEqual (o2)) ? Fail(description) : Succeed(description);
 }