I'm not entirely sure where I got that from, but to me a procedure is a
("impure") function with possible side effects (printing, mutating a global
variable, sending emails, etc.). By contrast, in any given context, a
function is (again, to me) synonymous with "pure function"(*) and can be
called with the same values and will always return the same value, and
could in principle be substituted with any other function implementating
the same input-output specification without changing the meaning of the
whole program.

(*) https://en.wikipedia.org/wiki/Pure_function

On Sun, Jan 13, 2019 at 8:30 PM George Neuner <gneun...@comcast.net> wrote:

>
> 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.
>

-- 
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