LAMBDA(3cl)

Common Lisp Reference

LAMBDA(3cl)

 

NAME

lambda – description of function, shorthand for function form (symbol and macro)

SYNOPSIS


; as a symbol:
lambda lambda-list [[ { declaration }* | documentation ]] { form }*

; as a macro:
lambda lambda-list [[ { declaration }* | documentation ]] { form }*

function
 

DESCRIPTION

lambda is both a symbol and a macro.

As a symbol, lambda begins a lambda expression, which is a list that can be used in place of a function name in certain contexts to denote a function by directly describing its behavior rather than indirectly by referring to the name of an established function. documentation is attached to the denoted function (if any is actually created) as a documentation string.

As a macro, lambda provides a shorthand notation for a function special form involving a lambda expression such that:

( lambda lambda-list [[ { declaration }* | documentation ]]
    
{ form }* )
( function ( lambda lambda-list
    
[[ { declaration }* | documentation ]] { form }* ))
#’( lambda lambda-list
    
[[ { declaration }* | documentation ]] { form }* )

 

NOTES

  1. The lambda form
        ((lambda lambda-list . body ) . arguments )
    is semantically equivalent to the function form
        (funcall #’(lambda lambda-list . body ) . arguments )

  2. The lambda macro could be implemented by:
       (defmacro lambda (&whole form &rest bvl-decls-and-body)
           
    (declare (ignore bvl-decls-and-body))
           
    ‘#’,form)    

EXAMPLES

( funcall ( lambda ( x ) (+ x 3 )) 4 ) 7

SEE ALSO

function(3cl) , documentation(3cl)

AUTHOR and COPYRIGHT

Substantial portions of this page are taken from draft proposed American National Standard for Information Systems—Programming Language—Common Lisp, X3J13/94-101R, Version 15.17R, Fri 12-Aug-1994 6:35pm EDT; no copyright indicated.

Additional clarification and comments by Michael Marking <marking@tatanka.com>, http://www.tatanka.com/software/cl-manpages/; alternatively, https://github.com/wakinyantanka/cl-manpages/. Copyright 2017 Michael Marking as both an original and a derivative work.

Licensed under Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0).

This page last revised Sunday 26 February 2017.