lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange error from define-syntax


From: David Kastrup
Subject: Re: Strange error from define-syntax
Date: Thu, 28 May 2020 18:53:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

"John Schlomann" <jschlomann@wideopenwest.com> writes:

> Dear Ponders & Schemers,
>
>  
>
> I wanted to try creating a simple Scheme macro. I've never done this before,
> so I may well be going about it all wrong, but the error I get doesn't make
> sense.
>
>  
>
> Here is a minimal non-working example:
>
>  
>
> \version "2.20.0"
>
>      #(use-modules (ice-9 syncase))
>
>  
>
>      #(define-syntax set-default
>
>        (syntax-rules ()
>
>         ((set-default name value)
>
>          (if (eqv? name 'UNDEF) name value)
>
>        )))
>
>  
>
>      #(define some-setting 44)
>
>      #(set-value some-setting 99)
>
>      #(ly:message "some-setting = ~a\n" some-setting)
>
>  
>
> This gives the error:
>
>                 Wrong number of arguments to #<Music function #<procedure #f
> (arg)>>
>
>  
>
> Huh? I also tried define-syntax-rule, which came up unbound. Any insights
> into what I'm doing wrong would be welcome.

syntax-case doesn't work in LilyPond since LilyPond defines \void as a
music function and the Guile 1.8 implementation of syntax-case falls
apart if 'void has a value.

You are not doing anything wrong other than expecting syntax-case to
work.  Stick to macros instead of define-syntax.  Sorry for that.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]