67 ms·
Clueless or crazy? It works like this: suppose you have an expression all in one line: (and (or (foo) (bar)) (not (xyzzy))) Of course you close the paren
by kazinator 10y ago
Clueless or crazy?
It works like this: suppose you have an expression all in one line:
(and (or (foo) (bar)) (not (xyzzy)))
Of course you close the parens together; just like in any other notation that uses parens. When the line is broken into mutiple lines, the parens just stay where they are:
(and (or (foo) (bar)) (not (xyzzy)))
^ ^
arbitrarily, let's break here
(and (or (foo)
(bar))
(not (xyzzy)))
Beauty. This does not require additional editing to make:
(and (or (foo)
(bar)
)
(not (xyzzy))
)
Yikes! If you do this you will get flak from almost every Lisp programmer. (Why piss off those nice five or six people?)
This is done the same way in common coding styles in other languages, like, C:
if ((cond1 || cond2) &&
(cond3 || cond4)) // oh look
stmt;
It's not commonly done with braces in C-family languages, but that is neither here nor there; and it can be done fairly nicely with those braces.
- sebringj 10y agoThe wonderful thing about "or" is that you can keep adding on to it and only one statement has to be true. "or not". I'll go with "or not". In any world where you have beginning programmers, or programmers not used to Lisp seeing ))))))))) at the end of a line, this is cognitively difficult to keep track of the number of closing braces without having some editor assist you doing the counting for you. This reminds me of indenting in python being touted as easier than having brackets as whitespace matters but editing is terrible without having line guides turned on when any deeper nesting arises.
- veddox 10y ago> without having some editor assist you doing the counting for you The problem with your statement is in just this point: everybody does have an editor that does this for you ;-) Unless you write code with ed, or Windows Notepad, I don't know of a single editor out there that doesn't do this.
- deleted 10y ago[deleted]
- kazinator 10y agowithout having some editor assist you doing the counting for you. We. Have. Those. I wouldn't use any editor which can't do this and would have no reason to. I wouldn't use it for Lisp. I also wouldn't use it for editing C, Makefiles, shell scripts, or anything else. Speaking of makefiles, here is a quote: vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \ $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-)))) ^^^^ ! That is from: https://github.com/torvalds/linux/blob/master/Makefile https://github.com/torvalds/linux/blob/master/Makefile Maybe you should try arguing your inane point on the Linux kernel mailing list!