User Tools


Function CONSTANTLY

Syntax

  • constantly valuefunction

Arguments and Values

Description

constantly returns a function that accepts any number of arguments, that has no side-effects, and that always returns value.

Examples

(mapcar (constantly 3) '(a b c d))

(3 3 3 3)

(defmacro with-vars (vars &body forms) `((lambda ,vars ,@forms) ,@(mapcar (constantly nil]]) vars)))

WITH-VARS

(macroexpand '(with-vars (a b) (setf a 3) (setf b (* a a)) (list a b)))

((LAMBDA (A B) (SETF A 3) (SETF B (* A A)) (LIST A B)) NIL NIL), true

Affected By

None.

Exceptional Situations

None.

See Also

Notes

constantly could be defined by:

(defun constantly (object) #'(lambda (&rest arguments) object))

\issue{FUNCTION-COMPOSITION:JAN89-X3J13}