X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Flist.lisp;h=35d56716eb6ee4b919fe3d9d9c3413217258309a;hb=b8f63d9b4e978bec3bfc1f4fc471e5ed946781fd;hp=c3812dc5a877d0a1fbcd155f481779221d6db02e;hpb=2abf77f6c4c559a3e5b7fc351a4743305381feb6;p=sbcl.git diff --git a/src/code/list.lisp b/src/code/list.lisp index c3812dc..35d5671 100644 --- a/src/code/list.lisp +++ b/src/code/list.lisp @@ -499,27 +499,16 @@ (arg0-p (funcall function arg0)) (t (funcall function)))))) -(defun constantly (value &optional (val1 nil val1-p) (val2 nil val2-p) - &rest more-values) - #!+sb-doc - "Builds a function that always returns VALUE, and possibly MORE-VALUES." - (cond (more-values - (let ((list (list* value val1 val2 more-values))) - (lambda () - (declare (optimize-interface (speed 3) (safety 0))) - (values-list list)))) - (val2-p - (lambda () - (declare (optimize-interface (speed 3) (safety 0))) - (values value val1 val2))) - (val1-p - (lambda () - (declare (optimize-interface (speed 3) (safety 0))) - (values value val1))) - (t - (lambda () - (declare (optimize-interface (speed 3) (safety 0))) - value)))) +(defun constantly (value) + #!+sb-doc + "Return a function that always returns VALUE." + (lambda () + ;; KLUDGE: This declaration is a hack to make the closure ignore + ;; all its arguments without consing a &REST list or anything. + ;; Perhaps once DYNAMIC-EXTENT is implemented we won't need to + ;; screw around with this kind of thing. + (declare (optimize-interface (speed 3) (safety 0))) + value)) ;;;; macros for (&KEY (KEY #'IDENTITY) (TEST #'EQL TESTP) (TEST-NOT NIL NOTP))