]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/lily-library.scm
skyline vertical spacing.
[lilypond.git] / scm / lily-library.scm
index ceb057e47dd798e0c363e1ba6fb0e2953a8a045d..6e30cf6ae541780e331d2e5602c1d01379665dbe 100644 (file)
@@ -231,16 +231,26 @@ found."
 ;; list
 
 
-(define (list-join lst intermediate)
-  "put INTERMEDIATE  between all elts of LST."
+(define-public (count-list lst)
+  "Given lst (E1 E2 .. ) return ((E1 . 1) (E2 . 2) ... )  "
+  (define (helper l acc count)
+    (if (pair? l)
+       (helper (cdr l) (cons (cons (car l) count) acc) (1+ count))
+       acc))
+
+
+  (reverse (helper lst '() 1)))
   
-  (reduce (lambda (elt prev)
+(define-public (list-join lst intermediate)
+  "put INTERMEDIATE  between all elts of LST."
+
+  (fold-right
+   (lambda (elem prev)
            (if (pair? prev)
-               (cons  elt (cons intermediate prev))
-               (list elt intermediate prev)))
+               (cons  elem (cons intermediate prev))
+               (list elem)))
          '() lst))
 
-
 (define-public (filtered-map proc lst)
   (filter
    (lambda (x) x)
@@ -500,7 +510,6 @@ possibly turned off."
 
 (define-public (car< a b) (< (car a) (car b)))
 
-
 (define-public (symbol<? lst r)
   (string<? (symbol->string lst) (symbol->string r)))