Live data from Hacker News

Why learn Racket? A student's perspective

micahcantor.com

1–10 of 55 posts

Re: Why learn Racket? A student's perspective

#4
post #2

Nice writeup, keep it up!

I agree, keep writing.

I have spent a lot of my professional life using Lisp languages. Not as popular as Python, Java, etc., but Lisp (and other languages like Haskell) have a good effect on how we think about computation.

Re: Why learn Racket? A student's perspective

#5
It is interesting that recursion is still considered to be so novel on blogs and forums. From what I have seen of current CS curriculums, recursion is usually taught in the first year immediately after introductory CS. It is almost impossible not to use recursion when dealing with tree structures (using an explicit stack takes a lot more code, most coding interviews don't ask for an iterative solution unless absolutely necessary).

Re: Why learn Racket? A student's perspective

#7
Great writing and I agree with these points. I learned Racket by working through HTDP [1] and although I've never used Racket for anything other than those exercises it was totally worth it. I think it (the language and HTDP) massively improved the way I think through, organize, and write everything else.

[1]: https://htdp.org/

Re: Why learn Racket? A student's perspective

#8
The point about simple evaluation models, while true for basic Racket, is actually the furthest from the truth in idiomatic Racket.

The idiomatic way to solve a problem in Racket is to develop new syntax (and evaluation orders) which are suited to the problem.

In fact, Racket has pythonic list comprehension syntax too:

    (for/list ([x '(2 4 8)]) (sqr x))
It also has lazy evaluation langs, static typecheck pre-eval step langs, DFA compilers, OOP...

Basically the floodgates are open, even if the river is still a bit barren. Every confusing language feature in existence can be added to Racket. The only saving grace is that anyone, including you, can replace it with less confusing syntax / evaluation orders if they so desire.

I wrote a Macro which adds identifiers to your program based on a SQLite database's column names. [0] If the database isn't found your program does not compile. How is that for confusing alternative evaluation order? If that's your nightmare, my point is made.

[0]: http://tech.perpetua.io/2022/01/generating-sqlite-bindings-w...

Re: Why learn Racket? A student's perspective

#9
One aspect of Racket that I would expect to appeal to students, but which does not appear in this blog post, is its cross-platform (and widget-native!) GUI framework:

https://docs.racket-lang.org/gui/

The first "side-project" I ever did was a tic-tac-toe program in Java AWT during my first year of programming in high school. AWT wasn't even part of the curriculum, it was just what I gravitated towards as a 13-year-old whose experience with computers consisted entirely of graphical applications.

Maybe the kids these days would be more interested in building a web app or something, but frankly I don't think it's surprising that writing code that primarily consumes and emits text at a terminal is not interesting to students who have never had any need for a terminal before.

Re: Why learn Racket? A student's perspective

#10
I always say my appreciation for functional programming comes from having spent enough time in imperative hell.

That being said I think learning programming in an "expressions only" environment can enable the student to deal with more complex problems earlier, merely by making certain types of errors impossible.

I think the Elm programming language is the sweet spot for that.

- it does have elegant (Haskell like) syntax

- it has still a simple syntax because it deliberately omits certain features (namely typeclasses, do-notation)

- it has a self contained build system (compiler, package manager, repl, dev server) with a rich ecosystem of libraries

- it is comparatively easy to ship something tangible because it compiles to JS for the browser

Post reply on HN