Added lisp along with some study work
This commit is contained in:
30
lisp/land-of-lisp/ch2/notes.txt
Normal file
30
lisp/land-of-lisp/ch2/notes.txt
Normal file
@ -0,0 +1,30 @@
|
||||
;; List of variables that are surrounded by parens
|
||||
|
||||
(let ((a 5)
|
||||
(b 6))
|
||||
(+ a b))
|
||||
|
||||
;; Local functions
|
||||
;; It's like let. A list of functions and their descriptions,
|
||||
;; followed by some stuff to do with them
|
||||
(flet ((function_name (args)
|
||||
...Function Body...))
|
||||
body)
|
||||
;;example
|
||||
(flet ((f (n)
|
||||
(+ n 10)))
|
||||
(f 5))
|
||||
|
||||
>> 15
|
||||
|
||||
;; labels -- like flet, but allow functions to call other
|
||||
;; defined functions or themselves
|
||||
;; Same basic structure as flet
|
||||
|
||||
(labels ((a (n)
|
||||
(+ n 5))
|
||||
(b (n)
|
||||
(+ (a n) 6)))
|
||||
(b 10))
|
||||
>> 21
|
||||
|
Reference in New Issue
Block a user