logoalt Hacker News

nobleachtoday at 4:00 PM4 repliesview on HN

Since a few folks here recommended Common Lisp to me as the language that would "tick all my boxes", I've been doing a deep dive. Right now, I'm working through SICP again with DrRacket. The first time I worked through it with MIT Scheme MANY years ago. It's shocking how much I've forgotten.

What I like about this article is that it walks through the different "camps" of Lisp. Scheme is so intriguing to me because of how small it can actually be. I can build nearly any paradigm I want to exist. The problem is, if I were to actually go find a job where they were using a Lisp, (I hear those actually exist) they wouldn't want to use my "Result monad + match statement - railway pattern" that I've used from OCaml and Rust. So learning something that is truly "common" can make more sense.

As far as learning though, Scheme feels "just right". I've imposed a "no AI until I've found a working solution" rule that keeps my mind engaged. Couple that with a willingness to say, "I don't know that right now... I'll think about it throughout the day and maybe by this evening I'll have an answer".


Replies

hackermailmantoday at 8:41 PM

In Sussman's book 'Software Design For Flexibility' he uses Match? in the pattern matching chapter to run on graphs. I think OCW archived his MIT course for the book too

show 1 reply
AyanamiKainetoday at 4:32 PM

I can also recommend clojure. For me it has the best parts of common lisp and the best of the java ecosystem. But its also quite different from common lisp and scheme. Different enough to find some unique ideas.

Writing scripts using [0] Babashka is also really nice.

[0] https://babashka.org/

show 3 replies
zackmorristoday at 6:54 PM

For what it's worth, Scheme was the first programming class that I took at UIUC around 1995, as I recall.

I had used C++ for several years to make shareware games, so I took a test to challenge some programming courses. I vaguely recall doing well, but my advisor encouraged me to take them anyway. I'm glad that I did, because I had little understanding of theory.

Funny story: the instructor never mentioned that we could use more than one line of code. So every single piece of homework that I handed in, and every test, was one giant line of nested logic. Which worked better than one might expect, and completely changed how I wrote code from that point forward. That's how I made the connection a decade later that functional programming is akin to a spreadsheet, as are higher-order method chains and immutable variables.

I think of Clojure as being a layer above Lisp, sort of like how Swift might be considered a layer above Objective-C/Smalltalk. However, bare Lisp has problems around not quite giving enough out of the box. It's minimalist enough that developers end up reinventing the wheel for things that should probably be provided by a layer/library similar to Scheme or Clojure.

To digress, I feel that mutable variables and even monads are a code smell in functional programming since they can cause impurity. They're more of a crutch to ease conversion of code from imperative languages. However, monads can be useful to simulate every path through a program, sort of like superposition in quantum mechanics and SAT solvers. So they aren't necessarily bad, just taught incorrectly, probably because they're so hard to grok.

I'd vote to settle on a series of layers like Common Lisp -> Scheme/Racket -> Clojure/Elisp, with the final layer providing the intersection of features available from the most widely-used Lisp variants. Note that this is specifically to form a bridge from imperative languages, so research work might need additional DSL features brought forth from the Racket layer.

Edit: I forgot to mention that Scheme is a good fit for genetic algorithms, see books by John Koza (no affiliation). My feeling is that we haven't seen anything yet regarding what problems AI can solve, since it's having to do it the "bare hands" way with LLMs and pattern matching.

sphtoday at 8:23 PM

I dislike Common Lisp, and I fear it keeps ruining the reputation of Lisp itself with its archaic and obtuse systems designed by a committee of dinosaurs. This opinion will attract the ire of many a greybeard. I stand by it.

If you want a Scheme with batteries included, I recommend GNU Guile. Also worth your time are Racket, Clojure, Janet.