comparison tests/automated/lisp-tests.el @ 5550:b908c7265a2b

Add the #'apply-partially API, as used by GNU. lisp/ChangeLog addition: 2011-08-12 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el: * cl-macs.el (apply-partially): New compiler macro. * subr.el: * subr.el (apply-partially): New. Sync this function's API and docstring from GNU. The implementation is mine and trivial; the compiler macro in cl-macs.el ensures that partially-applied functions in compiled code are also compiled. tests/ChangeLog addition: 2011-08-12 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Trivial tests of #'apply-partially, just added to subr.el.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 12 Aug 2011 16:02:30 +0100
parents f2881cb841b4
children 62edcc6a11ec
comparison
equal deleted inserted replaced
5549:493c487cbc3f 5550:b908c7265a2b
2924 (,third [third expansion])) 2924 (,third [third expansion]))
2925 (list ,symbol ,copy-symbol ,third))))) 2925 (list ,symbol ,copy-symbol ,third)))))
2926 (Assert (equal '([symbol expansion] [copy expansion] [third expansion]) 2926 (Assert (equal '([symbol expansion] [copy expansion] [third expansion])
2927 (test-symbol-macrolet)))) 2927 (test-symbol-macrolet))))
2928 2928
2929 ;; Basic tests of #'apply-partially.
2930 (let* ((four 4)
2931 (times-four (apply-partially '* four))
2932 (plus-twelve (apply-partially '+ 6 (* 3 2))))
2933 (Assert (eql (funcall times-four 6) 24))
2934 (Assert (eql (funcall times-four 4 4) 64))
2935 (Assert (eql (funcall plus-twelve (funcall times-four 4) 4 4) 36))
2936 (Check-Error wrong-number-of-arguments (apply-partially)))
2937
2929 ;;; end of lisp-tests.el 2938 ;;; end of lisp-tests.el