Hi r/scheme, my little brother (11) is interested in programming. Since he doesn’t know what he wants to make yet, I feel like scheme could be a good first language to learn the basics, paired with “The Little Schemer”, a book I worked through when I was younger that I feel like he’d like and would teach him some solid CS foundations. Any input on this?
My reco would be How to Design Programs. It is free online and it is fabulous
No. Scheme is good last language.
It sucks, because all other languages he will encounter afterwards will pale in comparison.
There is Smalltalk (Pharo), Erlang/Elixir, Haskell, and Forth. Each uses very interesting and distinct ideas that are a joy.
My heart is with Lisp but looking with other languages is fun every once in a while.
Scheme was my first general programming language and was a pleasure to learn CS concepts with, admittedly I was much older though.
Don’t want to hijack the thread, being a Scheme fan myself. But I second Smalltalk (Pharo or Squeak) as an alternative to consider in case Scheme is discarded for some reason. It shares many characteristics with Scheme/Racket, like a minimal, elegant syntax, user-friendly IDE and was also created for educational purposes.
Advantage of Scheme is that you usually get exposed to different programming paradigms, whereas Smalltalk is OOP. But basic functional concepts like lambda (blocks in Smalltalk parlance), map (collect:), filter (select:), fold (reduce:) etc. also play an important role in the language. In Scheme you apply functions to arguments, in Smalltalk you send messages to objects. Two beautiful, powerful approaches easy to learn.
One thing to consider is appropriate literature. For Racket there is also “Realm of Racket”, never read it, but could be worth a look, specially due to its focus on games. I started with SICP, best CS book I’ve ever read, but definitely not for that age. Regarding Smalltalk, no idea, I learned it by doing (daily job) and reading the docs, but for sure there are good books available, giving its age and early focus on education.
I was a “lab assistant” one semester so I got to see first hand people learning Scheme. Some people really get messed up by all the parenthesis which I’m sure detracted from their experience. Therefore if you go this route, I would suggest first spending some time with him learning how to setup and use a smart code editor with parenthesis matching, sexp indentation, sexp motion commands, etc. These are of course useful for any language but critical for Scheme programming. It probably didn’t help that (at the time at least) most scheme implementations had suboptimal error messages (for example, they don’t have line/column numbers).
Yeah I went through setting up DrRacket and stuff like that when I worked through Scheme the first time around, I’ll know what to show him. The Little Schemer uses functions that aren’t really in Scheme, like (atom?)
Yeah “atom?” doesn’t appear in r7rs. You could probably get away with (not (pair? x)) [[ unless '() isn’t an atom - its been a while! ]]
Hopefully there wouldn’t be too many of those. 🤷♂️
(define (atom? x) (not (pair? x)))
is the same as Common Lispatom
, but I’ve seen some Scheme texts that use versions that treat'()
as not an atom. Can be confusing if you have one definition in mind and look at something that uses the other.If (not (eq? '() #f)) then it may make sense to treat '() as non-atomic. “atomic?” would then be a cheap version of “list?”.
Scheme was my first language, which my dad introduced me to around the same age. In my opinion, it’s a great first language, but he’s unlikely to really appreciate it until he’s tried a few others.
Just here to second HtDP, and point to the How to Code course(s), with their emphasis on learning Systematic Program Design from the start, using Racket’s BSL (ie introductory Scheme)