[Top][All Lists]

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

Re: Avoid a few trivial lambda function wrappers (issue 306710043 by add

From: dak
Subject: Re: Avoid a few trivial lambda function wrappers (issue 306710043 by address@hidden)
Date: Thu, 20 Oct 2016 01:42:11 -0700

Reviewers: simon.albrecht,

I hate having to clean up after sed scripts but it was less work just
going through that mail than arguing it away.

File ly/ (right):
ly/ coords offsets)))
On 2016/10/19 21:37:12, simon.albrecht wrote:
Now the line-breaks can also be omitted, would be cleaner IMO.

File scm/documentation-lib.scm (right):
scm/documentation-lib.scm:55: (node-children node)))
On 2016/10/19 21:37:12, simon.albrecht wrote:
Here as well.

File scm/modal-transforms.scm (right):
scm/modal-transforms.scm:147: elements))
On 2016/10/19 21:37:12, simon.albrecht wrote:
…and here…

File scm/music-functions.scm (right):
scm/music-functions.scm:2318: arg offsets))
On 2016/10/19 21:37:12, simon.albrecht wrote:
…and here…


Avoid a few trivial lambda function wrappers

Please review this at

Affected files (+15, -15 lines):
M Documentation/snippets/
  M ly/
  M ly/
  M scm/chord-name.scm
  M scm/define-markup-commands.scm
  M scm/define-music-display-methods.scm
  M scm/documentation-lib.scm
  M scm/modal-transforms.scm
  M scm/music-functions.scm
  M scm/stencil.scm

Index: Documentation/snippets/ diff --git a/Documentation/snippets/ b/Documentation/snippets/ index 51ebe920786cf5486cf2f9cfc63548067bbd223a..df6ce9d6c098260ec418a76c1ce22337da923153 100644 --- a/Documentation/snippets/ +++ b/Documentation/snippets/ @@ -62,7 +62,7 @@ In this manner, the most natural enharmonic notes are chosen.
      (if (pair? es)
           music 'elements
-          (map (lambda (x) (naturalize x)) es)))
+          (map naturalize es)))
      (if (ly:music? e)
           music 'element
Index: ly/
diff --git a/ly/ b/ly/
index 0414bd926b89418e9a5d966de31fe81e2ef24b54..0f198ffbedcbdb3b6e1c7c51240f5cc718f7f787 100644
--- a/ly/
+++ b/ly/
@@ -425,7 +425,7 @@
    (map (lambda (y) (ac:setduration y hemisemidur))
     (ly:music-property music 'elements))
    (set! uppernote (ly:music-deep-copy music))
-   (map (lambda (y) (ac:up y))
+   (map ac:up
      (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
      (ly:music-property uppernote 'elements)))
@@ -764,11 +764,11 @@
           (ly:music-property abovenote 'elements))
          (map (lambda (y) (ac:setduration y gracedur))
           (ly:music-property abovenoteTwo 'elements))
-         (map (lambda (y) (ac:up y))
+         (map ac:up
            (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
            (ly:music-property abovenote 'elements)))
-         (map (lambda (y) (ac:up y))
+         (map ac:up
            (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
            (ly:music-property abovenoteTwo 'elements)))
@@ -788,7 +788,7 @@
           (ly:music-property gracenote 'elements))
          (map (lambda (y) (ac:setduration y gracedur))
                (ly:music-property belownote 'elements))
-         (map (lambda (y) (ac:down y))
+         (map ac:down
            (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
            (ly:music-property belownote 'elements)))
@@ -812,11 +812,11 @@
                  (below (ly:music-deep-copy music))
(newmusic (make-sequential-music (list above music below music))))
-            (map (lambda (y) (ac:down y))
+            (map ac:down
               (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
               (ly:music-property below 'elements)))
-            (map (lambda (y) (ac:up y))
+            (map ac:up
               (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
               (ly:music-property above 'elements)))
Index: ly/
diff --git a/ly/ b/ly/
index 76c2ec64b882f079ec9fbf441076cfc30a305631..6b81c86b4d6a303cf9a03b592aeddcc4e8d4ca88 100644
--- a/ly/
+++ b/ly/
@@ -1652,7 +1652,7 @@ appropriate tweak applied.")
          (if (null? offsets)
-               (lambda (x y) (coord-translate x y))
+               coord-translate
                coords offsets)))

        (define (helper sibs offs)
Index: scm/chord-name.scm
diff --git a/scm/chord-name.scm b/scm/chord-name.scm
index 52ae72b2cb6298cfc445529d7fa1770d5e95c631..29ec16fc805d24ccc0cb8b57245f9d5df19eb7c5 100644
--- a/scm/chord-name.scm
+++ b/scm/chord-name.scm
@@ -169,4 +169,4 @@ FOOBAR-MARKUP) if OMIT-ROOT is given and non-false.

   (let* ((elts (filter is-event-chord? (ly:music-property seq 'elements)))
          (alist (map chord-to-exception-entry elts)))
-    (filter (lambda (x) (cdr x)) alist)))
+    (filter cdr alist)))
Index: scm/define-markup-commands.scm
diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm
index a6c84b8f6ee3b96c0c1398781ff0e5ecd2aedb5f..48e44a624c0262e70c2b913f22a06bb5913b8777 100644
--- a/scm/define-markup-commands.scm
+++ b/scm/define-markup-commands.scm
@@ -383,7 +383,7 @@ Its appearance may be customized by overrides for @code{thickness},
     ;; The final stencil: lined-up bows
     (apply ly:stencil-add
-        (lambda (stil pt) (ly:stencil-translate stil pt))
+        ly:stencil-translate
         (circular-list init-bow-up init-bow-down)

Index: scm/define-music-display-methods.scm
diff --git a/scm/define-music-display-methods.scm b/scm/define-music-display-methods.scm index 42637cd16c0c5548b44395186893e0d96cdedd05..a5ccd9284928289f37284e44b63b870280973c39 100644
--- a/scm/define-music-display-methods.scm
+++ b/scm/define-music-display-methods.scm
@@ -628,7 +628,7 @@ Otherwise, return #f."
                       (format #f "~s" string)
                 (markup->lily-string text)))
-          (map-in-order (lambda (m) (music->lily-string m))
+          (map-in-order music->lily-string
                         (ly:music-property lyric 'articulations))))

 (define-display-method BreathingEvent (event)
Index: scm/documentation-lib.scm
diff --git a/scm/documentation-lib.scm b/scm/documentation-lib.scm
index d5f451732615b469e518faf6659ba833ed9744f1..fa63b46630626b5a1df741c79bec3c14726552c7 100644
--- a/scm/documentation-lib.scm
+++ b/scm/documentation-lib.scm
@@ -51,7 +51,7 @@
     (if (pair? (node-children node))
-         (map (lambda (x) (menu-entry x))
+         (map menu-entry
               (node-children node)))
Index: scm/modal-transforms.scm
diff --git a/scm/modal-transforms.scm b/scm/modal-transforms.scm
index f9e26ed360235d316a5a467fab1c9d19483d3f3f..725709bff5d5e8cbf6c39b8b47e4baa7b14ea1b5 100644
--- a/scm/modal-transforms.scm
+++ b/scm/modal-transforms.scm
@@ -143,7 +143,7 @@ Typically used to construct a scale for input to

      ((pair? elements)
-       (lambda (x) (make-scale x))
+       make-scale

      ((ly:music? element)
Index: scm/music-functions.scm
diff --git a/scm/music-functions.scm b/scm/music-functions.scm
index e7728ec8893fa6e128b71d9be9d9b2be01b3f990..54c5ede8d61b43142060ee7fee707a962303aa18 100644
--- a/scm/music-functions.scm
+++ b/scm/music-functions.scm
@@ -2314,7 +2314,7 @@ list or if there is a type-mismatch, @var{arg} will be returned."
      (coord-translate arg offsets))
     ((and (number-pair-list? arg) (number-pair-list? offsets))
-       (lambda (x y) (coord-translate x y))
+       coord-translate
        arg offsets))
     (else arg)))

Index: scm/stencil.scm
diff --git a/scm/stencil.scm b/scm/stencil.scm
index 17f5f9084f69c9364e39d703de9dc17b182d848e..433bf634d8c21961814c74961612d8088e6a2ccb 100644
--- a/scm/stencil.scm
+++ b/scm/stencil.scm
@@ -1130,7 +1130,7 @@ grestore
          ((eq? head 'rotate-stencil) (interpret (caddr expr)))
          ((eq? head 'translate-stencil) (interpret (caddr expr)))
          ((eq? head 'combine-stencil)
-          (for-each (lambda (e) (interpret e))  (cdr expr)))
+          (for-each interpret  (cdr expr)))
           (collect (fold-false-pairs (strip-floats expr))))

reply via email to

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