Mark Polesky wrote: > > ... To write code that writes codes, use macros: read > > about defmacro. ... > > ... sometimes I can't read between the concise lines of R5RS or > the guile reference manual.
Okay, I've been going in circles for an hour trying to assemble anything remotely similar to what you're suggesting. To me, this section (4.3 Macros) is the textual equivalent of a jigsaw puzzle: http://schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-7.html#%_sec_4.3 And this one is just a joke: http://www.gnu.org/software/guile/manual/html_node/Define_002dSyntax.html#Define_002dSyntax Hopefully my frustration is understandable. I did however manage to get at least this far: (define (map-on-pairs f pairs) (cons (apply f (map car pairs)) (apply f (map cdr pairs)))) (defmacro make-pair-function (f) `(define-public (,(symbol-append 'pair f) . pairs) (map-on-pairs ,f (values pairs)))) (make-pair-function +) (pair+ '(1 . 1) '(2 . 3) '(5 . 8)) __________________________________ This works, but I simply can't figure out what to change to make this do what I want (ie. define all these pair<x> functions in one pass). (map make-pair-function '(+ - * / = < > <= >= gcd lcm min max average)) I know I can do (begin (make-pair-function +) (make-pair-function -) (make-pair-function *) (make-pair-function /)) but how do I automate that form without having to write make-pair-function 14 times? Obviously, it's not the typing that bothers me, it's the persistent feeling that more concise code, while remaining perpetually elusive, is still possible. Thanks for your help. - Mark _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel