lilypond-user
[Top][All Lists]
Advanced

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

Re: How to include a file/definition temporarily?


From: Carl Sorensen
Subject: Re: How to include a file/definition temporarily?
Date: Mon, 20 Sep 2010 12:07:48 -0600



On 9/20/10 3:54 AM, "David Kastrup" <address@hidden> wrote:

> Carl Sorensen <address@hidden> writes:
> 
>> This is a good thought as a temporary workaround.  However, it won't work
>> as-is, because fretboard-table is a hash table.  We'd need to define a
>> hash-table copy function:
>> 
>> (define (hash-table-copy my-table)
>>   (let ((new-hash-table (make-hash-table 100)))
>>     (hash-for-each (lambda (key value)
>>                      (hash-set! new-hash-table key value))
>>                    my-table)
>>      new-hash-table))
>     (hash-fold
>       (lambda (key value tab)
>         (hash-set! tab key value))
>       (make-hash-table 101)
>       my-table))
> 
> Does not require a closure.  And the size argument is recommended to be
> prime.  Which 100 is not exactly.

Thanks.  I looked at hash-fold, and thought about how it could work, but the
description in the Guile docs (which was a bit cryptic) didn't help me find
this solution.

The idea that the size should be prime was not included in the Guile 1.8
docs, so thanks for informing me of that.

> 
>> cShape and aShape would then be defined as void music functions, which is
>> not shown in David's code above.
> 
>> This is still only a temporary workaround, I think, because we should avoid
>> the hard-coded fretboard-table.
> 
> Things would be better if we had either
> a) fret-board-table be (optionally?) a list of hashtables

Actually, fret-board-table is the table into which things are stored.  It
needs to be a specific table.

The property predefinedDiagramTable determines which table is searched.  It
could potentially be a list of hashtables to be searched in order.  When I
look into the modifications I hope to make this week, I'll consider that as
a possibility.

Thanks again for the ideas.

Carl




reply via email to

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