title: Lilypond: How can I map numbers to notes with Scheme
body: <p>I'm trying to create a function where, for an example, <code>\generateNote #3 #4</code> would generate an f4 - this would help to write functions to quickly generate scales etc. </p>
  
  <pre><code>generateNote = 
  #(define-music-function
    (parser location note)
    (number?)
    (define notes 
        '((0 . "c4") 
          (1 . "d4") 
          (2 . "e4") 
          (3 . "f4") 
          (4 . "g4") 
          (5 . "a4") 
          (6 . "b4")))
    #{  #(cdr (assoc (modulo note 7) notes)) #}
    )
  </code></pre>
  
  <p>This does not work because <code>error: music function cannot generate f4</code>. The following, however, does work:</p>
  
  <pre><code>generateF = 
  #(define-music-function
    (parser location)
    #{  f4 #}
    )
  </code></pre>
  
  <p>Any thoughts about why this isn't working?</p>
  
  <p>I already tried swapping the <code>" "</code> with <code>{ }</code> and <code>#{ #}</code> to no avail.</p>