[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to include a file/definition temporarily?
From: |
David Kastrup |
Subject: |
Re: How to include a file/definition temporarily? |
Date: |
Mon, 20 Sep 2010 11:54:35 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
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.
> 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
b) allow an entry 'parent in fret-board-table that will cause the
specified table to be searched (recursively) when the original table
did not deliver an appropriate key/value pair.
--
David Kastrup