]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue3181: Replace several misuses of eq? on numerical values
authorDavid Kastrup <dak@gnu.org>
Fri, 15 Feb 2013 09:50:43 +0000 (10:50 +0100)
committerDavid Kastrup <dak@gnu.org>
Fri, 15 Feb 2013 10:29:55 +0000 (11:29 +0100)
Numerical values don't carry identity, so (eq? 0 0) may or may not
evaluate to #t.  Those need to be replaced by eqv? or, where both
items are guaranteed to be a number, = .

Documentation/snippets/transposing-pitches-with-minimum-accidentals-smart-transpose.ly
input/regression/glissando-index.ly
ly/event-listener.ly
scm/define-event-classes.scm
scm/define-markup-commands.scm
scm/stencil.scm
scm/translation-functions.scm

index 2b647d08547461da83c800de38b9523222c3ee7f..9d1e274ff5ef6ffdf99faa68a95b3c57bfcda25c 100644 (file)
@@ -43,10 +43,10 @@ In this manner, the most natural enharmonic notes are chosen.
          ;; for historical reasons
          (n (ly:pitch-notename p)))
      (cond
-      ((and (> a 1) (or (eq? n 6) (eq? n 2)))
+      ((and (> a 1) (or (= n 6) (= n 2)))
        (set! a (- a 2))
        (set! n (+ n 1)))
-      ((and (< a -1) (or (eq? n 0) (eq? n 3)))
+      ((and (< a -1) (or (= n 0) (= n 3)))
        (set! a (+ a 2))
        (set! n (- n 1))))
      (cond
index f3d53a79021935acc2be365336404547fda5e354..5611773909407757ae173a4a733ad9b5abc0566e 100644 (file)
@@ -7,6 +7,6 @@
 \relative c' {
   \once \override Voice.Glissando.style =
     #(lambda (grob)
-       (if (eq? 1 (ly:grob-property grob 'glissando-index)) 'zigzag 'default))
+       (if (= 1 (ly:grob-property grob 'glissando-index)) 'zigzag 'default))
   <d f a>1 \glissando s1 <f a c>
 }
index 6c0f75970e708e370195b8934801074c507f77a3..9e5282de89d7ca33704a58fb592a62ec17c848e0 100644 (file)
@@ -66,7 +66,7 @@ program using the output of this function to interpret grace notes
 however they want (half duration, quarter duration?  before beat,
 after beat?  etc.)."
    (if
-       (eq? 0 (ly:moment-grace-numerator moment))
+       (zero? (ly:moment-grace-numerator moment))
        (ly:format "~a" (format-moment moment))
        ;; grace notes have a negative numerator, so no "-" necessary
        (ly:format
index 09dfbf79a34b39898a30e7b413166aea0f15d078..c8ecbcf22709dd6a6750315d1d9f8e033ad0c570 100644 (file)
     (list 'unquote `(ly:make-moment
                     ,(ly:moment-main-numerator e)
                     ,(ly:moment-main-denominator e)
-                    . ,(if (eq? 0 (ly:moment-grace-numerator e))
+                    . ,(if (zero? (ly:moment-grace-numerator e))
                            '()
                            (list (ly:moment-grace-numerator e)
                                  (ly:moment-grace-denominator e))))))
index 7dd0f967ed26bea6631292e2832ad56efd5e9d98..92b4b704eb08d1778ba2b5794016799408d5a3da 100755 (executable)
@@ -898,7 +898,7 @@ samplePath =
         (new-commands (map (lambda (x)
                              (cond
                                ;; for rmoveto, rlineto
-                               ((and (relative? x) (eq? 3 (length x)))
+                               ((and (relative? x) (= 3 (length x)))
                                 (let ((cp (cons
                                             (+ (car current-point)
                                                (second x))
@@ -908,7 +908,7 @@ samplePath =
                                   (list (car cp)
                                         (cdr cp))))
                                ;; for rcurveto
-                               ((and (relative? x) (eq? 7 (length x)))
+                               ((and (relative? x) (= 7 (length x)))
                                 (let* ((old-cp current-point)
                                        (cp (cons
                                              (+ (car old-cp)
@@ -923,12 +923,12 @@ samplePath =
                                         (car cp)
                                         (cdr cp))))
                                ;; for moveto, lineto
-                               ((eq? 3 (length x))
+                               ((= 3 (length x))
                                 (set-point (cons (second x)
                                                  (third x)))
                                 (drop x 1))
                                ;; for curveto
-                               ((eq? 7 (length x))
+                               ((= 7 (length x))
                                 (set-point (cons (sixth x)
                                                  (seventh x)))
                                 (drop x 1))
index 9b0db9a3fd4617e1ac786cfe95e077910a567473..4be305bd0b89a4ab6e54c2380fc42f23d0873980 100644 (file)
@@ -381,7 +381,7 @@ defined by @code{fill}."
        (reduce min +inf.0 (map caadr x))
        (reduce max -inf.0 (map cadadr x))))
     (map (lambda (x)
-          (if (eq? (length x) 8)
+          (if (= (length x) 8)
               (apply bezier-min-max x)
               (apply line-min-max x)))
         (map (lambda (x y)
@@ -403,7 +403,7 @@ respectively."
         ;; modify pointlist to scale the coordinates
         (path (map (lambda (x)
                      (apply
-                       (if (eq? 6 (length x))
+                       (if (= 6 (length x))
                            (lambda (x1 x2 x3 x4 x5 x6)
                              (list 'curveto
                                    (* x1 x-scale)
index 665d259743700ae6488b83d6403a7e1a5eb99c2b..7f3305665ebef1dcc35d85f17e09a980e52bb67d 100644 (file)
@@ -345,8 +345,8 @@ if no fingering is present."
            (and x y))
          #t
          (map (lambda (specced-fret)
-                (or (eq? 0 specced-fret)
-                    (eq? 0 fret)
+                (or (zero? specced-fret)
+                    (zero? fret)
                     (>= maximum-stretch (abs (- fret specced-fret)))))
               specified-frets))))
 
@@ -355,7 +355,7 @@ if no fingering is present."
 notes?"
       (let* ((fret (calc-fret pitch string tuning)))
        (and (or (and (not restrain-open-strings)
-                     (eq? fret 0))
+                     (zero? fret))
                 (>= fret minimum-fret))
             (integer? fret)
             (close-enough fret))))
@@ -364,7 +364,7 @@ notes?"
       "Is @var{pitch} and open-string note on @var{string}, given
 the current tuning?"
       (let* ((fret (calc-fret pitch string tuning)))
-       (eq? fret 0)))
+       (zero? fret)))
 
     (define (set-fret! pitch-entry string finger)
       (let ((this-fret (calc-fret (car pitch-entry)
@@ -400,7 +400,7 @@ the current tuning?"
       (for-each
         (lambda (pitch-entry string-fret-finger)
          (let* ((string (list-ref string-fret-finger 0))
-                 (finger (if (eq? (length string-fret-finger) 3)
+                 (finger (if (= (length string-fret-finger) 3)
                              (list-ref string-fret-finger 2)
                              '()))
                  (pitch (car pitch-entry))
@@ -408,8 +408,8 @@ the current tuning?"
                            #f
                            finger)))
            (if (or (not (null? string))
-                   (eq? digit 0))
-               (if (eq? digit 0)
+                   (eqv? digit 0))
+               (if (eqv? digit 0)
                     ;; here we handle fingers of 0 -- open strings
                    (let ((fit-string
                            (find (lambda (string)
@@ -458,7 +458,7 @@ the current tuning?"
        (let* ((string-fret-finger (list-ref string-fret-fingers
                                              (cdr pitch-entry)))
                (string (list-ref string-fret-finger 0))
-               (finger (if (eq? (length string-fret-finger) 3)
+               (finger (if (= (length string-fret-finger) 3)
                            (list-ref string-fret-finger 2)
                            '()))
                (pitch (car pitch-entry))