lilypond-devel
[Top][All Lists]
Advanced

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

Re: accidentals 1.5.25.rz1


From: Rune Zedeler
Subject: Re: accidentals 1.5.25.rz1
Date: Thu, 13 Dec 2001 16:43:11 +0100

Den 13-Dec-01 skrev Han-Wen Nienhuys:

HN>> +texidoc="
HN>> +This shows how accidentals in different octaves are handled.
HN>> +"
HN> 
HN> The regression test texts should explain what the
HN> correct result should look like, so you could tell something is wrong
HN> by comparing the examples and texts. This doesn't really tell anything.

Hm, I think the most important thing is that we have examples covering all the
special cases - so that one can actually see a bug if he knows how the result
sohuld look. There are SO MANY special cases that the examples has to be so
big if they should all be covered...
But well, okay. I'll add some descibtion later. (soon).
I just put some stuff in the regression test as examples because I was unable
to build the real docu. (I can build it /now/, more or less, though)

HN>> +/* looks the key up in the cdrs of the alist-keys
HN>> +   - ignoring the car and ignoring non-pair keys.
HN>> +   Returns first match found. */
HN>> +SCM
HN>> +ly_assoc_cdr (SCM key, SCM alist)
HN>> +{
HN>> +  if (gh_pair_p (alist)) {
HN>> +    SCM trykey = ly_caar(alist);
HN>> +    if(gh_pair_p(trykey) && to_boolean(scm_equal_p(key,ly_cdr(trykey))))
HN>> +      return ly_car(alist);
HN>> +    else
HN>> +      return ly_assoc_cdr (key, ly_cdr (alist));
HN>> +  }
HN>>   else
HN> 
HN> I still don't understand. Why don't you simply use
HN> 
HN> SCM f = scm_assoc (key, alist);
HN> return ly_pair_p (f) ? ly_cdr(f) : SCM_BOOL_F;

That doesn't do the same thing. I want to be able to find the first key with a
given cdr (that is: a given pitch in any octave).

I.e. with alist = ((1 . 10)
                   ((1 . 2) . 11)
                   ((2 . 1) . 12)
                   ((3 . 0) . 13)
                   ((4 . 1) . 14) )

I would like (assoc_cdr 1) to return 12 - because it's the first element with
the cdr of the key = 1.
In other words (alloc_cdr key) corresponds to call

(alloc (anything . key))

but scm has afaik no "joker-values" being equal to anything - so I had to do
it my self.


-Rune




reply via email to

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