[Edu-sig] CTL: Computer Thinking Language

michel paul mpaul213 at gmail.com
Mon Mar 2 19:00:14 CET 2009


Before I discovered Python a couple of years ago I was experimenting with a
pseudo-code approach for expressing math concepts.  I had this kind of stuff
in mind:

factorial(n):
    if n < 2 ---> 1
    else ---> n*factorial(n-1)

No particular official syntactical rules here, just an attempt to organize
ideas.  Imagine my delight when I first saw Python!  I started laughing.

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.

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.

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?

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.

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.

By the way, we started studying sequences today in class.  What's a really
good Pythonic tool for studying sequences ---> generators!

- Michel


On Mon, Mar 2, 2009 at 9:01 AM, David MacQuigg <macquigg at ece.arizona.edu>wrote:

> Apologies for the munged formatting of my original message.  Here it is
> with leading dots to preserve the indent.
>
> To: edu-sig at python.org
> Subject: CTL: Computer Thinking Language
>
> 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}.
>
> The authors make a strong case for re-vamping our curricula:
>
> .   despite our best efforts to articulate that CS is more than just
> programming ...
> .   computational thinking (CT) as a skill on a par with reading, writing
> and arithmetic ... places the core of CS, we believe
> .   correctly, in the category of basic knowledge.
> .   proficiency in computational thinking helps us systematically and
> efficiently process information and tasks.
> .   lay the foundations of CT long before students experience their first
> programming language.
> .   Programming is to CS what proof construction is to mathematics, and
> what literary analysis is to English.
>
> Then they move to more more controversial statements:
>
> .   Knowledge of programming should not be necessary to proclaim literacy
> in basic computer science.
> .   Substantial preparation in computational thinking is required before
> students enroll in programming courses.
>
> and a specific proposal:
>
> .   a computational thinking language (CTL) that captures core CT concepts
> must permeate the pedagogy.
> .   not a programming language, but rather vocabularies and symbols that
> can be used to annotate and describe computation,
> .   abstraction, and information and provide notation around which semantic
> understanding of computational processes can be hung.
>
> 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:
>
> .   <lambda> a,b. if a<b,(a, b-a); else (a-b, b)
>
> 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):
>
> .   lambda a,b: (a, b-a) if (a<b) else (a-b, b)
>
> Have these guys never heard of Python?
>
> 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".
>
> 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.
>
> 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.
>
> 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.
>
> f(a,b): (a+b)/2           # a simple function
> f(a,b): (a+b)/(2*pi)           # with an "outside" variable
> f(a,b): if a<b,(a, b-a); else (a-b, b)   # adding some conditional logic
> f(a,b): a2 = a**2; b2 = b**2; return (a2 + b2)/2  # temporary variables and
> a statement sequence
>
> #  control flow with multiple statements
> f(a,b): if a<(b-5), return a; if (b-5)<=a<=(b+5), return (a+b)/2; return b
>
> #  recursion
> f(a,b): if a<b, f(a, b-a); elif b<a, f(a-b, b); else (a,b)
>
> 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.  :>)
>
> 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.
>
> -- Dave
> ************************************************************     *
> * David MacQuigg, PhD    email: macquigg at ece.arizona.edu   *  *
> * Research Associate                phone: USA 520-721-4583   *  *  *
> * ECE Department, University of Arizona                       *  *  *
> *                                 9320 East Mikelyn Lane       * * *
> * http://purl.net/macquigg        Tucson, Arizona 85710          *
> ************************************************************     *
>
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20090302/f9eb2636/attachment-0001.htm>


More information about the Edu-sig mailing list