Programming/lisp2013. 1. 16. 22:05
xlisp의 경우 실행파일 위치가 XLPATH 인듯 하고
해당 위치에 자동으로 *.lsp 파일을 읽거나 저장한다.

load a source file
(load <fname> &key :verbose :print)

An implicit errset exists in this function so that if error occurs during loading, and *breakenable* is NIL, then the error message will be printed and NIL will be returned.  The OS environmental variable XLPATH is used as a search path for files in this function.  If the filename does not contain path separators ('/' for UNIX, and either '/' or '\' for MS-DOS) and XLPATH is defined, then each pathname in XLPATH is tried in turn until a matching file is found.  If no file is found, then one last attempt is made in the current directory.  The pathnames are separated by either a space or semicolon, and a trailing path separator character is optional.

<fname> the filename string, symbol, or a file stream created with open. The extension "lsp" is assumed.
:verbose the verbose flag (default is T)
:print the print flag (default is NIL)
returns T if successful, else NIL 

save function to a file
(savefun <fcn>)

defined in init.lsp

<fcn> function name (saves it to file of same name, with extension ".lsp")
returns T if successful  


사용예
> (defun add (a b) (+ a b))
add                        
> (savefun add)            
"ADD.lsp"                   

> (load "add")        
; loading "add.lsp"    
t                      
> (add 2 3)           
5                      
> #'add               
#<Closure-ADD: #9b92b0> 

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

lisp i/o  (0) 2013.01.17
lisp file i/o  (0) 2013.01.17
xlisp  (0) 2013.01.16
lisp 연관리스트  (0) 2013.01.14
lisp의 con cell 과 NIL  (0) 2013.01.14
Posted by 구차니