User Tools

Site Tools


ch2_1_lambda

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ch2_1_lambda [2022/02/23 06:45] adminch2_1_lambda [2022/03/31 05:07] (current) admin
Line 4: Line 4:
  
 <code lisp> <code lisp>
->((lambda (a b) (+ a b)) 3 5)   ; unnamed function for adding 2 numbers+>(lambda (a b) (+ a b))   ; lambda call 
 +#<user-defined lambda>    ; function object was returned                 
 +</code> 
 + 
 +The ''LAMBDA'' form can be used in place of the operator. 
 + 
 +<code lisp> 
 +>((lambda (a b) (+ a b)) 3 5)   ; defined the lambda and immediately used on 3 5
 8                 8                
 </code>  </code> 
Line 25: Line 32:
 </code> </code>
  
-The functions created by ''LAMBDA'' have lexical closure just like named functions. +Parameter list of ''LAMBDA'' can have ''&OPTIONAL'' and ''&REST'' parameters just like the named functions (see ''DEFUN''). 
 + 
 +The functions created by ''LAMBDA'' have lexical closure also like the named functions. 
  
  
ch2_1_lambda.1645623933.txt.gz · Last modified: 2022/02/23 06:45 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki