On 1/13/2019 1:49 PM, Alexis King wrote:
Disclaimer: this answer is extremely non-authoritative.

Ditto.

I think that, in Racket, the terms are used more or less interchangeably. The technical term is “procedure”, but as you point out, the term “function” is also used to mean the same thing. I don’t believe there is any distinction there that would be universally understood.

On the other hand, in How to Design Programs (and its various teaching languages), my understanding is that “function” is the correct term and “procedure” is strongly discouraged. The documentation on implementing new teachpacks supports this understanding, in a section entitled Prohibited Words <http://docs.racket-lang.org/htdp/index.html#(part._.Prohibited_.Words)>. It states explicitly that “function” should be used instead of “procedure”, “selector”, “constructor”, or any number of other terms. It includes the following justification:

These guidelines use few terms intentionally, emphasizing commonality among concepts rather than technical precision (which most students do not appreciate anyway).

I imagine others on this list who wrote the above words can give a more authoritative answer should they find this one inadequate. :)

Alexis


Back in the day, "procedures" and "functions" were both considered a form of "subroutine"  [see compiler texts from 70s .. 90s].  They were distinguished from inline (GOTO) subroutines by being lexically scoped and taking arguments.   Additionally, there was the distinction that (like its mathematical counterpart) a "function" computed something and returned a value (or values), while a "procedure" primarily was intended to create side effects and (importantly) DID NOT return a value.

Pascal enshrined that last distinction in its syntax, but it existed already in earlier languages.

Scheme uses the term "procedure" I *think* because it was influenced by Algol.  For whatever reason, Algol called subroutines "proc" consistently regardless of whether they returned a value.  Possibly Algol's designers did that deliberately to avoid association with mathematical "functions".

Racket began as PLT Scheme and remains (relatively) closely associated with Scheme.  So it's not surprising that there are wrinkles in the documentation.


Aside:  also back in the day, the term  "pure procedural"  referred to programming without functions.  PP subsumed the notion of CPS, but was not synonymous with it - if the language supported it, procedures were permitted [in Ada parlance] to have "OUT" or "INOUT" parameters, through which results could be passed back up the call chain.


To Ellen:  You might wish to educate your students re: the history. For modern use I think Alexis is right - the terms are used more or less interchangeably and the historical distinctions largely have become meaningless.

YMMV,
George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to