Why is it customary to put many closing parentheses on one line in Lisp-based languages?

后端 未结 8 1154
野的像风
野的像风 2021-02-05 01:19

Usually code looks like this:

(one-thing
    (another-thing arg1 (f arg5 r))
    (another-thing arg1 (f arg5 r)))

Why doesn\'t it like this?:

8条回答
  •  清酒与你
    2021-02-05 01:42

    If you're using Emacs, you need to learn these. In particular, C-M-k makes killing a balanced expression just as easy as killing a line. Couple that with good highlighting of balanced parentheses, and there's really no need to write things this way.

    On the other hand, having all those )s on lines by themselves means that you see less of your code on the screen at once, making it harder to read and refactor.

    If you're not using Emacs, you should at least be using an editor that supports those basic operations, or coding in lisp is going to be a pain.

提交回复
热议问题