Werner LEMBERG <w...@gnu.org> writes: > Folks, > > > I would like to write a markup function that can either accept a > markup or a markup list as an argument.
You mean, a markup command. > The code below works fine, reporting > > ``` > bar: (#<procedure flat-markup (layout props)>) > baz: 1 > bar: ((#<procedure sharp-markup (layout props)>) > (#<procedure sharp-markup (layout props)>)) > baz: 1 > ``` > > as expected. (The `baz` argument is inserted in the demo code to > avoid interference with LilyPond's special handling of a markup > function's last argument, which can be either a markup or a markup > list, for example, `\bold foo` or `\bold { foo bar }`.) > > However, if I activate the commented-out code, LilyPond aborts with > > ``` > error: syntax error, unexpected MARKUP_FUNCTION > \markup \fooEither > \flat #1 > ``` > > It seems to me that this is a limitation built into LilyPond's parser, > and it is not possible to do what I would like to achieve, probably > due to the above-mentioned special handling of the last argument. Has > someone more insight? The documentation clearly states: <http://lilypond.org/doc/v2.25/Documentation/extending/markup-command-definition-syntax> Arguments are distinguished according to their type: • a markup, corresponding to type predicate ‘markup?’; • a list of markups, corresponding to type predicate ‘markup-list?’; • any other scheme object, corresponding to type predicates such as ‘list?’, ‘number?’, ‘boolean?’, etc. You use a predicate other than markup? or markup-list?, so this counts as any other scheme object. The real question is what you actually are trying to achieve here. -- David Kastrup