このサイトを参考に進める. [https://www.tohoho-web.com/ex/lisp.html#about]
SBCLを利用する. Ubuntu環境にインストールする.
$ sudo apt install -y wget bzip2 make
$ wget http://prdownloads.sourceforge.net/sbcl/sbcl-2.5.1-x86-64-linux-binary.tar.bz2
$ bzip2 -cd sbcl-2.5.1-x86-64-linux-binary.tar.bz2 | tar xvf -
$ cd sbcl-2.5.1-x86-64-linux
$ sudo sh install.sh
sbcl --version- 起動
SBCL- REPL (Read-Eval-Print Loop)を起動すると,コマンドラインで「*」がつく.
- 終了
(quit)- あるいはCtrl-D
- ファイルの実行
sbcl --script ファイル
SBCL から*.lispを*.faslファイルにコンパイルすることで実行を高速化することができます.
$ sbcl
* (compile-file "./hello.lisp")
* (quit)
$ chmod 755 ./hello.fasl
$ ./hello.fasl
Hello world!$ sbcl --noinform --no-sysinit --no-userinit --load hello.lisp
$ ./hello
hello world!- 1行コメント
;から行末
- 複数行コメント
#|から|#まで
(write-line "ABC") ; 式 '(1 2 3) ; リスト、シングルクウォーテーション "ABC" ; 文字列 12.3 ; 数値