2008 02 25

As you all know by now, I am currently teaching the Scheme programming language to my 2nd year students as a means to master the functional programming paradigm.

I started four weeks ago with a general introduction on programming paradigms and on the necessity to at least know the most important ones in order to become a decent programmer. As my students had already studied imperative and object-oriented programming become coming to my class, I offered them to teach functional programming (using Scheme), logic programming (using Prolog in principle) and scripting (using Ruby). This first lecture can be downloaded here.

The following week, I introduced Scheme by putting a lot of accent on the evaluation of expression and the definition of simple (mathematical functions). The lecture, which is available here, was followed by a lab sheet where the students were introduced to DrScheme and were asked to write a number of simple functions (like fahrenheit->celcius).

The next lecture was on recursion and I focussed on a number of mathematical functions like factorial, fibonacci, square root using Newton’s successive approximation etc. I spent some time introducing the concept of tail-recursion to them as well as the tail-recursion optimization that Scheme has to do.

As an example, this:

(define (o+ n m)
  (cond ((zero? m) n)
        (else (o+ (add1 n) (sub1 m)))))

runs in constant space (i.e. there are no recursive function calls at runtime) even though it is expressed recursively. During the lab, the students implemented and traced a number of recursive functions (using the tracing facilities found in MzScheme). They implemented o+’s friends, o-, o*, o/, o^, o=, o< and o> (corresponding, of course, to our usual +, -, *, /, ^, =, < and >) using tail-recursion so that they run as quickly as possible.

The last lecture which I had last Friday was on pairs and lists, the most fundamental compound data structures found in Scheme. I introduced them to car and cdr and showed them a number of fundamental algorithms acting on lists (like length). During the lab, I asked the students to implement a simple database of students and marks and this is inspired by what I read in Practical Common Lisp.

My observations

My lectures have been cool up to now. The students are lively and responsive to my jokes and “parentheses”. The labs also are going on nicely with students who are really learning new things and having fun in the process.

It’s too early to say whether they’ll become better programmers eventually but I feel they are on the right track…

Popularity: 4% [?]

written by avinash

2008 02 23

I’ve just finished watching Chak De India for the second time. And I have to say that I love this film!

I have a confidence to make: I normally don’t watch Bollywood films. A cousin of mine, Nishal, managed to convince me that Chak De India was really worth watching and I really don’t regret listening to him.

The film is about the women’s hockey team of India winning the world cup against all odds. That’s it. Nothing too complex. But it is excellent. It has pace and feels real (and this is exceptional for a Bollywood film which tend to be, ahem, surrealist). The casting is really excellent too with a good Shahrukh Khan and 16 fantastic (young) actresses (kudos to all of them).

I was watching the second DVD containing some extras including the UK premiere where Shahrukh Khan was asked his own definition of patriotism by a journalist. Without thinking, he answered (I’m paraphrasing here):

“Patriotism is when you do your best to succeed in whatever field you are. It has nothing to do with holding the flag of your country and singing glorious songs.”

Maybe our leaders can be inspired by this for the celebration of the 40th anniversary of the independence of Mauritius and come up with something that will really inspire our youngsters (and also the not-so-young) to achieve greatness.

Or maybe they wont and we’ll have to suffer yet another flag-raising ceremony followed by its usual “fête culturel”.

What do you think we should do for the 12th of March?

Popularity: 3% [?]

written by avinash

2008 02 21

It’s nine years today since Kaya died. Was he killed? Did he die naturally? No one (?) knows. And I am not sure I want to know what happened on that day.

What I do know instead is that Kaya (born Joseph Réginald Topize) was one among the greatest composers, musicians and singers born in Mauritius.

His legacy is his songs. I bought his Best Of, Seggae Experience, a few years ago and I’ve been playing two songs repeatedly today: Chant l’Amour and Ras Kouyon.

This first sentence from Chant l’Amour has very special meaning to me:

 

“Mo rapel quand mo ti zenfan
Mo zenseignant ti fini so lé temps
Pou faire moi comprend tou seki embalao”

 

(Translation: I remember when I was a kid, my teacher spent all his time teaching us useless things [instead of important things].) I always have this sentence in mind when I teach… and that’s why I guess I am a decent teacher.

One day I read something somewhere:

 

People in developed countries have tremendous respect for their artists…

 

Sometimes this sounds like “people in underdeveloped countries do not have any respect for their own artists”. (Of course, if someone remotely talented comes from Europe or from India, then we’ll all pay hundreds of rupees to go and watch that real artist…)

Maybe we’re still underdeveloped here.

RIP, Kaya.

Popularity: 2% [?]

written by avinash