When I TAed, a lot of incoming 2nd year students didn’t know how to do for loops yet, which really set them back for basic algorithms.
I had a much deeper appreciation for functional languages after theory of computation classes in my senior / 4th year.
They hadn't done simple recursive functions over lists? What had they been doing?
Been a while since I had to read introductory material for Racket (or any similar language), but as I recall functions with a base case exit and recursion is usually among the first things they teach.
I looked into the Racket Repo to find something, but had a hard time finding the code.
Other Schemes and Common Lisp have similar constructs. Just because a language is a lisp doesn't mean its primitives have to be implemented using cons cells.
https://www.khoury.northeastern.edu/home/lth/larceny/notes/n...
Cons cells are typically used to provide lists with O(n) access time.
Recursing over a list is a way to learn how to implement for, while and friends. If you know this technique understanding for is just understanding a subset of what you are already familiar with. It can be used to iterate over an arrays as well as lists, e.g. with ranges: https://docs.racket-lang.org/reference/pairs.html#%28def._%2...
Racket can also be used to teach object oriented programming and programming with structs, if the aim is to teach patterns used in C-like languages generally it's not a bad fit. Well, except advanced stuff like pointer witchery. Though you could probably implement a teaching language that does it with arrays or the byte code directly if you wanted to. It might be a good way to improve on error messages for pedagogical purposes.
Of course with years of experience it’s easy to interpolate one from the other but these are students who’ve had 4 months of exposure to programming that have to jump from functional languages into operating systems and data structures and algorithms, all of which are taught with imperative languages
This is surely a single point of anecdata, but it makes me suspect that it was more about how teaching was done than a 'functional vs. imperative' thing. I also suspect pointers and memory management to have been bigger hurdles than how to format code for iteration, unless the Racket course introduced techniques like quoting.
Racket serves its purpose well as a simple and fast to learn educational language; it's easy to see and understand recursion. It's also easy to see what the execution order of statements in your program.
I will say though that some problem sets were a bit brutal in terms of time taken to complete them.
I'm surprised anew on the rare occasions I come across statements like this. The first time was when I applied for my first programming elective class. The teacher actively tried to dissuade me from it, saying that by the end of term they'd be lucky if they even got to for-next or do-while loops. I was shocked, having first understood these from BASIC code listings in the back of magazines, with only one or two weeks per year having a few hours of access to an Apple II on which to actually run anything.
I tend to fall into the trap of feeling that loop constructs should be so trivial, that understanding should come from a tiny fraction of one class session plus maybe a few minutes tracing the code by hand. So, I thank you for being my irregularly scheduled reminder that people's first exposures to such things can be very different.