lilypond-user
[Top][All Lists]
Advanced

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

Re: Help with scheme


From: Valentin Petzel
Subject: Re: Help with scheme
Date: Thu, 22 Aug 2024 11:10:57 +0200

Hi Michael,

the problematic line in question is

(#t (define *use-gamba-clefs* #t))

If you use set! instead of define it will work. The problem here lies probably 
in the switch from guile 1.8 to guile 2. I suppose in that the context of case 
changed somehow to not allow definitions.

Keep in mind that define is a bit special in LISP languages. LISP has a strong 
functionals base, and that means that we are in a paradigm where e.g. results 
should not depend on order of execution.

This requires that a value bound by define is immutable. So LISP languages tend 
to be very restrictive of where you can put a define, and usually do not allow 
defining a mapping already bound.

Now, GUILE is much more lenient in that regard, allowing define in places 
scheme would not, and allowing to rebind rather than having to use set!.

But still the general scheme paradigm is: Use define to bind a value once, and 
if that binding needs to change, use set! (also set! can change values in 
different contexts).

Cheers,
Valentin

Am Mittwoch, 21. August 2024, 15:19:31 MESZ schrieb Michael Gerdau:
> Dear lilyponders,
> 
> I've donwloaded some older lilypond sources (version 2.18.2) from
> cpdl.org and am trying to make them work with 2.25.18.
> 
> Most things are straight forward however there is some scheme code that
> allows to switch between different clefs.
> 
> Could someone with better scheme fu than I have tell me how I should
> adjust the code for 2.25.18?
> 
> The error I get is:
> Starte lilypond 2.25.18 [scheme-error.ly]...
> Processing `/home/mgd/lilypond-Noten/scheme-error.ly'
> Parsing...
> /home/mgd/lilypond-Noten/scheme-error.ly:10:2: error: Guile signaled an
> error for the expression beginning here
> #
>   (cond
> Syntax error:
> /home/mgd/lilypond-Noten/scheme-error.ly:10:0: body should end with an
> expression in form (let () (define *use-gamba-clefs* #t))
> fatal error: failed files: "/home/mgd/lilypond-Noten/scheme-error.ly"
> Wurde mit dem Return-Code 1 beendet.
> 
> 
> Trying to make sense of the errormsg I verbatim replaced
>    (#t (define *use-gamba-clefs* #t))
> with
>    (let () (define *use-gamba-clefs* #t))
> but that doesn't work either (the error is different though).
> 
> 
> 
> snip -- snip -- snip -- snip -- snip -- snip -- snip -- snip -- snip
> \version "2.25.18"
> 
> #(define *clefs-option* (ly:get-option 'clefs))
> % #(display "\nDEBUG: *clefs-options* = ") #(display (ly:get-option
> 'clefs)) #(display "\n")
> 
> #(define *use-recorder-clefs* (eq? *clefs-option* 'recorder))
> #(define *use-gamba-clefs*    (eq? *clefs-option* 'gamba))
> #(define *use-original-clefs* (eq? *clefs-option* 'original))
> 
> #(cond
>    (*use-recorder-clefs*  (display "\nUsing recorder clefs.\n"))
>    (*use-gamba-clefs*     (display "\nUsing gamba clefs.\n"))
>    (*use-original-clefs*  (display "\nUsing original clefs.\n"))
>    (#t (define *use-gamba-clefs* #t))
>    )
> 
> insertClef = #(cond
>                 (*use-recorder-clefs*  #{ \clef treble #})
>                 (*use-gamba-clefs*     #{ \clef alto #})
>                 (*use-original-clefs*  #{ \clef mezzosoprano #})
>                 )
> snip -- snip -- snip -- snip -- snip -- snip -- snip -- snip -- snip
> 
> Kind regards,
> Michael

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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