From: Pal-Kristian Engstad <pal_engstad@naughtydog.com>
To: Vincent Aravantinos <vincent.aravantinos@yahoo.fr>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Re: Re: Teaching bottomline, part 3: what should improve.
Date: Wed, 23 May 2007 10:05:10 -0700 [thread overview]
Message-ID: <46547446.2000408@naughtydog.com> (raw)
In-Reply-To: <3A6A724D-68A1-4D21-8EF8-7B39F64110E6@yahoo.fr>
Vincent Aravantinos wrote:
> Those are typically the comments of a "used-to-functional-programming"
> guy.
> It certainly doesn't match what a beginner would think (no beginner
> will call a
> function a "value").
This reminds me of a "game" I used to teach my math students the concept
of a function. I think it should be able to be used for an introductory
computer science class as well.
Essentially, the game involves having person A come up with a rule.
Person B will have to provide an input value, and A has to faithfully
give the result of the rule/computation. Examples of functions could be
\x->x+2, \x->2*x, etc. More interesting examples involves the function
that returns the first letter of the name of the input (f "one" = "o"),
or the successor of a "red, yellow, green" traffic light symbol.
When doing this, A and B will quickly have to agree on the allowed input
values (the domain) and in order to have a chance it is also helpful if
B knows the range of output values (the image). And for sure - they will
have to agree that the rule x = y => f(x) = f(y) has to hold in order to
be able to guess what "f" is. [I would also disallow closures for this
game - otherwise it would be too hard to guess.]
The reason this exercise is good is that it teaches the students (in a
fun way) the important concepts behind a function. It will make them
understand that a function is just a computation, but also point out the
importance of defining the types (sets) of inputs and outputs. I think
that after playing this game, you can venture to talk about the "name"
of the function, and they will realize that it does not matter what the
name of the function is - just what it does.
Perhaps after this, you can teach the concept of treating a function as
a value, or input to another function? Person A makes a function that
takes person B's function, etc.
Thanks,
PKE
--
Pål-Kristian Engstad (engstad@naughtydog.com), Lead Graphics & Engine Programmer,
"Uncharted"-team, Naughty Dog, Inc., 1601 Cloverfield Blvd, 6000 North,
Santa Monica, CA 90404, USA. Ph.: (310) 633-9112.
"Most of us would do well to remember that there is a reason Carmack
is Carmack, and we are not Carmack.",
Jonathan Blow, 2/1/2006, GD Algo Mailing List
next prev parent reply other threads:[~2007-05-23 17:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070523100002.6B193BC73@yquem.inria.fr>
2007-05-23 11:00 ` Vincent Aravantinos
2007-05-23 13:21 ` [Caml-list] " Loup Vaillant
2007-05-23 17:05 ` Pal-Kristian Engstad [this message]
2007-05-23 17:16 ` Pal-Kristian Engstad
2007-05-23 17:57 ` Robert C Fischer
[not found] <20070523132200.F3857BC82@yquem.inria.fr>
2007-05-23 14:04 ` Vincent Aravantinos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46547446.2000408@naughtydog.com \
--to=pal_engstad@naughtydog.com \
--cc=caml-list@yquem.inria.fr \
--cc=vincent.aravantinos@yahoo.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox