View sample-001-helloworld.lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(format t "hello, world~%") |
View helper-001
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sbcl |
View sample-002-swank.vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"SBCLの例です | |
let g:slimv_python = '/usr/bin/python' | |
let g:slimv_swank_cmd = '! xterm -e sbcl --load /usr/share/common-lisp/source/slime/start-swank.lisp &' |
View simlpe-read-macro.lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Lisp のリーダは括弧の始まりを読むと閉じ括弧までを読む | |
;; ( から ) まで | |
;; 今それと同じ機能を [] にも 持たせる | |
;; まず閉じる目印になる括弧を設定 | |
;; こいつは ) と同じ機能 | |
(set-macro-character #\] (get-macro-character #\))) | |
;; 開き括弧に会ったら、閉じ括弧まで読む | |
(set-macro-character #\[ | |
(lambda (stream char) |
View listi.lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun append-1 (val var) (append var (list val))) | |
(defmacro collect (constructor &rest def) | |
(let ((result (gensym)) | |
(syms (loop for i from 1 upto (1- (length def)) collect (gensym)))) | |
`(let ((,result nil)) | |
(progn | |
,(labels | |
((main (constr def syms) |
View lct.lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(print [x | x <- '(1 2 3)]) | |
(print [(cons x y) | x <- '(1 2 3) y <- '(2 3) ]) | |
(print [(funcall f x) | f <- '(sin cos tan) x <- '(1 2 3 4 5) (evenp x)]) | |
(print [(* x y) | (x y) <- '((1 2) (3 4) (5 6))]) | |
(ql:quickload :alexandria) | |
(use-package :alexandria) |
View sample-003-script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ clisp file.lisp | |
$ sbcl --script file.lisp |
View sample-004-qlisp.lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(load "quicklisp.lisp") | |
(quicklisp-quickstart:install) ;; quicklispのインストール | |
(ql:add-to-init-file) ;; REPL起動時にQuicklispが読み込まれるように初期化ファイルに書き込む処理 | |
(ql:system-apropos "match") ;; ライブラリを探してみる | |
(ql:quickload :cl-match) ;; ライブラリをロードしてみる |
View sample-005-arith.lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(+ 1 2 3) ;; 1 + 2 + 3 = 6 | |
(+ 1 2 (* 3 4) (/ 6 3)) ;; 1 + 2 + 3 * 4 + 6/3 = 17 | |
(1+ (- 7 4)) ;; 4 |
View sample-006-option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sbcl [runtime option] --end-runtime-options [toplevel option] --end-toplevel-options [user option] |
OlderNewer