Re: Shorthand for \repeat unfold for individual notes

2023-01-24 Thread Lukas-Fabian Moser

Well, if you didn’t recall the previous discussion but nevertheless proposed a 
similar idea, that is an indication that there is some real need.

I actually lean towards adding \* and calling it a day.


+1 (not surprising given my opinion given in the 2021 thread).

I'd volunteer to do this (in February).

Lukas




Re: Shorthand for \repeat unfold for individual notes

2023-01-23 Thread Carl Sorensen
On Mon, Jan 23, 2023 at 5:17 PM Jean Abou Samra  wrote:

>
>
> > Le 24 janv. 2023 à 01:06, Aaron Hill  a écrit
> :
> >
> > On 2023-01-23 3:58 pm, Jean Abou Samra wrote:
> >> Well, so we are basically having the discussion
> >> https://lists.gnu.org/archive/html/lilypond-devel/2021-09/msg00074.html
> >> again.
> >
> > Okay, let's shut this down now.  I have no recollection whatsoever being
> part of the prior discussion, so I am very sorry about that.
>
>
>
> Well, if you didn’t recall the previous discussion but nevertheless
> proposed a similar idea, that is an indication that there is some real need.
>
> I actually lean towards adding \* and calling it a day.
>
>
I wouldn't object to \*.  Someone who doesn't understand it doesn't need to
use it.  "\* 3 a8" is clearly different from "a8*3".   And it even gets
more clearly different when you can do
\* 3 {a8 b c d e}
but not
{a8 b c d e} * 3

Carl


Re: Shorthand for \repeat unfold for individual notes

2023-01-23 Thread Jean Abou Samra



> Le 24 janv. 2023 à 01:06, Aaron Hill  a écrit :
> 
> On 2023-01-23 3:58 pm, Jean Abou Samra wrote:
>> Well, so we are basically having the discussion
>> https://lists.gnu.org/archive/html/lilypond-devel/2021-09/msg00074.html
>> again.
> 
> Okay, let's shut this down now.  I have no recollection whatsoever being part 
> of the prior discussion, so I am very sorry about that.



Well, if you didn’t recall the previous discussion but nevertheless proposed a 
similar idea, that is an indication that there is some real need.

I actually lean towards adding \* and calling it a day.





Re: Shorthand for \repeat unfold for individual notes

2023-01-23 Thread David Kastrup
Aaron Hill  writes:

> On 2023-01-23 3:46 pm, Carl Sorensen wrote:
>
>> I get the lack of utility of \repeat unfold (14 keystrokes) for
>> short music
>> expressions (like a single note).  But I don't think that ** is
>> intuitive
>> enough to use it.
>> If there were an alternative operator that would not mess up
>> lookahead and
>> would not suffer with the confusion between * and ** (people already
>> think
>> * does your proposed **), I could be convinced.
>
> Well, blame my email program, as it truncated my original post.  I had
> intended to fully call out that ** is exponentiation in some language,
> thus might not be the best symbol.

Well, mathematically c**4 in some sense is the same as c c c c .  Not
saying that I find that compelling but it is some kind of argument.

-- 
David Kastrup



Re: Shorthand for \repeat unfold for individual notes

2023-01-23 Thread Carl Sorensen
On Mon, Jan 23, 2023 at 5:02 PM Aaron Hill  wrote:

>
> Well, blame my email program, as it truncated my original post.  I had
> intended to fully call out that ** is exponentiation in some language,
> thus might not be the best symbol.
>
> But this discussion is quickly devolving into needless dissection of
> details.  If you object at the high-level, let us not waste time at the
> low-level.
>

I don't object at the high level of reducing the verbosity of "\repeat
unfold" .  It is so cumbersome that I only use it if I have a longish
musical phrase to repeat.

My objection is that "**" is too close to "*" and could lead to more
confusion.

As I said earlier, if we can avoid the potential confusion, I can see it
being a valuable construct.

Thanks,

Carl


Re: Shorthand for \repeat unfold for individual notes

2023-01-23 Thread Aaron Hill

On 2023-01-23 3:58 pm, Jean Abou Samra wrote:

Well, so we are basically having the discussion
https://lists.gnu.org/archive/html/lilypond-devel/2021-09/msg00074.html
again.


Okay, let's shut this down now.  I have no recollection whatsoever being 
part of the prior discussion, so I am very sorry about that.



-- Aaron Hill



Re: Shorthand for \repeat unfold for individual notes

2023-01-23 Thread David Kastrup
Jean Abou Samra  writes:

> On 24/01/2023 00:41, David Kastrup wrote:
>> At any rate, postfix expressions require lookahead, and ** requires more
>> than one token of lookahead.  What constructs would you see as
>> candidates before ** ?
>
>
> Without agreeing or disagreeing with the '**' idea, couldn't
> the lexer just emit a different token for '**'?

I am not too enthused about composite tokens.  That makes for awkward
stuff in lyrics, for example.  At any rate, any postfix sequence
requires lookahead.

-- 
David Kastrup



Re: Shorthand for \repeat unfold for individual notes

2023-01-23 Thread Aaron Hill

On 2023-01-23 3:46 pm, Carl Sorensen wrote:

a8**3 is 5 key strokes.
a8 8 8 is 6 key strokes.
In exchange for saving one key stroke, I have a new operator to 
remember
(and get confused about) and to maintain changes to the lexer and 
parser.


It's not all about saving key strokes, but documenting intent and 
removing code duplication.



I get the lack of utility of \repeat unfold (14 keystrokes) for short 
music
expressions (like a single note).  But I don't think that ** is 
intuitive

enough to use it.
If there were an alternative operator that would not mess up lookahead 
and
would not suffer with the confusion between * and ** (people already 
think

* does your proposed **), I could be convinced.


Well, blame my email program, as it truncated my original post.  I had 
intended to fully call out that ** is exponentiation in some language, 
thus might not be the best symbol.


But this discussion is quickly devolving into needless dissection of 
details.  If you object at the high-level, let us not waste time at the 
low-level.



-- Aaron Hill



Re: Shorthand for \repeat unfold for individual notes

2023-01-23 Thread Jean Abou Samra
On 24/01/2023 00:41, David Kastrup wrote:
> At any rate, postfix expressions require lookahead, and ** requires more
> than one token of lookahead.  What constructs would you see as
> candidates before ** ?


Without agreeing or disagreeing with the '**' idea, couldn't
the lexer just emit a different token for '**'?



OpenPGP_signature
Description: OpenPGP digital signature


Re: Shorthand for \repeat unfold for individual notes

2023-01-23 Thread Jean Abou Samra
On 24/01/2023 00:16, Aaron Hill wrote:
> There is already shorthand for tremolo repeats, so I wondered if there could 
> be the same for cases when a single note or rest is repeated.
> 
> %%
> % Start with music that has repeated notes:
> { \time 7/8 a8 8 8 b16 16 16 16 c4 }
> 
> % Manually unfolded repeats work, but take up a lot of input space:
> { \time 7/8 \repeat unfold 3 a8 \repeat unfold 4 b16 c4 }
> 
> % This produces the correct length of music without note repetition:
> { \time 7/8 a8*3 b16*4 c4 }
> 
> % Possible shorthand for unfolded repeat:
> { \time 7/8 a8**3 b16**4 c4 }
> %%
> 
> In a sense, the ** acts like (integral) scaling of a duration but with 
> unfolded repetition as the realization.



Well, so we are basically having the discussion
https://lists.gnu.org/archive/html/lilypond-devel/2021-09/msg00074.html
again.

With the time that has passed, I think my relative distaste
for one of the solutions has more or less went away: today,
I would consider adding

"\*" = \repeat unfold \etc

to music-functions-init.ly just good enough.

Jean



OpenPGP_signature
Description: OpenPGP digital signature


Re: Shorthand for \repeat unfold for individual notes

2023-01-23 Thread David Kastrup
Carl Sorensen  writes:

> I'm not in favor.
>
> a8**3 is 5 key strokes.
> a8 8 8 is 6 key strokes.
> In exchange for saving one key stroke, I have a new operator to remember
> (and get confused about) and to maintain changes to the lexer and parser.
>
> I get the lack of utility of \repeat unfold (14 keystrokes) for short music
> expressions (like a single note).  But I don't think that ** is intuitive
> enough to use it.
>
> What about
>
> %%
> \version "2.24"
>
> dup =
> #(define-music-function
> (count mus)
> (number? ly:music?)
> #{
>   \repeat unfold $count $mus
> #})
>
> {\time 7/8 \dup #3 a8 \dup #4 b16 c4}
> %
>
> If you don't like the name dup, you could use ru (short for repeat
> unfold)

"\\*" works as well, giving

{\time 7/8 \*3 a8 \*4 b16 c4}

-- 
David Kastrup



Re: Shorthand for \repeat unfold for individual notes

2023-01-23 Thread Carl Sorensen
On Mon, Jan 23, 2023 at 4:16 PM Aaron Hill  wrote:

> There is already shorthand for tremolo repeats, so I wondered if there
> could be the same for cases when a single note or rest is repeated.
>
> %%
> % Start with music that has repeated notes:
> { \time 7/8 a8 8 8 b16 16 16 16 c4 }
>
> % Manually unfolded repeats work, but take up a lot of input space:
> { \time 7/8 \repeat unfold 3 a8 \repeat unfold 4 b16 c4 }
>
> % This produces the correct length of music without note repetition:
> { \time 7/8 a8*3 b16*4 c4 }
>
> % Possible shorthand for unfolded repeat:
> { \time 7/8 a8**3 b16**4 c4 }
> %%
>

I'm not in favor.

a8**3 is 5 key strokes.
a8 8 8 is 6 key strokes.
In exchange for saving one key stroke, I have a new operator to remember
(and get confused about) and to maintain changes to the lexer and parser.

I get the lack of utility of \repeat unfold (14 keystrokes) for short music
expressions (like a single note).  But I don't think that ** is intuitive
enough to use it.

What about

%%
\version "2.24"

dup =
#(define-music-function
(count mus)
(number? ly:music?)
#{
  \repeat unfold $count $mus
#})

{\time 7/8 \dup #3 a8 \dup #4 b16 c4}
%

If you don't like the name dup, you could use ru (short for repeat unfold)

If there were an alternative operator that would not mess up lookahead and
would not suffer with the confusion between * and ** (people already think
* does your proposed **), I could be convinced.

Thanks,

Carl


Re: Shorthand for \repeat unfold for individual notes

2023-01-23 Thread David Kastrup
Aaron Hill  writes:

> There is already shorthand for tremolo repeats,

Not really.  The internal representations are different.

> so I wondered if there could be the same for cases when a single note
> or rest is repeated.
>
> %%
> % Start with music that has repeated notes:
> { \time 7/8 a8 8 8 b16 16 16 16 c4 }
>
> % Manually unfolded repeats work, but take up a lot of input space:
> { \time 7/8 \repeat unfold 3 a8 \repeat unfold 4 b16 c4 }
>
> % This produces the correct length of music without note repetition:
> { \time 7/8 a8*3 b16*4 c4 }
>
> % Possible shorthand for unfolded repeat:
> { \time 7/8 a8**3 b16**4 c4 }
> %%
>
> In a sense, the ** acts like (integral) scaling of a duration but with
> unfolded repetition as the realization.

What Scheme representation would you propose?

At any rate, postfix expressions require lookahead, and ** requires more
than one token of lookahead.  What constructs would you see as
candidates before ** ?

-- 
David Kastrup