Skip to content

Instantly share code, notes, and snippets.

;;;; ルールベースの表現
;; ・もし、積木 x の上に何もないならば、x をテーブルの上に置く。こ
;; れを (on x table) と表現する。
;; ・もし、積木 x と y の上に何もないならば、 x を y の上に積む。こ
;; れを (on x y) と表現する。
(define *rule-base*
'((rule1 (clear a) --> (on a table))
(rule2 (clear b) --> (on b table))
;;;; ルールベースの表現
(define *rule-base*
'((rule1 (and (USA) (English)) --> (Honolulu))
(rule2 (and (Europe) (France)) --> (Paris))
(rule3 (and (USA) (Continent)) --> (LosAngels))
(rule4 (and (Island) (Equator)) --> (Honolulu))
(rule5 (and (Asia) (Equator)) --> (Singapore))
(rule6 (and (Island) (Micronesia)) --> (Guam))
(rule7 (Swimming) --> (Equator))))
(define-syntax bind-variables
(syntax-rules ()
((_ () form ...)
(begin form ...))
;; ここはオリジナルの syntax-error がどんな挙動か分からないので割愛
;; error で置き換えてみたが、本体に form ... が無い、と怒られた
;; ((_ ((var val0 val1 ...) ...) form ...)
;; (error "bind-variables illegal binding" (var val0 val1 ...)))
((_ ((var val) more-bindings ...) form ...)
(let ((var val)) (bind-variables (more-bindings ...) form ...)))
(define (script-fu-all-inputs-box
image drawable layer channel vectors color
toggle value string filename dirname
adjustment0 adjustment1 font pattern brush
gradient option palette text enum display)
;; (gimp-message "This is the input box test script!")
(gimp-message (string-append
"Image is " (number->string image) "\n"
"Drawable is " (number->string drawable) "\n"
;;=======================================================================
;; map-dir-list-into-load-path の定義
;;=======================================================================
;; rubikitch さん作のユーティリティ
;; http://d.hatena.ne.jp/rubikitch/20090609/1244484272
(defun add-to-load-path-recompile (dir)
(add-to-list 'load-path dir)
(let (save-abbrevs) (byte-recompile-directory dir)))
(defun map-dir-list-into-load-path (dir-lst)
(define (breadth-first-search n)
(let search ((lst (node-expand n '())) (solution '()))
(if (null? lst)
solution
(let ((x (car lst)) (y (cdr lst)))
(search (if (and (safe? x) (not (goal? x n)))
(append y (node-expand n x))
y)
(if (and (safe? x) (goal? x n))
(cons x solution)
;;;; ネットワーク構造の生成
(define Mary (make-hasheq))
(define John (make-hasheq))
(define Herb (make-hasheq))
(define Al (make-hasheq))
;;;; 次の事実をコード化する
;;;; ・ John は Mary の夫である
;;;; ・ Mary は John の妻である
;;; 家系図を構成する人達
(define Harry (make-hasheq))
(define Jane (make-hasheq))
(define Joe (make-hasheq))
(define Diane (make-hasheq))
(define Bill (make-hasheq))
(define Julia (make-hasheq))
(define Frank (make-hasheq))
(define Anne (make-hasheq))
(require mzlib/compat)
;;; (pairlis x y a)
;;; This procedure gives a key and value, corresponding elements of the lists x and
;;; y, and appends this to the hash table a.
;; ;; example
;; > (define *a* (make-hasheq))
;; > (hash-set! *a* 'd 'x)
;; > (hash-set! *a* 'e 'y)
/* XPM */
static char * img14_xpm[] = {
"270 152 17411 3",
" c #B4B5AE",
". c #FFFFFF",
"+ c #FFFFFE",
"@ c #FDFDFB",
"# c #F8F6F2",
"$ c #F7F2EE",
"% c #F6F0ED",