Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Pirating the Pirates (mubi.com)
    77comments
  2. Hijacking the PS5's RTMP stream (yashgarg.dev)
    28comments
  3. Joseph Szabo’s pictures of American adolescents (newyorker.com)
    1comments
  4. Show HN: HN.watch – Videos of all Hacker News posts (hn.watch)
    31comments
  5. Launch HN: Vespper (YC F24) – SOTA Docx MCP (vespper.com)
    4comments
  6. Parley: Federated, decentralised chat that speaks plain IRC (mills.io)
    126comments
  7. When did Google get so weird? (sancho.bearblog.dev)
    960comments
  8. Who wrote Elizabeth I's most scathing letters? (smithsonianmag.com)
    5comments
  9. Sonnet 5.5 (anthropic.com)
    174comments
  10. GrapheneOS – When an app is slow (wirelessmoves.com)
    7comments
  11. I made a visual workspace for AI Automations (biom.dev)
    9comments
  12. Windows 11½ (definitelynotwindows.com)
    67comments
  13. What heraldry and Japanese mon can teach about visual-identity generators (benovermyer.com)
    13comments
  14. OpenAI still doesn't seem to have a handle on all of its rogue AI activity (techcrunch.com)
    70comments
  15. MongoDB CEO resigns to join Meta (reuters.com)
    197comments
  16. MicroLLM Lab – Try 7 tiny LLM's in the browser (stateofutopia.com)
    1comments
  17. So long Google, and thanks for all the nudes (lecaro.me)
    36comments
  18. Cf: The Agentic CLI for the Cloudflare API (cloudflare.com)
    22comments
  19. Show HN: Destroy Any Website with Stickman (spritefusion.com)
    8comments
  20. Kids turned low-traffic NPR Spotify comments into a secret group chat (thisamericanlife.org)
    106comments
  21. 37,500 border drawings: a map of the world as people remember it (habibicode.org)
    31comments
  22. What Would a Serious AI Product Look Like? (glyph.im)
    27comments
  23. Footguns with Postgres “at time zone 'UTC'” (bookofrevenue.com)
    88comments
  24. Coding Is Not Solved (alexewerlof.com)
    372comments
  25. The problem is not AI code, but not knowing about system architecture or intent (ssp.sh)
    201comments
  26. Solving a corn puzzle with CP-SAT (thill.me)
    5comments
  27. Show HN: Free alternative to graphics design giants (scissor.studio)
    36comments
  28. Show HN: PaperMono, e-ink fridge magnet shopping list with mobile web page (github.com/seamusc)
    50comments
  29. Owed a billion dollars in Nvidia stock (colo.to)
    430comments
  30. Ember-1 (fireworks.ai)
    244comments

What makes Lisp difficult to read?

36 pointsby 4h agopaultm.nl
53 comments
4h agoHN ↗

I have not yet encountered a fully satisfying explanation as to why Lisp is perceived as being less readable.

Difficulty is, by definition, relative to one's skill. You cannot so quickly discount the fact that 99% of programming is taught in Java/C style language syntax. If you've had lifelong exposure to Lisp, you might feel exactly the opposite. The author does a poor job of justifying why these pop-cognitive-psych theories should have more weight than prior exposure.

Personally, as someone with decades of exposure to both styles, I look at the factorial example and see everything I love about Lisp syntax - consistent, no magic keywords and syntax to memorize, it represents a tree just like my mental model of code, there's no way to fall through and forget an else, expressions instead of statements, no early returns ... literally everything about the Lisp example is more readable to me. YMMV.

3h agoHN ↗

every time I get to use lisp syntax I feel a sense of relaxation, as if the background stress of thinking about precedence and the meaning of all these magic sigils and control flow constructs just melts away and I can finally see clearly what's going on. my first professional programming language was lisp, and almost every single project in the 35 years afterwards was C style. but it still feels like home.

2h agoHN ↗

Difficulty is, by definition, relative to one's skill

It's a factor and not the sole factor. Saying it's "by definition" is incorrect.

The author does a poor job of justifying why these pop-cognitive-psych theories should have more weight than prior exposure.

There's no reason to believe either way, except one path has decades of evidence. Human behavior is not overcome by programmatic "elegance". The dismissive "pop" prefix is signaling bias.

no magic keywords and syntax to memorize

ie no syntactic sugar. Pointless repetition is counter productive.

a there's no [logical] way to fall through >b [no way to] forget an else, >c expressions instead of statements >d no early returns

b. The interpreter catches it. d. Pointless execution is counter productive.

literally everything about the Lisp example is more readable to me

That's a single data point. Statistically it's worse, but you're practiced and apparently still physically able to quickly discern the nested count (or use an IDE). Yet another example of a position that is counter to existing studies. Heavy nesting is error prone, even when a program compiles (eg Monden et al., “Evaluating the Applicability of Reliability Prediction Models between Different Software,” ISSRE 2001)

3h agoHN ↗

I tend to struggle with other people's indentation rules for code and other programming languages, like nobody liked my article that said you should carry indentation into embedded strings that represent other programming laguages like SQL

   result = sql.execute("""
      SELECT someColumn
      FROM thatTable
      WHERE anotherValue>55
        AND state='pending'
      ORDER BY createdDate
   """)

Ultimately the idea is that indentation should be influenced by semantics, the intention of the code, and not just the syntax. Of course that is against the "one way to indent" philosophy of Go, Biome, and such... But I might accept less than optimal indentation to put an end to tab wars once and for all.

I find indentation of Lisp always seems to fail at communicating in the semantics, much worse than other languages. Things like

   (if condition truePath falsePath)

are scrambled when your eye skips over something. If the Lisp community got over its respect for tradition perhaps they'd develop some kind of syntax highlighting or tooltips or something that would clarify this sort of structure.

About 90% of real language have subject-verb-object or subject-object-verb orders

https://en.wikipedia.org/wiki/Subject%E2%80%93object%E2%80%9...

verb-subject-object and verb-object-subject are more Lisp-like and represent 10% of languages including Standard Arabic, Finnish and Fillipino.

I like extreme parsimony, like I'd love to write stuff like

   format = lambda: `%1-%2`

but I think as complexity goes up depending on the meaningful order of elements breaks down in many ways and you need to give things meaningful names.

2h agoHN ↗

Isn't it extremely common for programming languages to put the verb first? They just write it as verb(...stuff...) instead of (verb ...stuff...).

1h agoHN ↗

Well, you see a lot of patterns. In OO there is the classic

   subject.verb(object)

In a case like

   add(left,right)

isn’t the return value the subject and left and right both objects? That way

   a = add(b,c)

Is really SVO.

That said, you can build data structures in Java with functions like

   Expression<Number> add(Expression<Number> left,Expression<Number> right)

and build something like S-expressions (not so nameless tuples) when you functions like the above, nested inside each other. You then can then write code to eval those expressions or write out Java code during a code generation phase —- it is fun on some level but if somebody else thought it combined the worst of Common Lisp and Java I woulsn’t blame them. Build a system like that and you will realize Expression<Expression<Number>> is a thing, you have to introduce a quote() operator, etc.

And that quoting is also part of the Lisp problem. You have to not only decode your code relative to distant parenthesis but you also need to know the quoting state of the code you’re looking at which could agin involved involuntary nesting. Burns up precious working memory, just as multi-line if requires cognitive effort because your eye is not guided by if/then/else. It’s another one of those languages like C++ that seduces smart people into burning up their IQ on trivia and you can’t get them to listen about it because they think they are smart.

One reason why our tools suck is that we are stuck representing programs as trees when they are really graphs.

2h agoHN ↗

For syntax highlighting try using a different colour for each level of indentation or parenthesis. I use prism-mode in emacs.

2h agoHN ↗

The parentheses are large glyphs that distract the eye, and do not stand out (to the untrained eye) as delimiters.

Consider:

  (defun split-line (line)
    (remove-if #'(lambda (word) (string= word ""))
               (split-sequence:split-sequence #\Space line)))

Now imagine if we had some "lower weight" glyph besides the paren.

  .defun split-line .line,
    .remove-if #'.lambda .word, .string= word "",,
               .split-sequence:split-sequence #\Space line,,,

Obviously a contrived example replacing () with ., but you can see how "heavy" the parens and how they can dominate what the eye sees.

With experience, the parens vanish. The parens being large and common take control of the conversation more than they should.

2h agoHN ↗

OMG, the "improved" example is so cluttered and far far far less readable -- and even foreign -- to someone like me that has developed using lisp professionally for at least 10 years.

2h agoHN ↗

That's a crazy effect. For me, as someone who has a very minimal understanding of Lisp (apart from messing with it in Emacs for at most an hour), the improved version is much more readable.

2h agoHN ↗

Do you mean readable, as in it is easier for you to match "." to "," than ( to ), or is it just easier to look at without reading because there is less there.

2h agoHN ↗

The latter. Maybe it's different in Lisp, but whenever I read code, I rarely care about the exact order of operations, just which ones are actually being executed. In that regard, the improved version allowed me to comprehend the gist of what was happening much faster than the regular version did. For a few seconds, before even attempting to start comprehending the actual operations being executed, my eyes were stuck trying to comprehend the parentheses.

2h agoHN ↗

Lisp is why I started using emacs and its parens matching features.

2h agoHN ↗

I don't think the parens are the issue.

But when your function ends with ))))))))) -- that is the issue. Too much shit is being shoved into one method. But this is not the fault of lisp, it's the fault of the programmer who is wielding it.

2h agoHN ↗

That is frankly not a problem at all. People rarely bat an eye when your Python function ends by having eight simultaneous levels of dedent. People definitely don’t bat an eye when your HTML ends with </span></span></div></div></td></tr></table></section></body></html>. All you need is just good indentation, which is enforced in Python but optional in Lisps; then lazy programmers take shortcuts and don’t indent at all.

1h agoHN ↗

this actually gets at the real problem. Lisps are wordy as hell. like jesus

  (split-sequence:split-sequence #\Space line)

now imagine if that was

  (split-string " " line)

image if the whole function was

  (defun split (line)
    (remove [\(word) (= "" word)] [split-string " " line]))

or even

  (defun split (line)
    (remove "" [split-string " " line]))

*using [] in place of rainbow parens for clarity of sub arguments

1h agoHN ↗

  (split-sequence:split-sequence #\Space line)

Why would you do that? You could just use `uiop:split-string` and import the function symbol into your current namespace so you can call it as `split-string`.

  (split-string "a b c")
1h agoHN ↗

I mean ask OP, I don't know what's what in the Scheme rXrs or Common Lisp standard libraries.

Although my general stance remains, most lisp code bases I've seen are remarkably verbose which leads to a glazing over far more than the lack of distinct symbols or prefix notation

40m agoHN ↗

I think with CLOS, you can go back to using single verbs for function names. However, this has a performance cost. Encoding the receiver type in the function names makes the call much easier to optimize.

What remains is field access. Curiously, first-edition K&R C actually required similar type-encoding in field names because field names were global:

https://usenet.trashworldnews.com/?thread=288637

Same for ML, which is roughly of the same age, except that it took much longer for ML-derived languages to lift this restriction.

On the other hand, every time I wrote down examples that I think should look really bad in prefix notation, like this one:

    p3.x := (p1.x + p2.x) / 2;

It is actually not so terrible with a sufficiently streamlined prefix syntax:

    (setf x p3 (/ (+ (. x p1) (. x p2)) 2))

But maybe there should be a mechanism that the reader transforms p1.x to (. x p1), in the same way that it transforms 's into (quote s). Then we get this:

    (setf x p3 (/ (+ p1.x p2.x 2)))

Or if there is a concept of a place:

    (set p3.x (/ (+ p1.x p2.x 2)))

But that probably needs static typing for an efficient implementation (or set needs to deconstruct its first argument during compilation).

2h agoHN ↗

It's the same thing that makes reading Swift code hard if you never worked with it: lack of familiarity.

2h agoHN ↗

Exactly. Assembler looks like Gobbledegook. But if you have worked with it for a year it looks like a perfect and delicious dish.

2h agoHN ↗

1. it violates normal syntax rules you have been practicing since you were 4 years old.

Lisp will say:

  (+ (- (\* 3 5) 7) (/ radius pi))

but you are taught since 5:

  (3*5 - 7 + radius/pi)

2. Humans are highly adapted to using language, and understanding language constructs such as implicit context rules. Humans reduce token counts and structure in favor of implicit rules and making common patterns shorter. Lisp makes them all explicit, which forces you to cope with way more tokens. Lexical binding was added to Common Lisp almost as an afterthought, and the way LET/LET* force you to add layers of nesting demonstrates that. Every time you assign a variable the 'modern' way, you have to indent another block of code.

A concrete example is introducing local bindings with actions in between. The thought is "calculate this, do something, then continue":

  user = find_user(user_id)
  require_admin(user)
  report = build_report(user)
  write_audit_log(user, report)
  receipt = send_report(report)
  record_delivery(receipt)

In Common Lisp, a direct translation adds a level of nesting for each binding:

  (let ((user (find-user user-id)))
    (require-admin user)
    (let ((report (build-report user)))
      (write-audit-log user report)
      (let ((receipt (send-report report)))
        (record-delivery receipt))))

This is much closer to what is actually happening, and does not require you to understand scoping rules, but it's cumbersome and stupid.

LET* handles consecutive bindings, but here the actions must happen between them. You can use PROGN inside the initializers, or introduce dummy bindings for the actions, but either way you're restructuring a flat sequence to fit the binding syntax.

That's the implicit context I mean: the statement order combined with syntax rules of the language can supply the scope, without requiring a new enclosing expression every time you introduce a local. Lexical scope itself doesn't require this nesting to be explicit in the syntax of the language and it's not helpful for it to be.

3. So many inconsistencies.

Common Lisp uses alternating keys and values for property lists:

  '(:name "Ada" :age 37)

Association lists use a list of pairs:

  '((:name . "Ada") (:age . 37))

And LET uses two-element binding lists:

  (let ((name "Ada")
        (age 37))
    ...)

Lookup conventions differ as well:

  (getf plist key)
  (gethash key table)
  (assoc key alist)

GETF puts the container first; GETHASH and ASSOC put the key first. ASSOC also returns the matching pair, whereas GETF and GETHASH return the value as their primary result.

4. What happens at COMPILE-FILE time is arcane and almost impossible to keep straight.

5. Common Lisp often feels designed primarily to implement Common Lisp, rather than to write useful application code. Its equality predicates are a good example: EQ, EQL, EQUAL, and EQUALP give you four fixed bundles of rules organized around Lisp's own representations.

Want arrays compared by content? EQUALP does that, but also makes string comparisons case-insensitive. Want objects compared by their slots? EQUALP does that for DEFSTRUCT instances, but not ordinary CLOS instances. Want to define what equality means for your class? None of these predicates is a generic function you can extend.

Checking something basic like "when do these two values mean the same thing?", requires a separate operation of your own. None of the equality operators do anything close to what someone might actually want, unless they happen to be implementing CL in which case they are exactly what you want.

    Comparison                                    EQ   EQL  EQUAL  EQUALP

  Lists containing (1 2)                          NIL  NIL  T      T
  List (1 2) versus (1.0 2.0)                     NIL  NIL  NIL    T
  Strings containing "Ada"                        NIL  NIL  T      T
  String "Ada" versus "ADA"                       NIL  NIL  NIL    T
  Same-type DEFSTRUCT instances, identical slots  NIL  NIL  NIL    T
  Same-class CLOS instances, identical slots      NIL  NIL  NIL    NIL
1h agoHN ↗

There's so much crap here, I don't even want to waste my time to unpack.

Lexical binding was added to Common Lisp almost as an afterthought

Common Lisp was lexically scoped from day one. You're arguing about CL using Elisp's history.

And your "cumbersome and stupid" snippet is that, because, well you wrote it that way.

     (local
       (def user (find-user user-id))
       (require-admin user)
       (def report (build-report user))
       (write-audit-log user report)
       (def receipt (send-report report))
       (record-delivery receipt))
       

In modern Lisp dialect like Clojure it would look even more cleaner.

Lisp is the language where you do whatever syntax is suitable for the task, yourself, in an afternoon. In Python you wait for a PEP.

2h agoHN ↗

Personally, I find that a lot of LISP hackers put way too much logic into a single form or method rather than breaking it into smaller components that can be composed together. And I think that's often why we see frustration with LISP is that you'll have something that is indented really deep when it could be a much smaller function that's leveraging other functions. It's even worse in certain lisps like Clojure, where you'll see a lot of shorthand symbolic stuff, like for anonymous functions, or when you're using core.async, where you look at it and you think, is this brainfuck?

2h agoHN ↗

And the reason that LISP code tends to be reluctant to split things out into multiple forms with variable assignment IMO is because it introduces a new level of nesting. It's too much friction to go from

    (defn foo [] 
       (+ 1 2))

to

    (defn foo []
      (let [x 2]
         (+ 1 x)))

I wish that there were some kind of macro available in Clojure that would provide a local "def" kind of functionality that doesn't pollute the namespace and just creates a binding in the parent scope. So that you could do something like:

    (defn foo []
       (let! x 2) 
       (+ 1 x))
2h agoHN ↗

I think it has to do more with infix vs. prefix notation - infix is more natural and easier to read.

2h agoHN ↗

When it comes to math, that's what people are familiar with so that is a factor. But function application is prefix as well for the majority of mainstream languages.

1h agoHN ↗

There's nothing "natural" about reading. We've not evolved as a species to have natural reading abilities. Of just about anything - be that cuneiform, hieroglyphs, katakana, math formulas or Sanskrit. Every person has to be taught how to read. A Mandarin-speaking person may argue that their writing system is "more natural" simply because it's one of the oldest and most widely used in history. Would you buy that argument?

2h agoHN ↗

Lisp isn't difficult to read, so I don't understand the question.

This feels like someone who doesn't know French asking "what makes French difficult to read?"

2h agoHN ↗

Lisp isn't difficult to read

You'd be surprised how seemingly simple things can be hard for some. As an example, it's extraordinarily difficult for some HN users to read beyond the title and try to understand the reasoning behind it, so they instead settle for showcasing their intellectual prowess by answering the question outright as if that was the thesis. It's a very smart strategy, I must say.

2h agoHN ↗

You should really follow the HN commenting guidelines, specifically #1, 7 and 11.

36m agoHN ↗

follow the HN commenting guidelines, specifically #1, 7 and 11

This never occurred to me, you should really think about accompanying dang on his tireless job here, and maybe even get some dough along the way. I appreciate the insightful suggestion.

19m agoHN ↗

read beyond the title

Feels good to find a perfect opportunity to be witty and snarky, yeah? Well, allow me to murder this vibe of yours. Titles do exist for a reason. This article's title specifically, assumes too much. It's nearly click-baity. Imagine a title like "Why does the Holocaust feel like a hoax?", and then it goes into intricate detail to prove it isn't. Some people still get triggered by the title alone.

2h agoHN ↗

Exactly, it's just unfamiliar to most people.

I find Clojure (a Lisp) more readable than many other languages. It's the style I like for pseudocode. Because I used it a lot. It's familiar.

"Easy" is relative and doesn't mean anything without a subject. Easy for whom?

2h agoHN ↗

(The(.

People say we can ignore them but I find the difficult to ignore.

But this is not the only problem with lisp syntax. I found that reading Ruby or Python is simply, on average, so much more efficient.

I found scheme somewhat readable - see haxima game world, https://sourceforge.net/projects/nazghul/ it contains scheme files - but I would not want to write any game logic in it.

2h agoHN ↗

There is so much conjecture in this article -- take the difference between 'lisp formatting' and 'javascript formatting'. I use so-called 'javascript formatting' (a decided and embarrassing misnomer) routinely when I develop Clojure. This article exudes inexperience with Lisp.

2h agoHN ↗

You get used to it after a while and at some point the parenthesis 'disappear' and stop taking up mental cycles.

I often thought about this - at first I struggled a lot and wasted so much time trying to match parens, but after some time my brain adapted and then I actually liked the syntax, especially if your editor supports selecting forms or you use something like parinfer, which matches parens based on indentation.

Clojure has special syntax for collections of various types, so it's even easier to parse after you get used to it imo.

For me, the bigger challenge was wrapping my head around functional programming using immutable data structures, since that wasn't just syntax, it required me to 'unlearn' thinking in OO paradigm and adopting a new way of thinking about how the program works. You get used to that too after a while.

2h agoHN ↗

Similar to syntactically meaningful indentation, as with Python.

It's weird for a half hour, then it's second nature.

2h agoHN ↗

I love lisp and think it’s amazing. One of the things that commonly throws me off when I haven’t been writing it very much day to day is sometimes it’s unclear what’s going to be returned by a function.

An explicit return 0 is a lot more obvious than just having a 0.

Also, I’ll agree that a ‘ or a , in the wrong place is very easy to visually miss, then you can read a totally different meaning out of the code.

2h agoHN ↗

I'll repeat what other people here have been saying: I don't think Lisp is actually "hard" to read, in any objective sense.

It's "difficult" to read because it's different that other languages, but I think some of those differences actually improve readability once you understand the language. The forced use of parentheses everywhere guarantees that precedence is never ambiguous, for example.

1h agoHN ↗

I wouldn't say "never ambiguous" (at least for Scheme):

140 Assignment introduces a subtlety into step 1 of the evaluation rule. As shown in Exercise 3.8, the presence of assignment allows us to write expressions that will produce different values depending on the order in which the subexpressions in a combination are evaluated. Thus, to be precise, we should specify an evaluation order in step 1 (e.g., left to right or right to left). However, this order should always be considered to be an implementation detail, and one should never write programs that depend on some particular order. For instance, a sophisticated compiler might optimize a program by varying the order in which subexpressions are evaluated.

https://sarabander.github.io/sicp/html/3_002e2.xhtml#FOOT140

2h agoHN ↗

Hot take: it's the recursive referential grammar, which does not have an analog in human natural language.

Human languages have hard limits on the reference tracking they support, regardless of syntax (marking, positional grammar, etc.). Humans have to reason to unpack LISP (or deeply nested functions or delegation in other languages).

2h agoHN ↗

Lisp is more diffucult to read for most devs because most devs are used to C/Java -like synthax.

If most devs were used to Lisp, it would be the other way around.

It's a chicken and egg problem, at this point.

2h agoHN ↗

I think part of it is that English speakers say: “2 plus 2” not “plus 2 2”, so the infix notation matches our natural language and mental model.

1h agoHN ↗

Most languages use either subject-object-verb or subject-verb-object word orders, which together account for ~90% of world languages; verb-first word order languages only account for ~10% of world languages.

1h agoHN ↗

- add two and two

- compare apples to oranges

- use observational skills

(edit: formatting)

2h agoHN ↗

I don't think it's ONLY the parenthesis, it's also the lost opportunity to do meaningful things with indent that bothers me. For example: a missing end paren is often obvious where it should end to a human reader because the next definition starts at some set indent level (0 being the most obvious one). But we talk a different language to the compiler and to the human so the error message is far from where it would be useful.

Significant whitespace is actually a good thing™, even if you only use it to narrow compiler error messages. You can still have your parens but also get way better error messages if you just use the indent!

1h agoHN ↗

I have a suspicion that 99.999% of people who say that Lisp syntax is difficult to read haven't really tried to use it (outside of a random homework assignment in CS101).

The syntax is incredibly trivial, and needs very little initial instruction (except to tell newbs to stop trying to put the close-paren on a line by itself, like they are fresh out of a JavaScript boot camp and have no frame to conceive anything else, and that, really, the automatic indentation and the shapes should be at least as readable once you try to use it in real-world examples, and see how that works in practice).

Since Lisp puts the function name after the opening parenthesis, there is more distance between the parentheses. This makes it less likely that the parentheses are close enough to be scanned as a single shape.

Or we can navel-gaze differently, and claim it's more a shape, because then it's a nicely rounded shape that contains the whole function application/call:

    (foo x y z)

    foo(x, y, z);

There is a small chance that you're doing the following in a Lisp or C, but you'd be doing something fancy that most people do not (like writing the internals for a pluggable framework or object system):

    (((f a) b ) c)    Pseudo-Lisp

    f(a)(b)(c)        Pseudo-C

If you were doing this, and you thought the particular code was hard to read, you could throw in a variable or two, for the intermediate function (or function pointer) values. Or use a combinator...

When you don't have this fancy function-that-produces-function-that-produces-function pattern, your list head will typically have the name of a function there, and then the syntax simple shape and indentation visually disambiguates.

In skimming the article, I did see something the article could've followed through on, for a good syntax criticism of many Lisps:

    f[a][b][c]    Pseudo-C, array access notation

Array-intensive Lisp code could use syntax/dialect extension for square brackets for this, if the Lisp doesn't already have comparable syntax:

    [m a b c]

In both references and setters; see my most recent mention of it: https://mastodon.online/@neilvandyke/117067069023420085

1h agoHN ↗

I think the biggest problem is that expressions are lists, but we build lists with quoting, AND unquoting (or quasiquoting). It takes some effort to look at an expression and be certain of what will be run. Are we displaying the instructions to erase the hard drive, or the output of erasing the hard drive.

Compare this with Prolog. I like to say "a term is just a term until it's a goal". Assuming we have an erase_hard_drive/1 predicate, I know it's safe to do

    write_term(erase_hard_drive([force,silent,noprompt]), [])

or

    EraseCommand = erase_hard_drive([force,silent,noprompt]).
1h agoHN ↗

What makes Lisp difficult to read is that almost everyone comes to a Lisp, with deeply ingrained writing skills suited for syntax-heavy, non-structurally-editable languages.

---

Now, to die on this hill.

Speaking as someone who desperately wants people to stop inventing syntax, I want to offer my "inversions" of the author's conclusions.

prefix notation puts parentheses further apart

Prefix notation guarantees that I instantly know what the function / operator is and what the operands are. I don't see (or care) to literally read the parens. The parens are not the point.

And if we are doing this, let's compare real-world code shall we?

For example, how many syntax points (like = and ; and whatnot) do I not have in this code block (of my dotemacs) because regular prefix notation means I can set any number of global variables in one single declaration? https://github.com/adityaathalye/dotemacs/blob/3ce80d8336ae8...

As a bonus, because of the prefix guarantee, when teaching someone a Lisp, I spend almost no time teaching the semantic meaning of syntax rules. All I have to do is show how prefix notation works, and drill that a few times with hand-coding exercises.

formatting practices do not help to track parentheses

Auto-formatters---once again, because of prefix notation---can lay out code in very regular patterns and shapes. Auto-formatting further obviates the visual / aesthetic relevance of parens.

Not to mention smartparens and structural editing and other basic niceties of Lisp text editors.

prefix notation results in more left-nesting

Perhaps. The value for me is that it results in more regular code, because, once again, standard prefix notation, and once again, standard auto-formatting. Nobody reads closing parens, or opening parens, or whatever other parens... we let our text editor take care of that stuff for us.

Lisps lacks or discourages features that align the evaluation and reading order

This depends on whether the Lisp in question is imperative, procedural, or functional. It has nothing to do with S-expressions...

Essentially, the author makes the usual category error of conflating "Lisp" with "s-expression".

May I suggest associating "Lisp" with "Metaprogramming" as the better evil? Die-hard Lisp-2 nerds will balk, but I say any language with an ability to symbolically manipulate itself as its own data is a Lisp. For example, Julia is a kickass Lisp because it enshrined meta-programming as a first-class language design concern. Ditto Elixir. I'm happy thinking of those as M-Expression Lisp-likes.

And as a matter of personal taste, having been around lisp nerds, nobody who actively writes s-expression languages---even as hobbyists---reads parens. They/we see shapes and we manipulate our code like tetris, without even having to think about 'em parens, and soon enough, nor about the keyboard shortcuts.

Whether Emacs, or Vim, or VSCode, or IntelliJ or, whatever Lisp-aware editor, we simply slurp and barf and splice and unsplice and convolute-sexp, all of which I do as a normal part of Lisping https://emacsrocks.com/e14.html ... And this stuff is so readily possible because of the regularity of prefix-notation s-expr syntax.

(edit: add code example)

27m agoHN ↗

I honestly never understood this premise of Lisp being "difficult", "demanding", "complicated", "taxing" or "annoying" to read. Over the course of my career I've had to learn over a dozen different PLs. Every single one of them was "hard to read", until it wasn't. Every single one of them required some initial effort, and not a single one of them was like "yup, I clearly understand everything, don't even need to read the docs..." And honestly, I'm not even a very talented programmer. I'm pretty average.

What's interesting is that at the point when Clojure finally started feeling more intuitive and I was able to quickly scan the code snippets and understand the flow, it almost wondrously opened the gates for just about any Lisp. I can easily switch between Lisp dialects, as a matter of fact I can do it multiple times a day and the overhead is so tiny, it feels like I'm dealing with the same language, just on a different platform. It's by far the easiest language to deal with, be that Clojure, Clojurescript, ClojureDart, Fennel, Elisp, CL, Jank, Jolt, etc.

I think most programmers simply don't do that. They don't switch between different platforms (and thus languages) very often, they pick one or two, get proficient with them and build some loyalty or whatever, the language almost becomes their identity (at least at that point in their lives, until they find a new one).

And then the problem with Lisp dialects is that they are pretty niche - they are not so widely used in the industry, therefore the incentive to specifically learn Lisp is very moderate at best. But people hear stuff like "how expressive and powerful...", "Emacs has no competition", yada-yada and they'd try to spend a weekend to see what it is about, then look at the unfamiliar syntax and go like: "hmm, I don't know..." They try to learn kung fu but skip all "Mr. Miyagi's bullcrap". Alas, it just doesn't work that way.

For me, it was absolutely worth it. I think learning Clojure saved my career. At the time I was so overwhelmed with complexity in the apps I was trying to build and maintain. I started having an existential crisis - I thought about leaving the field for good and starting something else. Turns out, I wasn't a complete failure, I wasn't stupid, and I didn't lack incentive. I just needed a different perspective. And that "weirdness" and "uniqueness" of Lisp was that inflection point that I desperately needed in my life. Guess what? Becoming a Lisper helped me understand other languages much better.

I think I found a lifehack - want to become a polyglot programmer without wasting ten years of your life? Grok Lisp. It will do.