[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unhandled constant?
From: |
Ricardo Wurmus |
Subject: |
Re: unhandled constant? |
Date: |
Wed, 29 Jan 2020 16:06:23 +0100 |
User-agent: |
mu4e 1.2.0; emacs 26.3 |
Han-Wen Nienhuys <address@hidden> writes:
> Some of the lilypond Scheme files do the following:
>
>
> (define decl '())
> (define (make-var n v) (list "var" n v))
> (defmacro define-session (name value)
> (define (inner n v)
> (set! decl
> (cons
> (make-var n v)
> decl))
> )
> `(,inner ',name ,value))
> (define-session foo 1)
> (display decl)
> (newline)
>
> In GUILE 2.2, this yields
>
> ;;; WARNING: compilation of /home/hanwen/vc/lilypond/q.scm failed:
> ;;; unhandled constant #<procedure inner (a b)>
>
> What does this error message mean, and what should I do to address the
> problem?
Would it be feasible to use define-syntax-rule here?
--8<---------------cut here---------------start------------->8---
(define decl '())
(define (make-var n v) (list "var" n v))
(define-syntax-rule (define-session name value)
(let ((inner (lambda (n v)
(set! decl
(cons
(make-var n v)
decl)))))
(inner 'name value)))
(define-session foo 1)
(display decl)
(newline)
--8<---------------cut here---------------end--------------->8---
--
Ricardo