X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/72456c11b77658b7fda800d85709e61830f1ded9..b0d4e74fa7804b812ffb7cb68b0ef6ec4ce9edaf:/src/utilities.lisp diff --git a/src/utilities.lisp b/src/utilities.lisp index bdcdf80..cb6f0cc 100644 --- a/src/utilities.lisp +++ b/src/utilities.lisp @@ -843,7 +843,7 @@ ;;; Functions. (export 'compose) -(defun compose (function &rest more-functions) +(defun compose (&rest functions) "Composition of functions. Functions are applied left-to-right. This is the reverse order of the usual mathematical notation, but I find @@ -854,7 +854,9 @@ (labels ((compose1 (func-a func-b) (lambda (&rest args) (multiple-value-call func-b (apply func-a args))))) - (reduce #'compose1 more-functions :initial-value function))) + (if (null functions) #'values + (reduce #'compose1 (cdr functions) + :initial-value (car functions))))) ;;;-------------------------------------------------------------------------- ;;; Variables.