Re: using \pushToTag and \removeWithTag consecutively

2018-04-14 Thread Gianmaria Lari
On 14 April 2018 at 15:46, David Kastrup  wrote:

> Gianmaria Lari  writes:
>
> > I found a not nice solution but something that work:
> >
> > \version "2.19.81"
> > var = {a \tag #'herea {} \tag #'hereb {b} a}
> > {\pushToTag #'herea b! \removeWithTag #'hereb \var}
>
> I'd write
>
> var = {a \tag #'herea {\tag #'hereb {b}} a}
>
> instead since it makes the relations a bit clearer.


Yes but nesting things it's something I avoid if I can.
Working with nested thing is more difficult, you have to keep in your mind
where you are while you write/read In a sequence you can, in some
sence, forgot where you are.


> Though I am not
> completely sure whether \removeWithTag is not coded in a way where it
> will ripple through the then empty sequential expression so that you'd
> need to first do the \pushToTag (namely write it second).


Let me avoid to think also to this :)
g.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: using \pushToTag and \removeWithTag consecutively

2018-04-14 Thread David Kastrup
Gianmaria Lari  writes:

> I found a not nice solution but something that work:
>
> \version "2.19.81"
> var = {a \tag #'herea {} \tag #'hereb {b} a}
> {\pushToTag #'herea b! \removeWithTag #'hereb \var}

I'd write

var = {a \tag #'herea {\tag #'hereb {b}} a}

instead since it makes the relations a bit clearer.  Though I am not
completely sure whether \removeWithTag is not coded in a way where it
will ripple through the then empty sequential expression so that you'd
need to first do the \pushToTag (namely write it second).

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: using \pushToTag and \removeWithTag consecutively

2018-04-14 Thread David Kastrup
Gianmaria Lari  writes:

> On 14 April 2018 at 15:15, David Kastrup  wrote:
>
>> Gianmaria Lari  writes:
>>
>> > I don't understand the behaviour of this code:
>> >
>> > \version "2.19.81"
>> > var = {a \tag #'here {b} a}
>> > {\var} %Result: a b a
>> > {\removeWithTag #'here \var}  %Result: a a
>> > {\pushToTag #'here b! \removeWithTag #'here \var}  %Result: a a ;
>> Expected:
>> > a b! a
>> >
>> >
>> > The result is:
>> >
>> > a b a - ok!
>> > a a - ok!
>> > a a - not ok; shouldn't be "a b! a" ??
>>
>> \removeWithTag removes the tagged expression.  Which includes the tag
>> itself.
>>
>
> This was what I was afraid of :)
>
> Any idea how I can obtain the same effect? I would like to be able to
> substitute a note in a variable with another one.
> Of course I could use "\pushToTag ... noteA" when I need noteA and  
> "\pushToTag
> ... noteB" when i need noteB but I would like that my variable make sense
> also when I don't use \pushToTag command.
> Thank you, g.

Use two tags.

{\pushToTag #'here b! \removeWithTag #'there \var}

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: using \pushToTag and \removeWithTag consecutively

2018-04-14 Thread Gianmaria Lari
On 14 April 2018 at 15:34, Gianmaria Lari  wrote:

>
>
> On 14 April 2018 at 15:15, David Kastrup  wrote:
>
>> Gianmaria Lari  writes:
>>
>> > I don't understand the behaviour of this code:
>> >
>> > \version "2.19.81"
>> > var = {a \tag #'here {b} a}
>> > {\var} %Result: a b a
>> > {\removeWithTag #'here \var}  %Result: a a
>> > {\pushToTag #'here b! \removeWithTag #'here \var}  %Result: a a ;
>> Expected:
>> > a b! a
>> >
>> >
>> > The result is:
>> >
>> > a b a - ok!
>> > a a - ok!
>> > a a - not ok; shouldn't be "a b! a" ??
>>
>> \removeWithTag removes the tagged expression.  Which includes the tag
>> itself.
>>
>
> This was what I was afraid of :)
>
> Any idea how I can obtain the same effect? I would like to be able to
> substitute a note in a variable with another one.
> Of course I could use "\pushToTag ... noteA" when I need noteA and  
> "\pushToTag
> ... noteB" when i need noteB but I would like that my variable make sense
> also when I don't use \pushToTag command.
> Thank you, g.
>

I found a not nice solution but something that work:

\version "2.19.81"
var = {a \tag #'herea {} \tag #'hereb {b} a}
{\pushToTag #'herea b! \removeWithTag #'hereb \var}


Ciao, g.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: using \pushToTag and \removeWithTag consecutively

2018-04-14 Thread Gianmaria Lari
On 14 April 2018 at 15:15, David Kastrup  wrote:

> Gianmaria Lari  writes:
>
> > I don't understand the behaviour of this code:
> >
> > \version "2.19.81"
> > var = {a \tag #'here {b} a}
> > {\var} %Result: a b a
> > {\removeWithTag #'here \var}  %Result: a a
> > {\pushToTag #'here b! \removeWithTag #'here \var}  %Result: a a ;
> Expected:
> > a b! a
> >
> >
> > The result is:
> >
> > a b a - ok!
> > a a - ok!
> > a a - not ok; shouldn't be "a b! a" ??
>
> \removeWithTag removes the tagged expression.  Which includes the tag
> itself.
>

This was what I was afraid of :)

Any idea how I can obtain the same effect? I would like to be able to
substitute a note in a variable with another one.
Of course I could use "\pushToTag ... noteA" when I need noteA and  "\pushToTag
... noteB" when i need noteB but I would like that my variable make sense
also when I don't use \pushToTag command.
Thank you, g.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: using \pushToTag and \removeWithTag consecutively

2018-04-14 Thread David Kastrup
Gianmaria Lari  writes:

> I don't understand the behaviour of this code:
>
> \version "2.19.81"
> var = {a \tag #'here {b} a}
> {\var} %Result: a b a
> {\removeWithTag #'here \var}  %Result: a a
> {\pushToTag #'here b! \removeWithTag #'here \var}  %Result: a a ; Expected:
> a b! a
>
>
> The result is:
>
> a b a - ok!
> a a - ok!
> a a - not ok; shouldn't be "a b! a" ??

\removeWithTag removes the tagged expression.  Which includes the tag
itself.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user