lilypond-devel
[Top][All Lists]
Advanced

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

Re: banter-style from chord-names-jazz.ly broken, 'case'-problem


From: David Kastrup
Subject: Re: banter-style from chord-names-jazz.ly broken, 'case'-problem
Date: Wed, 08 Apr 2015 12:04:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> 2015-04-08 11:45 GMT+02:00 Thomas Morley <address@hidden>:
>
>> I started to rewrite chord-namings and stumbled over a problem in
>> chord-generic-names.ly
>>
>> /Documentation/included/chord-names-jazz.ly with uncommented
>> Banter-style is broken.
>> At least since 2.12.3
>>
>> The problem is in 'step->markup-plusminus'
>>
>> Here you see the old code commented and a possible patch inserted:
>>
>>   (define (step->markup-plusminus pitch)
>>     (make-line-markup
>>      (list
>>       (make-simple-markup (number->string (step-nr pitch)))
>>       (make-simple-markup
>>        ;(case (step-alteration pitch)
>>        ;  ((DOUBLE-FLAT) "--")
>>        ;  ((FLAT) "-")
>>        ;  ((NATURAL) "")
>>        ;  ((SHARP) "+")
>>        ;  ((DOUBLE-SHARP) "++"))
>>        (case (step-alteration pitch)
>>          ((-1) "--")
>>          ((-1/2) "-")
>>          ((0) "")
>>          ((1/2) "+")
>>          ((1) "++"))
>>        ))))
>>
>> case uses eqv? to compare. (guile-manual)
>> (step-alteration pitch) returns: -1 or -1/2 or 0 or 1/2 or 1
>> (display (eqv? -1/2 FLAT), etc returns #t
>
> boiled down:
>
> (display DOUBLE-FLAT)
> -> -1
>
> (display (eqv? -1 DOUBLE-FLAT))
> -> #t
>
> (display
>  (case -1
>    ((DOUBLE-FLAT) "--")
>    ((FLAT) "-")
>    ((NATURAL) "")
>    ((SHARP) "+")
>    ((DOUBLE-SHARP) "++")))
> -> #<unspecified>
>
> ??
>
>> Thus I've no clue why the old code fails.
>> Any hint?

That one's easy.  As may be expected from the case-tag being in the form
of an unquoted list, there is no evaluation involved.

So the case statement is comparing to the symbols DOUBLE-FLAT, FLAT, etc
as opposed to the values stored in the variables associated with the
symbols.

It would probably make more sense to define an association list for this
lookup, or convert into a cond.

-- 
David Kastrup



reply via email to

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