lilypond-user
[Top][All Lists]
Advanced

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

Re: "procedure" vs. "function"


From: Urs Liska
Subject: Re: "procedure" vs. "function"
Date: Sun, 19 Apr 2015 11:01:21 +0200
User-agent: K-9 Mail for Android


Am 19. April 2015 10:35:08 MESZ, schrieb Andrew Bernard <address@hidden>:
>Well if you consult the bible Structure and Interpretation of Computer
>Programs by Abelson, Sussman, and Sussman, the term function is
>strictly reserved for mathematical objects, and procedure is uniformly
>used for what people loosely call functions.
>
>As to the discussion about the distinction between procedure and
>function in other languages, from a pure functional programming
>viewpoint a procedure in Pascal and so on is called purely for its side
>effects, on global variables (horror!) for example,  which is why it
>does not return a value, and this is a complete abomination. Of course
>Scheme is a functional language but not pure like Haskell, so this is
>academic in the context of lilypond. Still preferable to avoid
>procedures that are invoked purely for side effects whether your
>language is pure or impure.
>
>So the guile manual is correct to uniformly use the term procedure. But
>if you look at the Racket manual they consistently use the term
>Functions (Procedures) in headings, so they are somewhat looser.
>
>In short, procedure and function are most certainly not synonyms in
>Scheme terminology.
>

Well, I'm still not clear about that really.

As far as I have understood the discussion everything that is called as
(Identifier arg1 arg2 ...)
should be called a procedure in Guile's terminology. Such a procedure can 
evaluate to something or not (in which case the expression's type/value is 
<unspecified>. 

These procedures can also be referred to as functions which is (strictly 
speaking) against the Guile terminology, but doesn't actually pose a problem.
If I'm not mistaken LilyPond’s naming of define-music-function and the type 
<Music Function procedure f# ...> are similarly against the Guile terminology. 
Referring to the fact it does return a value doesn't really make sense as 
that's what procedures do in Guile and because define-void-function creates a 
procedure without return value.

Is that correct?

Urs


>Andrew




reply via email to

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