[5]> (ed "hoge.l") Waiting for Emacs...
とやると、emacs、というかエディタが起動する。
quickrun.elで開発効率アップ - Life is very short
(setf x 'hoge) (print x) (setf x '(1 2)) (print x)
と書いて、quickrunを実行すると…
HOGE (1 2)
ひゃあああうまひいいい
[5]> (ed "hoge.l") Waiting for Emacs...
とやると、emacs、というかエディタが起動する。
quickrun.elで開発効率アップ - Life is very short
(setf x 'hoge) (print x) (setf x '(1 2)) (print x)
と書いて、quickrunを実行すると…
HOGE (1 2)
ひゃあああうまひいいい
前回のやつで、
edでエディタを開くという話だったけども、
"Waiting for Emacs..."をやめるには、
そのバッファを消すか、Emacsを終了させるかすればいい。
[5]> (ed "hoge.l") Waiting for Emacs... NIL
作ったファイルを読み込むことも出来るお。
[6]> (load "hoge") *** - LOAD: A file with name hoge does not exist The following restarts are available: ABORT :R1 Abort main loop Break 1 [7]> :a [8]> (load "hoge.l") ;; Loading file hoge.l ... HOGE (1 2) ;; Loaded file hoge.l T
homebrewでclispを入れるのをやってみた。
$ cvs -d :pserver:anonymous:anonymous@common-lisp.net:/project/slime/cvsroot co slime
ダウンロードしたファイルを/Applicationsディレクトリにコピー。
そして以下を.emacsに記述。
;; slime (setq inferior-lisp-program "/usr/local/bin/clisp") (add-to-list 'load-path "/Applications/slime") (require 'slime) (slime-setup)
Emacs再起動→ M-x slimeで新しい世界が開けると思うよ?
SLIME: The Superior Lisp Interaction Mode for Emacs
Mac OS XでCommon Lispの実行環境を作る(CLISP + Carbon Emacs + SLIME) - qnzm.log(クニジマログ)
(defun factorial (n) (if (= n 0) 1 (* (factorial (- n 1)) n))) ;; (factorial 3) ;; = (* (* (* (factorial 0) n1) n2) n3) ;; = (* (* (* 1 n1) n2) n3) ;; = (* (* (* 1 1) n2) n3) ;; = (* (* 1 2) n3) ;; = (* 2 3) ;; 6 ;; [6]> (trace factorial) ;; ;; Tracing function FACTORIAL. ;; (FACTORIAL) ;; [7]> (factorial 3) ;; 1. Trace: (FACTORIAL '3) ;; 2. Trace: (FACTORIAL '2) ;; 3. Trace: (FACTORIAL '1) ;; 4. Trace: (FACTORIAL '0) ;; 4. Trace: FACTORIAL ==> 1 ;; 3. Trace: FACTORIAL ==> 1 ;; 2. Trace: FACTORIAL ==> 2 ;; 1. Trace: FACTORIAL ==> 6 ;; 6
なお、上の例だと、n=0のケースが歯止めとなっており、これ以上再帰させないための条件を境界条件という。