Index: gnu/commonlisp/lang/ChangeLog =================================================================== --- gnu/commonlisp/lang/ChangeLog (revision 7787) +++ gnu/commonlisp/lang/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2014-02-08 Charles Turner + + * CommonLisp.java: Added the various c*r procedures, acons, listp, + numberp, zerop, consp and atom. + 2014-02-07 Charles Turner * CommonLisp.java: Change NOT to be defined as in Scheme, so that Index: gnu/commonlisp/lang/CommonLisp.java =================================================================== --- gnu/commonlisp/lang/CommonLisp.java (revision 7787) +++ gnu/commonlisp/lang/CommonLisp.java (working copy) @@ -169,6 +169,34 @@ defProcStFld("car", "gnu.commonlisp.lisp.primitives"); defProcStFld("first", "gnu.commonlisp.lisp.primitives"); defProcStFld("cdr", "gnu.commonlisp.lisp.primitives"); + defProcStFld("caar", "kawa.lib.lists"); + defProcStFld("cadr", "kawa.lib.lists"); + defProcStFld("cdar", "kawa.lib.lists"); + defProcStFld("cddr", "kawa.lib.lists"); + defProcStFld("caaar", "kawa.lib.lists"); + defProcStFld("caadr", "kawa.lib.lists"); + defProcStFld("cadar", "kawa.lib.lists"); + defProcStFld("caddr", "kawa.lib.lists"); + defProcStFld("cdaar", "kawa.lib.lists"); + defProcStFld("cdadr", "kawa.lib.lists"); + defProcStFld("cddar", "kawa.lib.lists"); + defProcStFld("cdddr", "kawa.lib.lists"); + defProcStFld("caaaar", "kawa.lib.lists"); + defProcStFld("caaadr", "kawa.lib.lists"); + defProcStFld("caadar", "kawa.lib.lists"); + defProcStFld("caaddr", "kawa.lib.lists"); + defProcStFld("cadaar", "kawa.lib.lists"); + defProcStFld("cadadr", "kawa.lib.lists"); + defProcStFld("caddar", "kawa.lib.lists"); + defProcStFld("cadddr", "kawa.lib.lists"); + defProcStFld("cdaaar", "kawa.lib.lists"); + defProcStFld("cdaadr", "kawa.lib.lists"); + defProcStFld("cdadar", "kawa.lib.lists"); + defProcStFld("cdaddr", "kawa.lib.lists"); + defProcStFld("cddaar", "kawa.lib.lists"); + defProcStFld("cddadr", "kawa.lib.lists"); + defProcStFld("cdddar", "kawa.lib.lists"); + defProcStFld("cddddr", "kawa.lib.lists"); defProcStFld("rest", "gnu.commonlisp.lisp.primitives"); defProcStFld("second", "gnu.commonlisp.lisp.primitives"); defProcStFld("third", "gnu.commonlisp.lisp.primitives"); @@ -176,6 +204,12 @@ defProcStFld("nth", "gnu.commonlisp.lisp.primitives"); defProcStFld("1-", "gnu.commonlisp.lisp.primitives"); defProcStFld("1+", "gnu.commonlisp.lisp.primitives"); + defProcStFld("acons", "gnu.commonlisp.lisp.primitives"); + defProcStFld("listp", "gnu.commonlisp.lisp.primitives"); + defProcStFld("numberp", "gnu.commonlisp.lisp.primitives"); + defProcStFldAs("zerop", "kawa.lib.numbers", "zero?"); + defProcStFldAs("consp", "kawa.lib.lists", "pair?"); + defProcStFld("atom", "gnu.commonlisp.lisp.primitives"); } public static CommonLisp getInstance() Index: gnu/commonlisp/lisp/primitives.lisp =================================================================== --- gnu/commonlisp/lisp/primitives.lisp (revision 7787) +++ gnu/commonlisp/lisp/primitives.lisp (working copy) @@ -31,3 +31,16 @@ (defun 1- (x) (- x 1)) (defun 1+ (x) (+ x 1)) + + +(defun acons (key datum alist) + (cons (cons key datum) alist)) + +(defun listp (obj) + (typep obj 'list)) + +(defun numberp (obj) + (typep obj 'number)) + +(defun atom (obj) + (not (consp obj))) Index: gnu/commonlisp/testsuite/ChangeLog =================================================================== --- gnu/commonlisp/testsuite/ChangeLog (revision 7787) +++ gnu/commonlisp/testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2014-02-08 Charles Turner + + * lang-test.lisp: New test for acons, listp, numberp, zerop, + consp, and atom. + 2014-02-07 Charles Turner * lang-test.lisp: New tests for car, cdr, first, rest, nth and Index: gnu/commonlisp/testsuite/lang-test.lisp =================================================================== --- gnu/commonlisp/testsuite/lang-test.lisp (revision 7787) +++ gnu/commonlisp/testsuite/lang-test.lisp (working copy) @@ -1,4 +1,4 @@ -(test-init "Common Lisp tests" 35) +(test-init "Common Lisp tests" 59) (setq y 100) (defun foo1 (x) @@ -70,3 +70,42 @@ (test '(c) 'nthcdr-4 (nthcdr 2 '(a b c))) (test '() 'nthcdr-5 (nthcdr 4 '(a b c))) (test 1 'nthcdr-6 (nthcdr 1 '(0 . 1))) + +(setq alist '()) +(test '((1 . "one")) 'acons-1 (acons 1 "one" alist)) +(test nil 'acons-2 alist) +(test '((1 . "one") (2 . "two")) + 'acons-3 + (setq alist (acons 1 "one" (acons 2 "two" alist)))) +(test '(1 . "one") + 'acons-4 + (assoc 1 alist)) +(test '((1 . "uno") (1 . "one") (2 . "two")) + 'acons-5 + (setq alist (acons 1 "uno" alist))) +(test '(1 . "uno") + 'assoc-6 + (assoc 1 alist)) + +(test t 'listp-1 (listp nil)) +(test t 'listp-2 (listp (cons 1 2))) +(test nil 'listp-3 (listp t)) + +(test t 'numberp-1 (numberp 12)) +(test t 'numberp-2 (numberp (expt 2 130))) +(test nil 'numberp-3 (numberp nil)) +(test nil 'numberp-4 (numberp (cons 1 2))) + +(test t 'zerop-1 (zerop 0)) +(test nil 'zerop-2 (zerop 1)) +(test t 'zerop-3 (zerop -0.0)) +(test t 'zerop-4 (zerop 0/100)) + +(test nil 'consp-1 (consp nil)) +(test t 'consp-2 (consp (cons 1 2))) + +(test t 'atomp-1 (atom 'sss)) +(test nil 'atomp-2 (atom (cons 1 2))) +(test t 'atomp-3 (atom nil)) +(test t 'atomp-4 (atom '())) +(test t 'atomp-5 (atom 3)) Index: gnu/expr/ChangeLog =================================================================== --- gnu/expr/ChangeLog (revision 7787) +++ gnu/expr/ChangeLog (working copy) @@ -1,3 +1,9 @@ +2014-02-08 Charles Turner + + * Language.java (defProcStFldAs): New method. Intended to be used + to alias names from one language to potentially different names in + another language. + 2013-12-20 Per Bothner * Language.java (defProcStFld): Add overload variant taking Symbol. Index: gnu/expr/Language.java =================================================================== --- gnu/expr/Language.java (revision 7787) +++ gnu/expr/Language.java (working copy) @@ -379,6 +379,17 @@ { defProcStFld(name, cname, mangleNameIfNeeded(name)); } + + /** + * Declare by name in the current environment a procedure bound to a static field. + * + * @param asName The procedure's source-level name. + * @param cname The name of the class containing the field. + * @param mname The name of the (mangled) field in address@hidden cname} + */ + protected void defProcStFldAs(String asName, String cname, String mname) { + defProcStFld(asName, cname, mangleNameIfNeeded(mname)); + } /** Enter a named function into the current environment. */ public final void defineFunction(Named proc)