Common lisp study1 初識lisp

1.install sbcl on freebsd

2.#sbcl

This is SBCL 1.1.8, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.


SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* 10


10
* (+ 2 3)


5

* (format t "hello")
hello
NIL
* (write-line "hello1")
hello1
"hello1"

* (defun hello() (format t "hello format"))//定義hello函數


HELLO
* (hello)                      //調用hello函數輸出
hello format
NIL


//vim study1.lisp加載文件

cat study1.lisp

(defun helloWorld () (format t "Hello world----------!"))

#sbcl

* (load "study1.lisp")


T
* (helloWorld)
Hello world----------!
NIL

* (load (compile-file "study1.lisp"))//快速加載lisp


; compiling file "/usr/home/zxh/work/tools/lisp_study/study1.lisp" (written 19 MAR 2015 06:15:24 PM):
; compiling (DEFUN HELLOWORLD ...)


; /usr/home/zxh/work/tools/lisp_study/study1.fasl written
; compilation finished in 0:00:00.190
T
* (helloWorld)
Hello world----------!
NIL

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章