A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.lispworks.com/documentation/lw71/CLHS/Body/f_cons_1.htm below:

CLHS: Function CONSTANTLY

Function CONSTANTLY

Syntax:

constantly value => function

Arguments and Values:

value---an object.

function---a function.

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) (setq a 3 b (* a a)) (list a b)))
=>  ((LAMBDA (A B) (SETQ A 3 B (* A A)) (LIST A B)) NIL NIL), true

Affected By: None.

Exceptional Situations: None.

See Also:

identity

Notes:

constantly could be defined by:

 (defun constantly (object)
   #'(lambda (&rest arguments) object))
The following X3J13 cleanup issue, not part of the specification, applies to this section:
Copyright 1996-2005, LispWorks Ltd. All rights reserved.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4