コード例 #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))
コード例 #2
0
ファイル: emptylist_tests.py プロジェクト: yminer/clojure-py
 def testCons_PASS(self):
     l = EMPTY.cons(uobj)
     self.assertFalse(EMPTY is l)
     self.assertEqual(len(l), 1)
     self.assertEqual(l.first(), uobj)
コード例 #3
0
 def testCons_PASS(self):
     l = EMPTY.cons(uobj)
     self.assertFalse(EMPTY is l)
     self.assertEqual(len(l), 1)
     self.assertEqual(l.first(), uobj)