29 ms·
Well, that's not really the case. Parentheses are the main type of bracket used in most Lisps(which can be nicer than having [], (), and {}, some of which frequ
by ekiru 16y ago
Well, that's not really the case. Parentheses are the main type of bracket used in most Lisps(which can be nicer than having [], (), and {}, some of which frequently have entirely different meanings depending on what syntactic context they are used in(for example, languages which use "{}" for both blocks and dictionaries, or "[]" for both list/array construction and indexing)). However, in Common Lisp for example,(with many present in other lisps) there's also the quote, the semicolon, the double quote for strings, the backquote and comma for partial quoting, #\ for character literals, #' for functions, #( ) for vectors, #* for bitvectors, #: for uninterned symbols, #. for read-time evaluation, #B for binary rational literals, #O for octal, #X for hexadecimal, #R for arbitrary bases, #C for complex numbers, #A for arrays, #S for structures, #P for paths, #n=foo and #n# for labeling objects for back-reference, #+ and #- for read-time testing for available features, and #| |# for comments. And of course, Common Lisp supports reader macros, so you could end up with a lot of potential syntactic punctuation.
Of course, most of the time, you won't need most of that syntax. And, it does have the advantage of mostly being defined in Common Lisp and being fairly consistent.
But parentheses are definitely not the only punctuation in Lisp.
- lukev 16y agoBut parenthesis are the only required punctuation. Any of those others you mentioned can be equivalently expressed by parenthetical expressions. Homoiconicity is preserved.
- ekiru 16y agoI don't think that that is true, at least not for Common Lisp. How do you express any of the following constructs using only parentheses and symbols? #:foo #.(foo) #+ FOO (bar) #- FOO (baz) For the original Lisp, parentheses and symbols were all that was necessary. For more recent derivatives, that is not necessarily the case.
- astine 16y agoWell, Packages are a reader-hack, so you couldn't express them with parenthesis, although you should be able to IMHO. #+FOO (bar) This could almost be: (when (member FOO features) (bar)) Just wrap it in an eval-when.
- daniel-cussen 16y agoYeah, but in Java, you need four kinds of punctuation right off the blocks.