[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Difference between list and cons*
From: |
David Kastrup |
Subject: |
Re: Difference between list and cons* |
Date: |
Sat, 10 Mar 2012 20:09:11 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
David Kastrup <address@hidden> writes:
> Carl Sorensen <address@hidden> writes:
>
>> David,
>>
>> I noticed that in a recent patch you changed from constructing property
>> lists with list to using cons*.
>>
>> I'm not questioning your decision. However, I'd like to gain some
>> understanding. Why was it necessary (or at least desirable) to make the
>> change? As far as I understand, the difference between list and cons* is
>> that list puts '() at the tail of the list, while cons* puts the last
>> argument at the tail of the list.
>
> And that's exactly what this change was about. In this particular case,
> I had constructed a list where the last element was property-path (or
> something like it). But the actual form of the entry used elsewhere was
> such that the _tail_ of the list represented property-path, not the last
> element. While I was trying out something else, some parts of LilyPond
> (I think the documentation formatter) blew up around me because I had
> missed that difference.
>
>> Any light you could shed on this would be helpful to me.
>
> Does the above help?
Just reread this, and noticed you were talking about "property lists"
here. There are no property lists here. Context mods have a structure
that starts with a key symbol in the car, and the data following
afterwards. If you take a look at where they get interpreted, you'll
see in context-property.cc stuff like
if (type == ly_symbol2scm ("push"))
{
SCM val = scm_cadr (entry);
SCM grob_prop_path = scm_cddr (entry);
sloppy_general_pushpop_property (tg, context_prop, grob_prop_path,
val);
}
Now you see that we are referencing scm_cadr (entry) and scm_cddr
(entry) here for value and property-path, respectively. If
property-path were the last _element_ of the list, it would be at
scm_caddr (entry), with scm_cdddr (entry) being '().
--
David Kastrup