lilypond-devel
[Top][All Lists]
Advanced

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

Re: Guitar right-hand fingering


From: David Kastrup
Subject: Re: Guitar right-hand fingering
Date: Wed, 18 Mar 2015 09:51:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> 2015-03-17 22:37 GMT+01:00 Carl Sorensen <address@hidden>:

>> On 3/17/15 3:12 PM, "Thomas Morley" <address@hidden> wrote:
>>
>> >  #(vector "p" "i" "m" "a" "c" (markup #:with-color red "remark"))
>>
>> Why use a vector and vector-ref, instead of just using a list and list-ref?
>>
> Well, because define-grob-properties.scm states:
> (digit-names ,vector? "Names for string finger digits.")
>
> Though, I have to confess my lack of knowledge here. Why are certain
> properties vectors (digit-names, break-align-orders, break-visibility etc)?
> What are the advantages/disadvantages?
> I don't know.

Vector elements can be accessed in constant time.  Generally, one uses
lists for material that is usually accessed in sequence, and vectors for
stuff that is accessed by number and in unpredictable order.

It's actually one of the design choices I like for Lua as an extension
language: they have only a single data structure ("table") that works
reasonably efficiently for almost all use cases (well, excepting
frequent single-element insertion/deletion but one can still use an
indirection array to emulate singly-linked lists).  So the question
"what data structure should we represent this data with" never arises.

Similarly, they "intern" all their strings meaning that their address is
always sufficient for equality comparisons.  Basically, they _only_ have
what Scheme calls "symbols" and call it "string".  Again, this avoids
the question "what data type should we represent this textual data
with".

Scheme has quite more data types and data structures, and it would feel
wrong not to choose the most suitable representation for Scheme
programming when deciding what data type to employ.

-- 
David Kastrup



reply via email to

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