[plt-scheme] HtDP: 'Function' or 'Program' or 'Method'?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Nov 26 17:22:24 EST 2008

On Nov 26, 2008, at 5:15 PM, Prabhakar Ragde wrote:

> Matthias wrote:
>
>> Functions for individual things at the beginning. We remind them  
>> of  the mathematical functions they got to know and hate in  
>> boring  algebra and precalc courses.
>> As they write several functions to solve problems, we start  
>> mingling  functions and programs.
>
> But you never call a single function definition a "program", right?


I do. I identify programs and functions for a week or two, and that's  
fair.


> The grammars

(too formal, stay loose)


> for the teaching languages make it clear that a program is a  
> sequence of definitions and expressions. In assignments in our  
> first course, I always say "write a function", but use "write a  
> program" in the second course when we are having them do explicit I/ 
> O with file redirection on the command line.
>
> I never use the word "method", because those who have learned Java  
> or some other such language need to get it out of their heads long  
> enough to actually learn the HtDP material. --PR


A method is an object-specific specification of a computation that is  
like a function:

  f(o) from FP becomes o.f() in OO

The o argument is now referred to as _this_ (aka as _self_). When a  
method definition does not use _this_ it isn't a method but a static  
method.

-- Matthias



Posted on the users mailing list.