<font size="2">Before I discovered Python a couple of years ago I was experimenting with a pseudo-code approach for expressing math concepts. </font><font size="2">I had this kind of stuff in mind:<br><br></font>
<div style="margin-left: 40px;"><font size="2">factorial(n):</font><br><font size="2"> if n < 2 ---> 1</font><br>
<font size="2"> else ---> n*factorial(n-1)</font><br></div>
<font size="2"><br>No particular official syntactical rules here, just an attempt to organize ideas. Imagine my delight when I first saw Python! I started laughing.</font><br><br>I think some kind of a CTL approach would be especially good for a math curriculum. Maybe instead of 'Computer' TL, call it 'Computational' TL. It's what algebra should be these days. And if your CTL also RUNS, well, so much the better.<br>
<font size="2"><br>Most
students, and probably most people, would read "2 + 2" as "2 plus 2",
but notice how much more mathematically and computationally effective
it would be if they could develop the habit of reading or thinking of
"2 + 2" as "the sum of 2 and 2" or "sum(2, 2)". Think of the whole, the resulting value.<br>
<br>
And how about "2 + 3 * 4"? Again, the typical reading would be "2 plus 3
times 4", and that's ambiguous, and so in math classes
we have to talk about 'order of operations', and
usually the only justification we give for 'order of operations' is
that we have to have some kind of social agreements in place in order to avoid
confusion. Right?<br>
<br>However, it is again more mathematically effective to read "2 + 3 *
4" as "the sum of 2 and the product of 3 and 4", or, sum(2, product(3,
4)). No ambiguity there! And this is how you have to think when you
hook chains of functions together. This kind of stuff could be done very early in the curriculum. Doesn't have to wait for either advanced math classes or computer science. <br>
<br>Math teachers often
forget, or are unaware, that the ordinary arithmetic operators are themselves
functions. I think it would be good for math classes to explore this kind of functional composition for very simple ideas. </font><font size="2"><br><br></font><font size="2">By the way, we started studying sequences today in class. What's a really good Pythonic tool for studying sequences ---> generators!<br>
<br>- Michel<br></font><br><br><div class="gmail_quote">On Mon, Mar 2, 2009 at 9:01 AM, David MacQuigg <span dir="ltr"><<a href="mailto:macquigg@ece.arizona.edu">macquigg@ece.arizona.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Apologies for the munged formatting of my original message. Here it is with leading dots to preserve the indent.<br>
<br>
To: <a href="mailto:edu-sig@python.org">edu-sig@python.org</a><br>
Subject: CTL: Computer Thinking Language<br>
<br>
There is an interesting article in the latest ACM {Human Computing Skills: Rethinking the K-12 Experience, Fletcher & Lu, Communications of the ACM, Feb.09, p.23}.<br>
<br>
The authors make a strong case for re-vamping our curricula:<br>
<br>
. despite our best efforts to articulate that CS is more than just programming ...<br>
. computational thinking (CT) as a skill on a par with reading, writing and arithmetic ... places the core of CS, we believe<br>
. correctly, in the category of basic knowledge.<br>
. proficiency in computational thinking helps us systematically and efficiently process information and tasks.<br>
. lay the foundations of CT long before students experience their first programming language.<br>
. Programming is to CS what proof construction is to mathematics, and what literary analysis is to English.<br>
<br>
Then they move to more more controversial statements:<br>
<br>
. Knowledge of programming should not be necessary to proclaim literacy in basic computer science.<br>
. Substantial preparation in computational thinking is required before students enroll in programming courses.<br>
<br>
and a specific proposal:<br>
<br>
. a computational thinking language (CTL) that captures core CT concepts must permeate the pedagogy.<br>
. not a programming language, but rather vocabularies and symbols that can be used to annotate and describe computation,<br>
. abstraction, and information and provide notation around which semantic understanding of computational processes can be hung.<br>
<br>
They give as an example, a description of Euclid's algorithm for finding the greatest common divisor. They suggest a syntax, which I transcribe here using <lamba> as the Greek lower-case lambda:<br>
<br>
. <lambda> a,b. if a<b,(a, b-a); else (a-b, b)<br>
<br>
At this point, they really lost me. Why would anyone go to this much effort to avoid programming language. Python's equivalent statement is just as simple (although a bit odd in its ordering):<br>
<br>
. lambda a,b: (a, b-a) if (a<b) else (a-b, b)<br>
<br>
Have these guys never heard of Python?<br>
<br>
I think the problem may be a need to avoid favoring one language over another. Any time you make a proposal to use a specific language, you get immediate opposition from folks who favor another language. In my department (Java & C++), and at our community college (Java, BASIC, Alice), I seem to have been labeled as the "Python guy", pushing "yet another language", or even worse, the guy who wants to get rid of type declarations. Python is seen as a "scripting language", something equivalent to csh or bash. To avoid being pigeonholed, I now just say "we need a more agile language".<br>
<br>
I can see the need for a CTL, and I wouldn't object to it being something other than Python, and I'm all in favor of being "fair" to the other languages. The one requirement I would insist on is that the language "compute", i.e. no ambiguity as to a result (no psuedocode). It would also be nice if CTL could be automatically translated to a real computer language, so there is a smooth transition when students are ready for the real thing. Students could test their CTL by popping it into the translator, running it in a real interpreter, and getting immediate feedback.<br>
<br>
CTL should certainly include simple functions like min(), max(), sum(), and sqrt(). It could also include functions like range(a,b), introducing the idea that functions can return something besides numbers. At this point there may be some controversy over how to treat the endpoints, but that could be worked out in compromise between the different languages.<br>
<br>
Moving on to week three of the lesson plan, we could introduce the idea of defining our own functions, adding new concepts one at a time.<br>
<br>
f(a,b): (a+b)/2 # a simple function<br>
f(a,b): (a+b)/(2*pi) # with an "outside" variable<br>
f(a,b): if a<b,(a, b-a); else (a-b, b) # adding some conditional logic<br>
f(a,b): a2 = a**2; b2 = b**2; return (a2 + b2)/2 # temporary variables and a statement sequence<br>
<br>
# control flow with multiple statements<br>
f(a,b): if a<(b-5), return a; if (b-5)<=a<=(b+5), return (a+b)/2; return b<br>
<br>
# recursion<br>
f(a,b): if a<b, f(a, b-a); elif b<a, f(a-b, b); else (a,b)<br>
<br>
This is a bit Pythonic, but only because I'm more familiar with Python than Ruby or Lua, or some other language that might like to contribute some gems. We could even invite Java, if she will come down to this level. :>)<br>
<br>
What else do we need in CTL? Would anyone like to join me in defining this new "language"? I'll write the translator to Python.<br>
<br>
-- Dave<br>
************************************************************ *<br>
* David MacQuigg, PhD email: macquigg at <a href="http://ece.arizona.edu" target="_blank">ece.arizona.edu</a> * *<br>
* Research Associate phone: USA 520-721-4583 * * *<br>
* ECE Department, University of Arizona * * *<br>
* 9320 East Mikelyn Lane * * *<br>
* <a href="http://purl.net/macquigg" target="_blank">http://purl.net/macquigg</a> Tucson, Arizona 85710 *<br>
************************************************************ *<br>
<br>
<br>
_______________________________________________<br>
Edu-sig mailing list<br>
<a href="mailto:Edu-sig@python.org">Edu-sig@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/edu-sig" target="_blank">http://mail.python.org/mailman/listinfo/edu-sig</a><br>
</blockquote></div><br>