David Kastrup wrote: > floating-markup = #(define-scheme-function (parser location x y obj) > (number? number? scheme?) > #{ > \markup \with-dimensions #'(0 . 0) #'(0 > . 0){ > \override #'(baseline-skip . 0) > \translate #(cons x y) > #obj > } > #})
That makes no sense at all. Obviously #obj cannot be anything but a markup here but you declare it as scheme? which just asks for obscure runtime errors. Then there is no point in not using a markup command here in the first place. My response: I'm answering this as a pure Scheme question. 1. Scheme is what is called an "untyped" programming language: Here Scheme has no idea what type of object the last 8 lines above – called the "argument" -- are. (In a "typed" language, the interpreter would be expected to evaluate what kind of object the last 8 lines are and reject the command if those last lines had the wrong type. 2. In an untyped language, if you pass an argument of the wrong type, you may produce totally unpredictable effects and very difficult to identify errors. Basically, the Scheme interpreter is assuming you know what you're doing and almost always lets you do it . For example, some old untyped computer languages would let you change "2" to mean 3. (In this context I have no idea what could happen.) 3. So, at least in contexts where the designers feel nonsensical errors are moderately likely, a Scheme programmer would introduce checks to make sure the argument is of some class that's not going to produce unexpected garbage. Now a Lilypond user might expect always to give a reasonable argument to the command. Is it reasonable to assume that Lilypond users never make mistakes doing that? ________________________________ From: lilypond-user-bounces+john.schlipf=uc....@gnu.org <lilypond-user-bounces+john.schlipf=uc....@gnu.org> on behalf of lilypond-user-requ...@gnu.org <lilypond-user-requ...@gnu.org> Sent: Thursday, September 5, 2024 7:37 AM To: lilypond-user@gnu.org <lilypond-user@gnu.org> Subject: lilypond-user Digest, Vol 262, Issue 12 External Email: Use Caution Send lilypond-user mailing list submissions to lilypond-user@gnu.org To subscribe or unsubscribe via the World Wide Web, visit https://lists.gnu.org/mailman/listinfo/lilypond-user or, via email, send a message with subject or body 'help' to lilypond-user-requ...@gnu.org You can reach the person managing the list at lilypond-user-ow...@gnu.org When replying, please edit your Subject line so it is more specific than "Re: Contents of lilypond-user digest..." Today's Topics: 1. Question about Scheme's syntax (Paolo Prete) 2. Re: Question about Scheme's syntax (David Kastrup) 3. book with paper in variable (Walt North) 4. Re: book with paper in variable (Walt North) 5. \omit multiple/list (damianlegassick) 6. Re: Question about Scheme's syntax (Paolo Prete) ---------------------------------------------------------------------- Message: 1 Date: Wed, 4 Sep 2024 21:42:56 +0200 From: Paolo Prete <paolopr...@gmail.com> To: lilypond-user <lilypond-user@gnu.org> Subject: Question about Scheme's syntax Message-ID: <CA+Xftr9u7f=nkhzaihhvknhedgxz3an9kn_w+s6ubuewxlk...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Hello, Given: floating-markup = #(define-scheme-function (parser location x y obj) (number? number? scheme?) #{ \markup \with-dimensions #'(0 . 0) #'(0 . 0){ \override #'(baseline-skip . 0) \translate #(cons x y) #obj } #}) I can invoke it with: \floating-markup 15 -60 "some string" But how can I pass to the same function the following expression: { \circle 5 } as #obj? Something like (pseudo-syntax) : \floating-markup 15 -60 #{ \circle 5 #} ... Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.gnu.org/archive/html/lilypond-user/attachments/20240904/823a359a/attachment.htm> ------------------------------ Message: 2 Date: Wed, 04 Sep 2024 21:56:07 +0200 From: David Kastrup <d...@gnu.org> To: Paolo Prete <paolopr...@gmail.com> Cc: lilypond-user <lilypond-user@gnu.org> Subject: Re: Question about Scheme's syntax Message-ID: <87seufb3c8....@fencepost.gnu.org> Content-Type: text/plain Paolo Prete <paolopr...@gmail.com> writes: > Hello, > > Given: > > floating-markup = #(define-scheme-function (parser location x y obj) > (number? number? scheme?) > #{ > \markup \with-dimensions #'(0 . 0) #'(0 > . 0){ > \override #'(baseline-skip . 0) > \translate #(cons x y) > #obj > } > #}) That makes no sense at all. Obviously #obj cannot be anything but a markup here but you declare it as scheme? which just asks for obscure runtime errors. Then there is no point in not using a markup command here in the first place. > > I can invoke it with: > > \floating-markup 15 -60 "some string" > > But how can I pass to the same function the following expression: { \circle > 5 } as #obj? { \circle 5 } is not a LilyPond expression. It is a fragment of markup. You can turn it into a LilyPond expression by writing \markup { \circle 5 } in which case you'll get out an actual markup. Outside of markup, \circle is not defined. > Something like (pseudo-syntax) : > > \floating-markup 15 -60 #{ \circle 5 #} #{ ... #} is a Scheme construct, not a LilyPond expression. It is used for using LilyPond syntax inside of a Scheme expression. If you want to use it (in Scheme!) for writing in markup syntax, again you need to enter markup mode by writing #{ \markup ... #} in a Scheme expression. If you are in LilyPond entry mode, you can just write \markup ... instead. -- David Kastrup ------------------------------ Message: 3 Date: Wed, 4 Sep 2024 15:50:18 -0700 From: Walt North <waltno...@gmail.com> To: lilypond-user@gnu.org Subject: book with paper in variable Message-ID: <574674eb-1166-4343-8eab-06ddfb9dc...@gmail.com> Content-Type: text/plain; charset="utf-8"; Format="flowed" I have a case where I need to create separate output files using the \book block. I would like to reuse the \paper block in each of the blocks. I have found the \paper block can be put in a variable and the variable reuses successfully. However for some if I use the variable then the book suffix is ignored. Attached is a trimmed down sample. \version "2.24.2" sc = \score { \relative c' { c4 d e f } } pay = \paper { annotate-spacing = ##t } % I would like to create multiple books that uses the same % \paper block defintion. A variable holding the \paper % would be acceptable. % This is the primary question I have. % this uses the paper setting in the pay variable %but ignores the suffix \book { \bookOutputSuffix "One" \sc \pay } % This uses the suffix but ignores % \paper that is defined outside the book \book { \bookOutputSuffix "Two" \sc } % This uses the suffix and pays attention to the internal % \paper block \book { \bookOutputSuffix "Three" \sc \paper { annotate-spacing = ##t } } \paper { annotate-spacing = ##t } -------------- next part -------------- \version "2.24.2" sc = \score { \relative c' { c4 d e f } } pay = \paper { annotate-spacing = ##t } % I would like to create multiple books that uses the same % \paper block defintion. A variable holding the \paper % would be acceptable. % This is the primary question I have. % this uses the paper setting in the pay variable %but ignores the suffix \book { \bookOutputSuffix "One" \sc \pay } % This uses the suffix but ignores % \paper that is defined outside the book \book { \bookOutputSuffix "Two" \sc } % This uses the suffix and pays attention to the internal % \paper block \book { \bookOutputSuffix "Three" \sc \paper { annotate-spacing = ##t } } \paper { annotate-spacing = ##t } ------------------------------ Message: 4 Date: Wed, 4 Sep 2024 18:03:38 -0700 From: Walt North <waltno...@gmail.com> To: lilypond-user@gnu.org Subject: Re: book with paper in variable Message-ID: <ab38d59b-b8f8-4939-ad8a-5d6daef60...@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed I think I got it. By putting the score and paper block inside a bookpart it seems to allow the book suffix to work. \book { \bookOutputSuffix "One" \bookpart { \sc \pay } } On 9/4/2024 3:50 PM, Walt North wrote: > I have a case where I need to create separate output files using the > \book block. I would like to reuse the \paper block in each of the > blocks. > > I have found the \paper block can be put in a variable and the > variable reuses successfully. However for some if I use the variable > then the book suffix is ignored. > > Attached is a trimmed down sample. > > > \version "2.24.2" > > sc = \score { \relative c' { c4 d e f } } > > pay = \paper { annotate-spacing = ##t } > > % I would like to create multiple books that uses the same > % \paper block defintion. A variable holding the \paper > % would be acceptable. > > % This is the primary question I have. > % this uses the paper setting in the pay variable > %but ignores the suffix > \book { > \bookOutputSuffix "One" > \sc > \pay > } > > % This uses the suffix but ignores > % \paper that is defined outside the book > \book { > \bookOutputSuffix "Two" > \sc > } > > % This uses the suffix and pays attention to the internal > % \paper block > \book { > \bookOutputSuffix "Three" > \sc > \paper { annotate-spacing = ##t } > } > > \paper { annotate-spacing = ##t } ------------------------------ Message: 5 Date: Thu, 5 Sep 2024 10:13:56 +0000 (UTC) From: damianlegassick <damianlegass...@mac.com> To: lilypond-user <lilypond-user@gnu.org> Subject: \omit multiple/list Message-ID: <c6d71d1c-dd2d-4d63-8acd-6cf49acaf...@me.com> Content-Type: text/plain; charset="utf-8"; Format="flowed" Hi all how would I reduce e.g. \once \omit TupletBracket \once \omit TupletNumber \once \omit Stem to a structure conceptually like: \once \omit (TupletBracket, TupletNumber, Stem) i.e. put the grobs in a list thanks Damian -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.gnu.org/archive/html/lilypond-user/attachments/20240905/7e980177/attachment.htm> ------------------------------ Message: 6 Date: Thu, 5 Sep 2024 13:37:18 +0200 From: Paolo Prete <paolopr...@gmail.com> To: David Kastrup <d...@gnu.org> Cc: lilypond-user <lilypond-user@gnu.org> Subject: Re: Question about Scheme's syntax Message-ID: <ca+xftr94as0wkvoykkubtrow39czcq3blsqhtoblyffd1zb...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" I see but the problem remains. I would like to found a way to pass a more structured object to that function, not only a string: %%%%%%%%%%%%%%%%%% \version "2.24.1" floating-markup = #(define-scheme-function (parser location x y obj) (number? number? scheme?) #{ \markup \with-dimensions #'(0 . 0) #'(0 . 0){ \override #'(baseline-skip . 0) \translate #(cons x y) #obj } #}) % GOOD \floating-markup 15 -60 "some string" % ERROR \floating-markup 15 -60 #{ \markup { \circle 1 } #} On Wed, Sep 4, 2024 at 9:56 PM David Kastrup <d...@gnu.org> wrote: > Paolo Prete <paolopr...@gmail.com> writes: > > > Hello, > > > > Given: > > > > floating-markup = #(define-scheme-function (parser location x y obj) > > (number? number? scheme?) > > #{ > > \markup \with-dimensions #'(0 . 0) > #'(0 > > . 0){ > > \override #'(baseline-skip . 0) > > \translate #(cons x y) > > #obj > > } > > #}) > > That makes no sense at all. Obviously #obj cannot be anything but a > markup here but you declare it as scheme? which just asks for obscure > runtime errors. Then there is no point in not using a markup command > here in the first place. > > > > > I can invoke it with: > > > > \floating-markup 15 -60 "some string" > > > > But how can I pass to the same function the following expression: { > \circle > > 5 } as #obj? > > { \circle 5 } is not a LilyPond expression. It is a fragment of markup. > You can turn it into a LilyPond expression by writing > > \markup { \circle 5 } > > in which case you'll get out an actual markup. Outside of markup, > \circle is not defined. > > > Something like (pseudo-syntax) : > > > > \floating-markup 15 -60 #{ \circle 5 #} > > #{ ... #} is a Scheme construct, not a LilyPond expression. It is used > for using LilyPond syntax inside of a Scheme expression. > > If you want to use it (in Scheme!) for writing in markup syntax, again > you need to enter markup mode by writing > > #{ \markup ... #} > > in a Scheme expression. If you are in LilyPond entry mode, you can just > write \markup ... instead. > > -- > David Kastrup > -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.gnu.org/archive/html/lilypond-user/attachments/20240905/49a4654c/attachment.htm> ------------------------------ Subject: Digest Footer _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ------------------------------ End of lilypond-user Digest, Vol 262, Issue 12 **********************************************