Skip to content

noRan3k0/learnLisp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lisp用のDoc

このサイトを参考に進める. [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 ファイル

FASLファイル

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行コメント
    • ;から行末
  • 複数行コメント
    • #|から|#まで

S式

(write-line "ABC") ; 式 '(1 2 3) ; リスト、シングルクウォーテーション "ABC" ; 文字列 12.3 ; 数値

About

Lisp学習用。

Resources

Stars

Watchers

Forks

Contributors