# [Edu-sig] CTL: Computer Thinking Language

David MacQuigg macquigg at ece.arizona.edu
Sun Mar 1 22:02:37 CET 2009

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

```