Programming/lisp2012. 12. 29. 13:02
xlisp 도움말 발췌

Symbol Functions


set the global value of a symbol
(set <sym> <expr>)
You can also use (setf (symbol-value <sym>) <expr>)
<sym> the symbol being set
<expr> the new value
returns the new value


set the value of a symbol
(setq [<sym> <expr>]...)
fsubr. You can also use (setf <sym> <expr>)
<sym> the symbol being set (quoted)
<expr> the new value
returns the last new value or NIL if no arguments
 

define a function
(defun <sym> <fargs> <expr>...)
define a macro
(defmacro <sym> <fargs> <expr>...)
fsubr
<sym> symbol being defined (quoted)
<fargs> formal argument list (lambda list) (quoted)
<expr> expressions constituting the body of the function (quoted)
returns the function symbol


---
> (defun prt () '(be))                    
prt                                       
> prt                                     
error: unbound variable - prt             
if continued: try evaluating symbol again 
1> (prt)                                  
(be)                                      
 
1> (defun add (a b) (+ a b))             
add                                      
1> ( add 2 4)                            
6                                        
1> add                                   
error: unbound variable - add            
if continued: try evaluating symbol again
2> (add)                                 
error: too few arguments                 

'Programming > lisp' 카테고리의 다른 글

lisp 반복문  (0) 2012.12.31
clisp  (0) 2012.12.29
xlisp-plus 3.05  (0) 2012.12.29
lisp vector  (0) 2012.12.14
lisp atom  (0) 2012.12.11
Posted by 구차니