News for hackers. Stuff that matters.
Re:All Lisp indentation schemes are ugly by ludston on Monday January 20, 2025 @02:13AM (#42765826)
But all the cool kids are using paredit or parinfer which means you don't actually ever write the closing parens yourself.

Counting parens is silly when the editor can do it for you.

Re:All Lisp indentation schemes are ugly by wink on Monday January 20, 2025 @03:26AM (#42766245)
Not your fault, but I think it's such a silly argument.

About 90% of my problems arise when I shift the parens, e.g. going from `(+ (1 2))` to `(+ (+ 1 2) 3)` or the other way round - and if there is now ) or )) at the very end (but more likely at 4+, not 1 or 2.

How would any plugin know what I mean here? (I know + is a bad example as its commutative...).

Re:All Lisp indentation schemes are ugly by ludston on Monday January 20, 2025 @03:41AM (#42766343)
You need to clarify your example, because it appears that you are inserting `+` and `3` between existing parens rather than shifting them.

But regardless, I think the answer you are looking for is:

Some of the coolest kids of all use rainbow delimiters so that they can easily identify the matching closing paren with their eyes!

Re:All Lisp indentation schemes are ugly by wink on Monday January 20, 2025 @04:41AM (#42766816)
I tried, I'd need to crank the font size up to 14+ to discern the difference ;)
Re:All Lisp indentation schemes are ugly by mtlmtlmtlmtl on Monday January 20, 2025 @04:21AM (#42766650)
Paredit has lots of great ways to do that sort of thing, though, while keeping things balanced. In emacs with paredit, providing a prefix argument to open paren lets you surround n sexps in the new parens. There's also slurp and barf to move sexps in and out of parens.

Editing for lisp mirrors the language as a whole in that there's a learning curve, but once you've climbed it, it's a joy to work with. Because the syntax is so uniform, all you need is a handful of extensions/commands for full blown structural editing.

I get by splendidly in emacs with nothing but paredit and convenient keybindings(not a huge fan of paredit defaults).

Re:All Lisp indentation schemes are ugly by davvid on Monday January 20, 2025 @03:13AM (#42766160)
Likewise, it's better to optimize for experienced readers than it is to optimize for students.
Re:All Lisp indentation schemes are ugly by harperlee on Monday January 20, 2025 @03:20AM (#42766199)
Some time ago parinfer (https://news.ycombinator.com/item?id=42766205) took some attention as a more pythonesque approach to matching presentation and meaning. I liked it, but it seems that it didn’t catch on, alas.
Re:All Lisp indentation schemes are ugly by kazinator on Monday January 20, 2025 @12:38PM (#42771048)
How do you know it didn't catch on? It depends on Lisp! The fraction of programmers using parinfer is bounded by the fraction of Lisp programmers. (I think I might have seen some fledgling experiment with parinfer for other languages, though.)

I'm highly resistant to novelty in this area, yet even I am using parinfer. A crappy implementation in Vim, at that, which only works in One direction: indent -> parens, and can get into an infinite loop fighting with Vim's undo.

Re:All Lisp indentation schemes are ugly by harperlee on Tuesday January 21, 2025 @10:15AM (#42780996)
Well from what I see on the emacs corners of the internet, not so much discussion.

Also I recently read on an HN thread I started: it was taken out of Calva due to bugs no one fixed.

Re:All Lisp indentation schemes are ugly by nine_k on Monday January 20, 2025 @02:32AM (#42765931)
Writing code is usually easier than reading!
Re:All Lisp indentation schemes are ugly by ludston on Monday January 20, 2025 @03:08AM (#42766138)
If you're not used to the language, the conceptual models of the codebase you are working on, or you're working with obfuscated code. Otherwise it should be much faster to read and understand the code somebody else wrote than to write it from scratch?
Re:All Lisp indentation schemes are ugly by nine_k on Monday January 20, 2025 @03:52AM (#42766430)
No, I mean, in general, including languages which I work with for 20-25 years. Reading code is still harder than writing.
Re:All Lisp indentation schemes are ugly by ludston on Monday January 20, 2025 @04:22AM (#42766656)
I can certainly think of examples where reading code is harder than writing it, but given that much of my professional role has been dissecting the horrible code written by other people in order to figure out not only what it does, but also what it was supposed to do, I simply disagree. Reading code is just more boring than writing it.
Re:All Lisp indentation schemes are ugly by _nalply on Monday January 20, 2025 @06:21AM (#42767515)
In Rust I came to the opposite conclusion.

One webserver framework, Axum, has the trait IntoResponse which is returned by something that implements Handler. A lot of things implement IntoResponse and/or Handler. In plain English you have handlers, these are parts of code that get selectively invoked for a request. The handlers return data that can be made into responses. It's powerful, but if something doesn't fit exactly, the Rust compiler throws gibberish errors at you. It's finnicky as hell.

But once you have written something that works, it is beautiful to read.

So it's difficult to write such code, and if it's easy for you then it's because you mastered the art.

Re:All Lisp indentation schemes are ugly by johnisgood on Monday January 20, 2025 @02:46AM (#42766028)
Exactly.
Re:All Lisp indentation schemes are ugly by NikkiA on Saturday January 25, 2025 @11:59AM (#42822826)
More specifically, everyone is using some variant of rainbow-parens