]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/lily-library.scm
Merge branch 'master' of ssh://jneem@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / scm / lily-library.scm
index c925a808f17c0704598ccd452e38bd7432f256c3..f772d0527e931efa53cdf0917fcf359012e911bb 100644 (file)
@@ -309,13 +309,13 @@ found."
   (lset-difference eq? a b))
 
 (define-public (uniq-list lst)
-  "Uniq LST, assuming that it is sorted"
+  "Uniq LST, assuming that it is sorted. Uses equal? for comparisons."
 
   (reverse! 
    (fold (lambda (x acc)
           (if (null? acc)
               (list x)
-              (if (eq? x (car acc))
+              (if (equal? x (car acc))
                   acc
                   (cons x acc))))
         '() lst) '()))
@@ -491,6 +491,11 @@ found."
   (string-append (ly:number->string (car c)) " "
                 (ly:number->string (cdr c))))
 
+(define-public (dir-basename file . rest)
+  "Strip suffixes in REST, but leave directory component for FILE."
+  (define (inverse-basename x y) (basename y x))
+  (simple-format #f "~a/~a" (dirname file)
+                (fold inverse-basename file rest)))
 
 (define-public (write-me message x)
   "Return X.  Display MESSAGE and write X.  Handy for debugging,