Hello, As regards the issue of context-free equivalence --
> > I can say > > > > foo = \markup { \bold "Zanzibar" } > > bar = \markup { "Stand on" \foo } > > > > but I can't say > > > > bar = \markup { "Stand on" \markup { \bold "Zanzibar" } } > > > > [so] > > > > \foo is not equivalent to \markup { \bold "Zanzibar" } > > > > despite the "=" sign in the macro definition > The reason for this is that foo is not a macro; it's a variable. > Similarly, in C you can write > int i = 5+9; > foo(&i); > which is _not_ the same as the (invalid) expression > foo(&(5+9)); > (this example is not exactly analogous to what you're trying, but it > illustrates that variables and macros are different things). No, it illustrates that variables and literals are different things. In C, "&" means "contents of" an address, and i is an address, but (5+9) is not, so you can't write "&" in front of (5+9). But in LilyPond, "\" in "\foo" means eval(foo), where foo is a variable, but "\" in "\markup" is not an eval operator, or any other kind of operator, it is just a character used lexically to indicate a keyword. There will inevitably arise cases where users are confused about acceptable syntax because of the various different uses of "\" (consider also 2\cm). > The special thing about 'markup' is that it isn't a function; it's rather a > special token that marks that the following code should be interpreted as > markups. If that's all there were to it, then bar = \markup { "Stand on" \markup { \bold "Zanzibar" } } would work. The special thing about \markup is that it is analyzed strictly lexically: it can have only certain lexical items in it, like \bold, \raise, \column,... Given that as a starting point, it must have been very difficult to write the additional code to allow it to contain also constructs like \foo (where foo is a defined variable). If it had been analyzed dynamically, then *both* the above expression and bar = \markup { "Stand on" \foo } would work, since \foo and \markup { \bold "Zanzibar" } both produce exactly the same stencil as a result. Maybe I'm griping too much, maybe that's what you meant by saying that \markup isn't a function. I must sound ungrateful, nitpicking about syntactical inconsistencies. To be more reasonable, what I have learned by using *any* typesetting program is that music layout is wildly difficult. It is almost unbelievable that Han-Wen, Jan, and others (I'm sorry I don't know all the names) managed to create a working system to produce such beautiful results. Certain parts of LP syntax are hard to be sure of when you're writing a .ly file, but the gorgeous printed output never ceases to amaze me. -- Tom ******************************************************* On Fri, 1 Dec 2006, Erik Sandberg wrote: > On Thursday 30 November 2006 21:32, [EMAIL PROTECTED] wrote: > > Hello, > > > > > . . . one problem is that this [giving the syntax of each keyword] would > > > still just tell a small part of the full syntax. > > > > I think it would give a big part of the full syntax, even if not the whole > > picture. It would enable a user to know > > (1) what type of "arguments" have to follow the keyword; > > (2) whether (s)he has accidentally omitted one of the required > > arguments (when debugging); > > (3) whether (s)he should write a macro definition or a function > > definition to specify a "\whatever" construct involving the > > keyword; > > (4) what the types should be in the event that (s)he winds up writing a > > function definition. > > "Full" or not, that's a lot of useful information. And I'm talking about > > just a list of the syntax for each keyword, *not* the semantics. A syntax > > specification can be short but still tremendously useful. Specification > > of the semantics takes a lot of blah-blah, and nobody would have the time > > to write up all the semantics. > > > > > Another problem is that the > > > rule I gave really was too simple. For example, you cannot say > > > ^"some text" in a .ly file > > > without having a note in front of it, still you can define a macro > > > mytext = ^"some text" > > > and then use it as c \mytext > > > > That's a general problem in LilyPond, knowing what kind of expression > > constitutes a valid right-hand side of a macro definition. (I'm amazed > > that the above definition works.) > > > > A different but related problem concerns something I don't know the right > > term for, something like "context-free equivalence" maybe: for example, > > I can say > > > > foo = \markup { \bold "Zanzibar" } > > bar = \markup { "Stand on" \foo } > > > > but I can't say > > > > bar = \markup { "Stand on" \markup { \bold "Zanzibar" } } > > > > You will object that I would have no *reason* to say that anyway, > > but it nevertheless constitutes a toy example of non-transferability: > > > > \foo is not equivalent to \markup { \bold "Zanzibar" } > > > > despite the "=" sign in the macro definition, and that's surprising. > > The reason for this is that foo is not a macro; it's a variable. Similarly, in > C you can write > int i = 5+9; > foo(&i); > which is _not_ the same as the (invalid) expression > foo(&(5+9)); > (this example is not exactly analogous to what you're trying, but it > illustrates that variables and macros are different things). > > The special thing about 'markup' is that it isn't a function; it's rather a > special token that marks that the following code should be interpreted as > markups. > > -- > Erik _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user