# Differences

This shows you the differences between two versions of the page.

 cl:functions:constantly [2019/07/14 17:00] cl:functions:constantly [2019/10/17 13:00] (current) Line 1: Line 1: + ====== Function CONSTANTLY ====== + + ====Syntax==== + * **constantly** //value// → //​function//​ + + ====Arguments and Values==== + * //value// - an //​[[CL:​Glossary:​object]]//​. + * //​function//​ - a //​[[CL:​Glossary:​function]]//​. + + ====Description==== + **constantly** returns a //​[[CL:​Glossary:​function]]//​ that accepts any number of arguments, that has no side-effects,​ and that always returns //value//. + + ====Examples==== + <​blockquote>​ + ([[CL:​Functions:​mapcar]] (constantly 3) '(a b c d)) (3 3 3 3)​ + ([[CL:​Macros:​defmacro]] with-vars (vars &body forms) ​ + `(([[CL:​Macros:​lambda]] ,vars ,@forms) ,​@([[CL:​Functions:​mapcar]] (constantly [[CL:​Constant Variables:​[[CL:​Constant Variables:​nil]]]]) vars))) <​r>​WITH-VARS​ + ([[CL:​Functions:​macroexpand]] ​ + '​(with-vars (a b) + ​([[CL:​Macros:​setf]] a 3) + ​([[CL:​Macros:​setf]] b ([[CL:​Functions:​math-multiply|*]] a a)) + ​([[CL:​Functions:​list]] a b))) + <​r>​(([[CL:​Macros:​lambda|LAMBDA]] (A B) (SETF A 3) (SETF B ([[CL:​Functions:​math-multiply|*]] A A)) ([[CL:​Functions:​list|LIST]] A B)) NIL NIL), //​[[CL:​Glossary:​true]]//​ + ​ + + ====Affected By==== + None. + + ====Exceptional Situations==== + None. + + ====See Also==== + * **[[CL:​Functions:​identity|Function IDENTITY]]** + + ====Notes==== + **constantly** could be defined by: + + <​blockquote> ​ + ([[CL:​Macros:​defun]] constantly (object) #'​([[CL:​Symbols:​lambda]] (&rest arguments) object)) + ​ + + \issue{FUNCTION-COMPOSITION:​JAN89-X3J13}