lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme set list function


From: Urs Liska
Subject: Re: scheme set list function
Date: Mon, 08 Apr 2019 07:07:10 +0200
User-agent: K-9 Mail for Android


Am 8. April 2019 03:01:26 MESZ schrieb Andrew Bernard <address@hidden>:
>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/

I found that book pretty hard to digest, but indeed working through it (well, 
at least many parts of it) was the single most important breakthrough for me 
regarding the understanding of Scheme.

Urs


>
>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 <address@hidden>
>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?
>>



reply via email to

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