Teaching kids to program in their native language

Friday, March 4, 2016

Today we introduce two programs to help kids program in their native language — clojure-turtle and clj-thamil. Both are written in Clojure, a dialect of Lisp that runs on the Java Virtual Machine. What makes Clojure unique is its simple design which can help make the path for kids to learn programming easier.

clojure-turtle: a bridge between logo beginners and lisp experts

For some beginners, the Clojure learning curve has been steep in the area of functions and functional programming. Many students learning to program prefer to start instead with Logo, a dialect of Lisp that is used in Scratch and teaching efforts such as We designed clojure-turtle with this in mind.

The clojure-turtle project was created to bridge the gap between the people using Lisp at opposite ends of the spectrum. It’s for those learning to program for the first time and those with “real-world concerns” who write macros. The project implements Logo in Clojure, and remains faithful to the basics of Logo (forward 10),  (right 90), etc.  But the door is left open for you to blur the lines of Logo/Clojure, beginner/FP, etc.:

(defn square-by-length
 (repeat 4 (all (forward side-length) (right 90))))

(defn mirrored [f]
 (fn [& args]
   (repeat 2 (all (apply f args) (right 180)))))

(def lengths [40 50 60])
(map (mirrored square-by-length) lengths)
One place where the Logo in Clojure approach of clojure-turtle has already proven successful is in ClojureBridge, a workshop for beginners aimed at increasing the number of people from underrepresented minority groups within the Clojure community. The section on teaching functions had been challenging for students previously, but students now learning through the Logo-based approach move past it with ease onto higher level concepts.

clj-thamil: programming in your native language

When I originally set out to create a library for processing for the Thamil language, I stumbled upon the realization that I could also program in the Thamil language. Functions are first-class data, which can be assigned to new names. But macros are what enable me to “translate” the rest of Clojure from English to Thamil, doing so in the form of a library, without having to modify the compiler, and in a manner that is generic for any language to use. Now, a function to pluralize a word in Thamil can be itself written in Thamil. In my Clojure/West talk on clj-thamil, I talked about the potential impact on increasing diversity among programmers, especially when we consider the number of people globally who do not have access to a (good) English education that is an implicit prerequisite for learning to program.

Putting the two together: learning Logo in your native language

The approach of clj-thamil is flexible and powerful enough that we can “translate” any code, not just the core of Clojure. So why not translate clojure-turtle in less than 30 lines of code? Here is a video demonstrating the use of Logo in the Thamil language:

The simple concepts of Logo soften the learning curve for programming and can make it fun for all ages! The simplicity of Clojure gives it a power that you can use to shape the program to your will — students can write all their code in a non-English language if they want. The combination of simple concepts can make it  possible to teach programming to kids around the world who do not speak English. I hope that clojure-turtle and clj-thamil can be used to improve literacy and diversity for students learning to code.

Visit the clojure-turtle Github page and the clj-thamil Github page to learn more, sign up for the mailing lists and contribute patches for features.

By Elango Cheran, Software Engineering