lilypond-user
[Top][All Lists]
Advanced

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

Re: Bug with transpose in functions


From: David Kastrup
Subject: Re: Bug with transpose in functions
Date: Fri, 12 Jul 2019 21:54:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Wols Lists <address@hidden> writes:

> On 12/07/19 19:04, Werner LEMBERG wrote:
>> 
>>> Functions like transpose act destructively on their argument, so you
>>> need a copy or the original will get changed.  [...]
>> 
>> How can Joe User find out whether a function is acting destructively?
>> 
> Computer pedant here :-)
>
> Functions do not have side effects, and for any given input they
> always return the same output. So if this is a PROPER function, it
> cannot act destructively :-)

Nobody said it was.  In computer parlese, functions of the kind you
describe are commonly called pure functions.  Nobody said that music
functions were of that kind.

> Obviously it isn't, so it's technically a subroutine that returns a
> value. Dunno how you tell the difference, but that's why you get
> computer languages where all variables are "write once" - everything
> is based on proper functions.
>
> Maybe the documentation should make a point of saying whether
> functions are "proper" or "improper". :-)

I was pretty sure that I wrote some treatise on that but a superficial
search did not turn it up, and if I do not manage to find some treatise
with a superficial search, it would be too much to expect for a new
user.

-- 
David Kastrup



reply via email to

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