Hacker News new | ask | show | jobs
by marcodiego 1962 days ago
I don't get lisp. Actually I think I understand what people like about it. What I mean is that I don't know exactly how to "think in lisp". Is it like writing the AST instead of the text or describing what is needed instead of what needs to be done... I simply don't get it.

Not sure if I'm the only one though.

2 comments

What you said is true and perceptive — it is at base like writing the AST - but most of the time you’re just doing function calls with the opening paren shifted to the other side of the function name.

In other words, in Algol like languages you’re typically calling like(this) (or the dotted.equivalent(form)) and in lisp it’s (like this).

You do eventually take advantage of the fact that you’re writing an AST, when you get into macros. But that feels pretty simple once you’re used to the function syntax, since macros just manipulate the resulting structures.

What used to throw me off was the special syntax for lists - ‘(structures looking like this) - but once you get used to using the lisp structure for function calls it becomes clear why and when this kind of quoting is necessary (any time you want a list as data instead of a function call).

Take any idea of a data pipeline, something like with rabbit or kafka. Now describe that in functions by composition.

read-data -> push-to-rabbit -> read-from-rabbit -> send-ack -> push-to-http.

Turns out with functional composition + data structures you can do a lot.

With the idea of immutability or persistent data structure with say Clojure, a lot of idea start to make sense. Rich Hickey videos are pretty good at describing simpler programs. Even if you never use Clojure, or Lisp, or Scheme, these idea might make you a better programmer. At least they did for me. My Python code is now much simpler because I realized I didn't need everything I was doing.