Most active commenters
  • medo-bear(5)
  • iLemming(4)
  • Jeff_Brown(3)

←back to thread

Hofstadter on Lisp (1983)

(gist.github.com)
372 points Eric_WVGG | 26 comments | | HN request time: 0.894s | source | bottom
1. oaktowner ◴[] No.41861304[source]
I just love his writing so much -- he captures what I felt when I discovered Lisp. As a kid learning programming in the 80s, I had already done some BASIC, Fortran, Pascal and COBOL in high school and early college. There were differences, of course, but they had some fundamental commonality.

At UC Berkeley, however, the first computer science class was taught in Scheme (a dialect of Lisp)...and it absolutely blew me away. Hofstadter is right: it feels the closest to math (reminding me a ton of my math theory classes). It was the first beautiful language I discovered.

(edit: I forgot to paste in the quote I loved!)

"...Lisp and Algol, are built around a kernel that seems as natural as a branch of mathematics. The kernel of Lisp has a crystalline purity that not only appeals to the esthetic sense, but also makes Lisp a far more flexible language than most others."

replies(2): >>41863008 #>>41863500 #
2. Jeff_Brown ◴[] No.41863008[source]
Have you tried Haskell? It feels much closer to math to me. Definitions, not procedures. It even looks like math.
replies(3): >>41863350 #>>41865297 #>>41867173 #
3. oaktowner ◴[] No.41863350[source]
No! After about 10 years of writing software professionally, I moved over to product management, and my time spent coding decreased drastically (in the last 15 years, only some Python to show my kids a thing or two).

But I'd love to try! Maybe I'll take an online class for fun.

replies(2): >>41864278 #>>41868816 #
4. nxobject ◴[] No.41863500[source]
At the risk of diverging off from the original post, I also think that calling it "math" might make things a bit murky (and this is coming from someone who wanted to be algebraic topologist!)

It _is_ an elegant and minimal expression of a style of programming that is ubiquitous among dynamically-typed, garbage-collected languages. And it's a "theory" in the sense that it seems complete, and that you can think of ways to solve problems into Scheme and translate that into other dynamically-typed languages and still end with an elegant solution. Emphasis on the elegant (since minimal, wart-free, consistent and orthogonal, etc.).

Scheme was a simplification and a "cleaning up" compared to conventional Lisps of the time (lexical scoping, single shared namespace for functions and variables etc.)

5. Jeff_Brown ◴[] No.41864278{3}[source]
I can't recommend it highly enough. You're already familiar with laziness from Lisp, but purity is another head-trip. It made me a better programmer in any language, and even a better software architect before I've written a line of code.

And algebraic data types make it possible to make your code conform to reality in ways that classes can't. Once you're exposed to them, it's very much like learning about addition after having been able to multiply for your whole life. (In fact that's more than a metaphor -- it's what's happening, in a category theoretic sense.)

Haskell has other cool stuff too -- lenses, effect systems, recursion schemes, searching for functions based on their type signatures, really it's a very long list -- but I think laziness, purity and ADTs are the ones that really changed my brain for the better.

replies(2): >>41864839 #>>41865980 #
6. sourcepluck ◴[] No.41864839{4}[source]
Have you tried Coalton? It's a Common Lisp library that adds Haskell-esque (or near-Haskell) type wonders, and which smoothly interoperates with your Common Lisp code.

Your comment is great though, consider me convinced. I've done a bit of messing with Lisp, but really would like to try write something in Haskell, or slog through a book or two, some day.

7. tightbookkeeper ◴[] No.41865297[source]
Personal anecdote: I got a lot more out of lisp that stuck with me than Haskell. Occasionally I say "oh this is a monad" or think about a type signature, but that's about it.
8. chamomeal ◴[] No.41865980{4}[source]
Damn that was a really good pitch. I think I’m too dumb to learn Haskell though lol. I’m struggling enough with immutability in clojure!!
replies(3): >>41867076 #>>41867919 #>>41871125 #
9. eru ◴[] No.41867076{5}[source]
Haskell makes it easier, because immutability comes more natural there.
replies(1): >>41879144 #
10. medo-bear ◴[] No.41867173[source]
Maybe Haskell is more like Bourbaki math, whereas Lisp is more like Russian style maths (ala Vladimir Arnold). I prefer the latter tbh, and I come to programming from a maths background. We are all different. Lisp to me is yet to be surpassed in terms of ergonomics when transfering my thoughts into computer code.
replies(1): >>41870042 #
11. fredrikholm ◴[] No.41867919{5}[source]
> I think I’m too dumb to learn Haskell though lol.

I felt the same way, a lot of people feel that way.

This is in part because FP is difficult, typed FP is difficult, and Haskell is difficult. All by themselves. They do get easier once you intuit more and more FP in general I'd say.

Then there's also a phenomena described in the Haskell Pyramid[0] where it sometimes appears more difficult than it really is.

Like a lot of things, actually building something gets you a long way, esp. with the advent of chat AIs as it's comparatively easy to go back an fourth and learn little by little.

[0] https://patrickmn.com/software/the-haskell-pyramid/

12. pmarreck ◴[] No.41868816{3}[source]
Do you ever code just for fun?
13. xanderlewis ◴[] No.41870042{3}[source]
Interesting. How would you characterise each (Bourbaki and Russian-style)?
replies(1): >>41872943 #
14. adelineJoOs ◴[] No.41871125{5}[source]
As someone with some experience in Haskell (although not an expert by any means): Haskell and some of its concepts are foreign to many people, but I think that it is actually easier to program in Haskell than in many other languages I know. At least for my ADHD brain ;)

This impression can be changed somehow by the fact that Haskell and its community has two faces: There is the friendly, "stuff-just-works" and "oh-nice-look-at-these-easy-to-understand-and-usefull-abstractions" pragmatic Haskell that uses the vanilla Language without many extensions, and being written by people that solve some real-world problem by programming.

Then there is the hardcore academic crowd - in my experience, very friendly, but heavily into mathematics, types and program language theory. They make use of the fact that Haskell is also a research language with many extensions that are someones PhD thesis. Which might also be the only documentation for that particular extension if you are unlucky. However, you can always ask - the community is rather on the side of oversharing information than the opposite.

Rust fills that gaping hole in my heart that Haskell opened a bit - not completely, but when it comes to $dayjob type of work, it feels somewhat similar (fight the compiler, but "when it compiles, it runs").

15. medo-bear ◴[] No.41872943{4}[source]
I'm not sure what you mean by characterize. Bourbaki-style is extremely rigorous, to the point of missing the forest for the trees. The so-called Russian style (there are plenty of non-Russian examples) is more driven toward building intuition and getting to the essence of the matter. In this way lisp is more similar to the latter because it facilitates prototype (essence) development. In Haskell you pretty much have to do a captcha equivalent of programming just to prove to the compiler you are allowed to do io :)
replies(2): >>41874008 #>>41875344 #
16. iLemming ◴[] No.41874008{5}[source]
That is a very interesting perspective of Haskell vs. Lisp., I don't come to programming from a math background, but I am Russian. Maybe that's why I always preferred Lisp-style instead of Haskell :)
replies(1): >>41876840 #
17. xanderlewis ◴[] No.41875344{5}[source]
I mean what it usually means: to list distinguishing features, or at least give (necessary and sufficient?) criteria for membership of some class.

Whilst I'm vaguely familiar with Bourbaki and how it strongly influenced the way mathematics is written today, I hadn't come across that dichotomy before. Your answer was what I was looking for!

18. medo-bear ◴[] No.41876840{6}[source]
Maybe, I also see lisp as the slavic language of programming :)
replies(1): >>41880344 #
19. Jeff_Brown ◴[] No.41879144{6}[source]
I should have listed immutability as another thing that changed my brain for the better.
20. iLemming ◴[] No.41880344{7}[source]
Most obviously (from the linguistic's point) Lisp is Latin of programming languages. Has the similar historical importance; similar foundational role; continued relevance, elegance and power; evokes similar reactions from neophytes.

From the point of Biology: Lisp is a prokaryotic cell - simple, fundamental, highly adaptable.

In Chemistry: Lisp is carbon - versatile, forms the basis of complex structures.

In Geology: Lisp is like bedrock - foundational and supporting diverse structures above it.

In Astronomy: Lisp is a primordial star - ancient, influential, contributing to the formation of newer elements.

In Physics: Lisp is a quark - the basis of all baryonic matter.

</nerd-rant>

replies(2): >>41882610 #>>41901617 #
21. medo-bear ◴[] No.41882610{8}[source]
I would say in physics, lisp is like the formulation of physical laws in terms of lagrangians and hamiltonians - ie it is the least action principle
replies(1): >>41883462 #
22. iLemming ◴[] No.41883462{9}[source]
Here's a hard one. In political science Lisp would be like...?
replies(2): >>41886366 #>>41887144 #
23. ◴[] No.41886366{10}[source]
24. medo-bear ◴[] No.41887144{10}[source]
Juche ?
25. kazinator ◴[] No.41901617{8}[source]
The difference is that it's not the case that a majority of chemists are ignorant about carbon, or geologists about bedrock, or astronomers about primordial stars or physicists about quarks.

Lisp is like an entire branch of computer science, about which a lot of people in computer science are ignorant.

replies(1): >>41905125 #
26. iLemming ◴[] No.41905125{9}[source]
Allow me to gently disagree. Most computer scientists I know are not ignorant about Lisp. Some scholars consider computer science a branch of mathematics, while others avoid such broad generalizations, as modern computer science has evolved into a broader discipline.

It's just that the majority of modern programmers are not concerned with mathematics, and that's perfectly acceptable. Mathematics itself has so many different levels that even mathematicians themselves are not always certain if they are indeed practicing mathematics.

You may be conflating programmers and computer scientists, but this could also be a perfect case of selection bias, where both of us are simultaneously correct and incorrect in our assertions.