Dijkstra said I am mentally mutilated — story about BASIC and Haskell

Posted on April 17, 2019

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.

Dijkstra, Edsger (1982)

BASIC

I happened to find some of my old BASIC textbooks at the attic that brought sweet memories. Reading the BASIC Cat code years later reminded me of Edsger’s quote…

From Boyan Yankov and Mishel Avramov , Basic for microcomputers, page 56 - 57. Basic for microcomputers

In a feeble attempt to prove Dijkstra wrong, I will rewrite the BASIC code shown above in HaskellHaskell An advanced, purely functional programming language

— one of the favorite programming languages of both Edsger and me.

I am not going to throw a full blown monadic rewrite here. Instead I will keep the code close to the original so we can see how they were solving basic animation problems back then.

The most difficult part of porting the BASIC to Haskell was setting up OpenGL under NixOS. But the net result looks exactly like years ago:

Render of the cat made with gloss and Haskell Render of the cat made with gloss & and Haskell

You can find the code on github.

Still… I keep asking myself - am I really mentally mutilated? Should I go with type recursion with functors and catamorphisms, in the spirit of The Evolution of a Haskell Programmer, to prove Dijkstra wrong ?

I will leave that for another blog post. Wish you all a happy and productive day!