Hi Gianmaria, Can you explain the purpose of nulling out the list?
I am somewhat concerned that there is a misunderstanding you have about Scheme. Scheme procedures are call-by-value. This means the arguments are evaluated and the value then passed to the procedure. The value of the parameter in the calling environment cannot be changed. This is how C and Scheme and many other languages work. [In C you can pass a pointer to alter a variable outside the function. but there is no such thing in Scheme - for good reasons.] It's not call-by-reference. https://en.wikipedia.org/wiki/Evaluation_strategy This is why what you are after can only be done with a macro, which is not a function and operates at the same top level as your list. I'll stop here as this could turn into a long explanation about Scheme. But I think you are approaching Scheme as though it were a normal procedural programming language, whereas it is far more fluent to use it in a more Lisp like, and functional programming way, if you can, pace the particular requirements of it being embedded in lilypond with guile. Can I refer you to Kent Dybvig's excellent book in Scheme? https://scheme.com/tspl4/ The thing that helped me the most with lilypond was learning Scheme properly and thoroughly. [Not meaning to teach you to suck eggs,] Andrew On Sun, 7 Apr 2019 at 01:11, Gianmaria Lari <gianmarial...@gmail.com> wrote: > > I think the problem is related to the fact resetList changes mylist > locally (sort of) but I have no idea how I can fix it. Any help? >
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user