lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme set list function


From: Gianmaria Lari
Subject: Re: scheme set list function
Date: Sat, 6 Apr 2019 23:35:32 +0200

Thank you Harm and Aaron!

I tested your solutions;they both work and I think there are pretty clear!! But I think, next days I will try to explain what I'm doing.

Thanks a lot!!!
g.



On Sat, 6 Apr 2019 at 19:09, Aaron Hill <address@hidden> wrote:
On 2019-04-06 9:50 am, Thomas Morley wrote:
> Though, I'd think you should rethink whatever you plan, I'm very
> skeptic about always resetting a toplevel defined list.
> It's too destructive.

Also, it is convention to use an exclamation point as a suffix when
naming procedures that may modify the structure of arguments to produce
their results.  This makes it easier for users to know where side
effects might exist.

Consider this:

%%%%
#(define (1+last! lst) (list-set! lst (- (length lst) 1) (1+ (last
lst))))

#(define foo '(1 2 3))
#(1+last! foo)
#(format #t "\nfoo = ~a" foo)
#(1+last! foo)
#(format #t "\nfoo = ~a" foo)
%%%%


-- Aaron Hill

_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user

reply via email to

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