Mark Polesky wrote: > ... I've ended up writing quite a few of > these functions without knowing that they were all here.
Here's another useful set of procedures that is not in lily-library.scm. These functions make quick work of calculating offsets, extents, bounding-boxes, etc. I've attached a patch in case anyone feels this is worth including. - Mark ;; defines 7 functions: ;; pair_+ pair_- pair_* pair_/ ;; pair_gcd pair_lcm pair_min pair_max pair_average. ;; eg. (pair_+ '(1 . 1) '(2 . 3) '(5 . 8)) ==> (8 . 12) ;; (pair_min '(1 . 8) '(1 . 5) '(2 . 3)) ==> (1 . 3) (map primitive-eval (map (lambda (f) `(define-public (,(symbol-append 'pair_ f) . pairs) (apply (lambda (f . pairs) ((lambda (lst) (cons (car lst) (cadr lst))) (primitive-eval (append `(map ,f) (map (lambda (x) `(list ,(car x) ,(cdr x))) pairs))))) ,f pairs))) '(+ - * / gcd lcm min max average)))
0003-lily-library.scm-math-functions-for-pairs.patch
Description: Binary data
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel