Beispiel #1
0
def cons(x, s):
    from clojure.lang.cons import Cons
    from clojure.lang.persistentlist import EMPTY as EMPTY_LIST
    if isinstance(s, ISeq):
        return Cons(x, s)
    if s is None:
        return EMPTY_LIST.cons(x)
    return Cons(x, seq(s))
Beispiel #2
0
 def testCons_PASS(self):
     l = EMPTY.cons(uobj)
     self.assertFalse(EMPTY is l)
     self.assertEqual(len(l), 1)
     self.assertEqual(l.first(), uobj)
 def testCons_PASS(self):
     l = EMPTY.cons(uobj)
     self.assertFalse(EMPTY is l)
     self.assertEqual(len(l), 1)
     self.assertEqual(l.first(), uobj)