Thomas Morley <thomasmorle...@gmail.com> writes: > 2018-05-19 9:45 GMT+02:00 David Kastrup <d...@gnu.org>: >> Thomas Morley <thomasmorle...@gmail.com> writes: > > Uh, oh, another typo/oversight. > Note to self: Don't post anything while being overtired... > >> >> Now if you want to execute only conditionally, you either need to wrap >> in lambdas or use a macro rather than a procedure: >> >> #(define-macro (proc bool x y) >> (if bool x y)) >> >> \paper { >> #(if #t (set-paper-size "a8" 'landscape) (set-paper-size "a8")) >> }
Talk about type/oversight: I don't even use the proc macro here. You need to write it instead of "if" in the paper block, or the example does not make a whole lot of sense. >> Note that this will only work with a _literal_ #f or #t as argument: >> you'll likely want to have some actual condition evaluated at runtime, >> like some variable name. Then you'll need to write >> >> #(define-macro (proc bool x y) >> `(if ,bool ,x ,y)) > > Thanks for the insights, The last bit is a whole lot of quasiquote obviously equivalent to (list 'if bool x y) But in the context of macro expansions, using quasiquotes is sort of customary for emphasizing the structure of what gets returned rather than how it is getting built. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user