]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 2978: Simplify calculation of pitch-alist in determine-frets-and-strings
authorDavid Kastrup <dak@gnu.org>
Sat, 24 Nov 2012 22:27:33 +0000 (23:27 +0100)
committerDavid Kastrup <dak@gnu.org>
Fri, 30 Nov 2012 12:37:45 +0000 (13:37 +0100)
The old code was contorted and undefined (it used map rather than
map-in-order but depended on sequential execution).

scm/translation-functions.scm

index 78defd203f741043f5546eb4b41397c018699c6c..aef616942518fa09652b9837dc9001f141fba6e0 100644 (file)
@@ -396,16 +396,8 @@ the current tuning?"
                   defined-strings defined-fingers))
 
     ;;; body of determine-frets-and-strings
-    (let* ((pitch-alist (apply (lambda (mylist)
-                                 (let ((index -1))
-                                   (map (lambda (note)
-                                          (begin
-                                            (set! index (1+ index))
-                                            (cons (note-pitch note)
-                                                  index)))
-                                        mylist)))
-                               notes '()))
-           (pitches (map note-pitch notes)))
+    (let* ((pitches (map note-pitch notes))
+           (pitch-alist (map cons pitches (iota (length pitches)))))
 
       ;; handle notes with strings assigned and fingering of 0
       (for-each