CommonLisp Scheme Part13
at TECH
91:83
05/05/21 15:17:48
>>85
なるほどそういう使い方があったのか THX!
すると例えば
(define-syntax define-package
(syntax-rules (export)
((_ pkgname (export id ...) body ...)
(begin (define pkgname (make-hash-table))
(let ()
body ...
(hash-table-put! pkgname 'id id) ...)
(define id (hash-table-get pkgname 'id)) ...))))
とやって
(define-package foo-package
(export foo bar)
(define hoge 9)
(define foo (lambda (x) (- x hoge)))
(define bar (lambda (y) (+ y hoge))))
とすれば
hoge => #unbound
(foo 10) => 1
(bar 10) => 19
となるわけか。
実装に依存したくない時はいいかも!
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5381日前に更新/268 KB
担当:undef