See here and count the number of <>s in here, for example. “What time is it? time cannot be a function because Racket is call-by-value and not call-by-name.

Using square brackets in a few key places makes Racket code even more readable. In the same way that parenthesized output should not be confused with expressions, a printed symbol should not be confused with an identifier.

Step four: write a function to swap vector elements. In the terminology of Racket, this kind of calculator is called a read-eval-print loop or REPL.

However: Even if Racket turns out to be not suitable for industry programming, I’m still going to use it as a vehicle for language experimentation. I like the flexibility given by many let-forms (there are let, let*, letrec, and let-values + let*-values + letrec-values for binding multiple outputs), but I feel that they all should’ve been just one let with optional modifiers. (Thanks to chapter 16 of Racket Guide.). Hm. Otherwise, else-expr is evaluated, and its results are the result for the if form.

Back to definitions. for characters.

I just noticed a “Debug” button in DrRacket. Everything needed is there, but it’s not very convenient to use. C’mon, I understand why all these things exist, but why expose them? Given that reading every chapter of TRG raises lots of questions and provokes endless tinkering with not-quite-related concepts, I’ll be happy if I manage to read as much as chapter 2.4.

But I’d prefer for it to be a standard feature.

I bet I would’ve made this mistake eventually if not for this warning (and I’m not sure I won’t make it anyway). It may not be a language I will program in, but I can probably make out of it a language I love to program in. In the similar venue, why does length only work on lists? Discussion on c2 wiki concedes that “it’s an accident of history, as with most notations”. If I define what I’m using more precisely, I can further strip the executable: The module system is designed to avoid these problems, so start with #lang, and you’ll be happier with Racket in the long run.

Support for functional paradigm is somewhere in the middle. I made myself a reference table for list functions: Update: originally I had here apply and and apply or for Haskell’s and and or, but they don’t actually work due to and and or being macros and not functions.

; can it be something like eq?. You type a Racket expression, hit the Return key, and the answer is printed. It doesn’t work. The conversion enables a kind of general infix notation: This two-dot convention is non-traditional, and it has essentially nothing to do with the dot notation for non-list pairs. Now that’s better. Normally, .

And I think I saw it mentioned somewhere in the table of contents….