DrRacket's Stepper

I just started reading How to Design Programs (HTDP), a book that focuses on teaching the concepts of programming to the reader via Scheme. Now if you've read or heard of Structure and Interpretation of Computer Programs (SICP) but not HTDP and wondering why it isn't popular, this comment on Hacker News sums it up. Navigating through the online version of the book, it feels like it's a much better alternative to beginners, than SICP which assumes that you atleast have average math skills (my overall math skills are ok, but Calculus... I cannot drink and derive like many ;)

In section-2, the book mentions the use of the Stepper in DrRacket. I tried it assuming that it's going to suck, but the interface is the best I've seen for a stepper. Here's a bunch of screenshots taken while stepping through a simple program, with a procedure to evaluate the number, that results in the concatenation of the reverse of 3 integers (easier using string functions right? but we are asked to use a math formula which sounds cool actually).

Stepper-1
Stepper-2
Stepper-3
Stepper-4
Stepper-5

 

Most interfaces for debuggers are scary with a lot of buttons or text in the interface. But this interface impresses me. It's simple but versatile with step numbers, options to jump to any particular step, substitutes values in-place and also highlights them with a color pleasing to the eye (atleast to mine).

 

P.S: "convert3"??? I'm not bad at naming functions. When you name functions according to what the exercise in the book specifies, you get to test your programs with the TeachPacks that come with it (supported by DrRacket).

Posted
 

Latent type systems

A lot of people echo the fact that learning Lisp teaches you a lot of concepts in computer science. I was confused with choosing a particular implementation of Lisp (tried a bunch) and felt lazy to skim through the tutorial or documentation of each of those implementations of Lisp. Finally, I just decided to read the R5RS paper (A paper about Scheme). And I'm excited to say that I learnt something new while just reading the Overview section of the paper.

Scheme has latent as opposed to manifest types
And that caught my eye. A bit of searching led me here, which explains Latent type systems in a really simple way.

From my understanding of that awesome piece of explanation, labeling Lisp as a dynamically-typed language is very mis-leading.

"Latent" describes types from a syntactic perspective while the terms "Dynamic" or "Static" describes types from a run-time perspective.

And I'm sure that's confusing. Consider the following variable in Java:

String name;
(Yes! Java is static). And not latent. But the following is latent.

(define x 1)
You don't say it's of a particular type. The interpreter or compiler understands it and plays it's own game (static or dynamic). Now this might be dynamic or static in run-time, but just look at the syntax. It's LATENT :)

P.S: I guess a language like ruby is an example for having latent type system. But do correct me if I'm wrong. Really waiting for someone into Lisp to say if that's right.
Posted