lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lilypond-user Digest, Vol 262, # 12, question 2


From: Schlipf, John (schlipf)
Subject: Re: lilypond-user Digest, Vol 262, # 12, question 2
Date: Thu, 5 Sep 2024 16:09:03 +0000

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.edu@gnu.org <lilypond-user-bounces+john.schlipf=uc.edu@gnu.org> on behalf of lilypond-user-request@gnu.org <lilypond-user-request@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-request@gnu.org

You can reach the person managing the list at
        lilypond-user-owner@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 <paolopr976@gmail.com>
To: lilypond-user <lilypond-user@gnu.org>
Subject: Question about Scheme's syntax
Message-ID:
        <CA+Xftr9u7f=nKHzaiHhVKNhedgxz3AN9kn_w+s6ubUeWXLK7mg@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 <dak@gnu.org>
To: Paolo Prete <paolopr976@gmail.com>
Cc: lilypond-user <lilypond-user@gnu.org>
Subject: Re: Question about Scheme's syntax
Message-ID: <87seufb3c8.fsf@fencepost.gnu.org>
Content-Type: text/plain

Paolo Prete <paolopr976@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 <waltnorth@gmail.com>
To: lilypond-user@gnu.org
Subject: book with paper in variable
Message-ID: <574674eb-1166-4343-8eab-06ddfb9dc434@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 <waltnorth@gmail.com>
To: lilypond-user@gnu.org
Subject: Re: book with paper in variable
Message-ID: <ab38d59b-b8f8-4939-ad8a-5d6daef60e3f@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 <damianlegassick@mac.com>
To: lilypond-user <lilypond-user@gnu.org>
Subject: \omit multiple/list
Message-ID: <c6d71d1c-dd2d-4d63-8acd-6cf49acaf9d9@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 <paolopr976@gmail.com>
To: David Kastrup <dak@gnu.org>
Cc: lilypond-user <lilypond-user@gnu.org>
Subject: Re: Question about Scheme's syntax
Message-ID:
        <CA+Xftr94as0wkVoyKKUBTRoW39czCQ3BLSQhToBLYffD1zBpDQ@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 <dak@gnu.org> wrote:

> Paolo Prete <paolopr976@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
**********************************************

reply via email to

[Prev in Thread] Current Thread [Next in Thread]