This file contains hidden or 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
#!/usr/bin/env bash | |
mzscheme slisp.ss |
This file contains hidden or 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
#!/usr/bin/env bash | |
mzscheme slisp.ss |
This file contains hidden or 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
#!/usr/bin/env bash | |
mzscheme slisp.ss |
This file contains hidden or 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
gosh> (define (memoize fn) | |
(let ((cache (make-hash-table 'equal?))) | |
(lambda args | |
(let ((val (hash-table-get cache args #f))) | |
(if val val | |
(hash-table-put! cache args (apply fn args))))))) | |
memoize | |
gosh> (define (fib n) | |
(if (< n 2) | |
1 |
This file contains hidden or 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
(do (( <<変数1>> <<初期値1>> <<ステップ1>>) | |
... | |
( <<変数m>> <<初期値m>> <<ステップm>>)) | |
(<<終了条件>> <<式>>...<<式>>) | |
<<式1>> | |
... | |
<<式n>>) |
This file contains hidden or 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
CL-USER> (let ((var0 0)) | |
(my-while%% (< var0 10) | |
(print var0) | |
(incf var0))) | |
; in: LAMBDA NIL | |
; (LET ((VAR0 0)) | |
; (MY-WHILE%% (< VAR0 10) (PRINT VAR0) (INCF VAR0))) | |
; | |
; caught STYLE-WARNING: | |
; The variable VAR0 is defined but never used. |
This file contains hidden or 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
;; bang-lisp is a subset of Common Lisp implementation, | |
;; based on the textbook, "対話によるCommon Lisp入門", | |
;; published from 森北出版株式会社. | |
;; # ISBN-10: 4627836090 | |
;; # ISBN-13: 978-4627836099 | |
;; Additionally, some library functions are imported from | |
;; Appendix B of Paul Graham's "ANSI Common Lisp". | |
;; # ISBN-10: 4894714337 | |
;; # ISBN-13: 978-4894714335 | |
;; Originally, "対話によるCommon Lisp入門" suggests to use |
This file contains hidden or 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
(define-syntax do!* | |
(syntax-rules () | |
((_ ((var init step) | |
...) | |
(pred e ...) | |
body ...) | |
(let ((tag #f)) | |
(let* ((var init) ...) | |
(call/cc | |
(lambda (cc) |
This file contains hidden or 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 random-fancy-splash (folder-name) | |
(let ((lst (cddr (directory-files folder-name)))) | |
(let ((i 0) (n (length lst)) (h (make-hash-table))) | |
(mapcar #'(lambda (val) | |
(puthash i val h) | |
(incf i)) lst) | |
(setq fancy-splash-image (concat folder-name (gethash (random n) h)))))) |
This file contains hidden or 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
;; 前向き推論はつぎの3つのステップの繰り返しによって実現される | |
;; Step1 照合(パターンマッチング) | |
;; ルールベースの中のすべてのプロダクションルールの条件部とワー | |
;; キングメモリーの内容とを照合し、実行可能なルールの集まり | |
;; を探す。実行可能なルールがなければ終了する。 | |
;; Step2 競合の解消 | |
;; 実行可能なルールの集まりの中から実際に実行するルールを1 | |
;; つ選択する。以下の例ではユーザーがこれを行う。 | |
;; Step3 動作 |