Skip to content

Instantly share code, notes, and snippets.

@shirok
Created July 22, 2014 07:59
Show Gist options
  • Save shirok/8b4c98b1222083ddc3c3 to your computer and use it in GitHub Desktop.
Save shirok/8b4c98b1222083ddc3c3 to your computer and use it in GitHub Desktop.
;; モジュールgauche.baseがr7rsを読まないと定義されないので、読んどく (次のバージョンで直す)
(require "r7rs")
;; gauche.baseから不要なもの以外をインポート
(import (gauche.base :except (quote)))
;; 継承を切る
(extend)
;; define => #<syntax define>
;; quote => ;ERROR
@k16shikano
Copy link

伝統的マクロで引っかかってしまうみたいです。。

gosh> (define-macro (test a) `(define (,a) 0))
#<undef>
gosh> (test b)
b
gosh> (b)
0
gosh> (require "r7rs")
#<undef>
gosh> (import (gauche.base :except (quote)))
#<undef>
gosh> (extend)
#<undef>
gosh> (define-macro (test a) `(define (,a) 0))
*** ERROR: Compile Error: Compile Error: syntax-error: the form can appear only in the toplevel: (define ((unquote a)) 0)

"(standard input)":7:(define-macro (test a) `(define (,a) 0))

Stack Trace:
_______________________________________
  0  (eval expr env)
        At line 179 of "/usr/local/share/gauche-0.9/0.9.4/lib/gauche/interactive.scm"
gosh>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment