----- Original Message ---- > From: Mark Polesky <markpole...@yahoo.com> > To: Mark Polesky <markpole...@yahoo.com>; Neil Puttock <n.putt...@gmail.com> > Cc: lilypond-devel <lilypond-devel@gnu.org> > Sent: Friday, May 29, 2009 1:42:16 AM > Subject: [PATCH] Re: where to put useful lists in the docs? > > 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. Here's a new patch that also incorporates conditionals. ;; defines 14 functions: ;; pair_+ pair_- pair_* pair_/ ;; pair_= 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_<= '(1 . 8) '(1 . 5) '(2 . 3)) ==> (#t . #f) ;; (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)))
0001-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