9 ms·
The Nature of Lisp (2006)
- kruhft 9y ago"Why on Earth would anyone want to use a language with such horrific syntax?!" What is it with statements like this? It just sounds like a 'meme' to me, that everyone hears (even from advocates like this one) at first that the 'syntax' (of which there is a lot less than most languages in a Lisp) is 'horrible'? Of course, we, the learn-ed of Lisp, say that after a while the 'parens just disappear', which they don't, but they sure help (when combined with Paredit) in defining code like structures that can be manipulated with ease in your editor. I know the author is just trying to do a bit of a 'sandwich' with the article, but please, advocates and enemies of Lisp, just give up on picking on the parens. It's stupid and been done a million times. It's like 'why do we have to type so much to enter programs! such a pain!'. Boring.
- VyseofArcadia 9y agoThat said, it would be nice if lisp used square brackets for this instead. Easier to type on boring old US QWERTY.
- Zelphyr 9y agoRebol and Red are very Lisp like and use square brackets instead of paren's.
- thedirt0115 9y agoNo problem, just a couple reader macros! (Adapted from an answer on https://stackoverflow.com/questions/1988/how-far-can-lisp-macros-go https://stackoverflow.com/questions/1988/how-far-can-lisp-ma...) ;; Make [] == () (set-syntax-from-char #\[ #\( ) (defun lbrace-reader (stream inchar) (declare (ignore inchar)) (read-delimited-list #\] stream t)) (set-macro-character #\[ #'lbrace-reader) (set-macro-character #\] (get-macro-character #\) )) (set-syntax-from-char #\] #\) )
- mikegerwitz 9y agoSome lisps use parenthesis and brackets interchangeably. Some people prefer to strategically alternate them, but you're free to use them exclusively. Guile Scheme, for example: scheme@(guile-user)> [list 1 2 3] $1 = (1 2 3) scheme@(guile-user)> (list 1 2 3) $2 = (1 2 3) scheme@(guile-user)> [car '[1 2 3]] $3 = 1
- eatonphil 9y agoWhile true, this is not officially supported as part of the RnRS standard I believe. They set these characters aside as reserved for future use.
- mikegerwitz 9y agoYes, you're correct. R7RS at least explicitly reserves brackets and braces, and only acknowledges parenthesis in its syntax.
- lispm 9y agoI think this depends on which RnRS you look at.
- ketralnis 9y agoRacket can use either. They are syntactically equivalent, but there are some community norms around when to use each. Racket’s included editor DrRacket takes the [ and ] keys and figures out which to use using those conventions, inserting either [ or ( as appropriate
- krapp 9y agoI'd like to see square brackets replace the backtick. I only have a cursory familiarity with lisps but I constantly find that too easy to miss.
- kuschku 9y agoSquare brackets are AltGr-8 and AltGr-9 on German T2, but Parens are Shift-8 and Shift-9, which is much nicer on the hands. So I’m going to be against this.
- sedachv 9y agoParentheses are so much more frequently typed than square brackets in almost every context that you are better off following the Lisp Machine keyboard layout and swapping them on your keyboard even if you do not program in Lisp: https://news.ycombinator.com/item?id=14985932 https://news.ycombinator.com/item?id=14985932
- ScottBurson 9y agoYes, agreed. From your previous comment: > Apple does not provide a way to do these remappings on OS X Run Emacs (or XEmacs) under XQuartz and you can do whatever remapping you want. This is how I deal with it. Another choice is a fully programmable keyboard, though these also tend to have nonstandard layouts that require some retraining.
- chuchana 9y agoThere is no need for X, you can just use elisp, i.e.: (keyboard-translate ?\[ ?\() And unless you do need X, I suggest using Emacs-Mac-Port instead of of the official Emacs: https://bitbucket.org/mituharu/emacs-mac/overview https://bitbucket.org/mituharu/emacs-mac/overview
- phoe-krk 9y ago$ setxkbmap -option parens:swap_brackets
- dmitriid 9y agoA language’s syntax is the very first thing you encounter. And if you are not familiar with it, it will be a major sore point when trying to learn the language. So yes, while complaints about syntax are largely irrelevant once you already know the language, the complaints will be there for any new user.
- ajkjk 9y agoI don't really mind the parens, but the whole attitude feels indicative of a problem. Like - it's 2018 and people are still using 'cdr' and 'cons' as terminology and happily expecting other people to learn those words and not even feeling bad about it. If the person justifying Lisp doesn't mind that the word 'cons' is terrible, why should I trust their aesthetic sense about anything? If I have to have "miserable notations" to get "coding nirvana", and coding nirvana is so great, why not fix the notations? do you just think everyone should have to struggle because you did? I guess it feels like trying to determine which of these statements are true: (1) "Lisp is coding nirvana" (2) "Lisp is weird regressive nostalgia for a simpler era where nothing was typed and everyone used Emacs and memorized arcane terminology and shared macros on Usenet", and there are way too many signs that it's a lot of (2). [edited to be less abrasive]
- bluefox 9y agoI read: whyknow thing like word"and"sentence to write and plural and capitalization comma dot semicolon space question mark need write spaces between them wordamabobs why don't fix notation???
- ajkjk 9y agoI don't see your point. Do you disagree that things can be named badly?
- bluefox 9y agoPoint is: Lispers obviously don't care about what you care about. That is why they don't fix it: it's not broken for them.
- ajkjk 9y agoIf someone evangelizes something and doesn't see and doesn't apologize for obvious flaws ("I promise this is worth it even though it's obviously flawed!), that makes me seriously doubt their reasons for preferring it or their ability to empathize with other people. At risk of being offensive: yes, it's clear that Lispers don't care, but that makes me think they're masochistic or autistic, not that I should use their favorite language.
- BeetleB 9y agoI can handle parentheses. What really gets me? Semicolons. Most useless character in programming language history. Every time I switch from a language that doesn't require them to one that does, the pirates run away from me.
- outworlder 9y agoThis. At least parentheses have a useful purpose and can even help you when writing code (paredit and the like). Semicolons are only there to help compiler writers. It would be ok if they were allowed, but optional. How many times do you really have to write more than one statement per line?
- cptn_brittish 9y agoThe issue is these days everytime I hear optional I think of semicolons in JavaScript where they are optional except for one or two edge cases I can't remember off the top of my head. Optional is good as long as its a complete you can do it this way or that way like gradual typing in some languages.
- outworlder 9y agoIndeed. I meant really optional, not something like automatic semicolon insertion, where they are there, they are required by the grammar, but you are allowed to omit them in some cases.
- etiam 9y ago> the pirates run away from me Nice expression. Is it a pop culture reference I have missed?
- AnimalMuppet 9y agoI suspect (but do not know) that the reference is "swearing like a pirate". BeetleB is (I think) saying that semicolons lead to swearing that even the pirates are offended/appalled. (It took me reading it a few times to get that, and I'm still not certain it's right.)
- macromaniac 9y agoIt is a true statement, lisp syntax is wierd. You spend years learning that 2 + 2 = 4, seeing (+ 2 2) for the first time is a bit of a shock. The point is overused but its a good point and he doesnt dwell on it. Arguments shouldnt be evaluated just by how interesting they are.
- zsck 9y agoThe parent post shouldn't be interpreted as dismissing the argument because it isn't interesting but because it has been beaten to death. It's the kind of argument that has been had from every meaningful angle and the programming community has, unless I'm wildly mistaken, settled on a few conclusions regarding it. Like a lot of things, one conclusion is simply that Lisp syntax being good, bad, easy or difficult to read comes down in part to preference of the individual. Of course there are other conclusions as well, but the point is that dwelling on the subject is generally not a productive use of time. It's so old and popular to discuss that very little of value comes from discussing it further, and repeating the arguments is both distracting and potentially even discouraging for some less experienced programmers.
- msla 9y agoAlgol syntax is weird. Tell me, what does this mean? x = x + 5 Obviously, it's a null statement. It's nonsense. x cannot equal x + 5 because that means 0 = 5 and, therefore, 0 = 1 and, therefore, all mathematics is broken. However, most Algols are completely happy to accept that statement, something we learned was nonsensical way back in our childhoods, as not only valid but as the only way of doing things. My point is, there is no such thing as a natural syntax. They're all weird. They all have to be learned. Some provide more benefits than others after they've been learned. (Also: You're only a newbie once. Optimizing for that one-time thing is a bit odd, when you'll spend far more of your life as an experienced programmer.)
- ScottBurson 9y agoThat's precisely why Algol used ':=' for assignment ;-}
- dwc 9y ago> but please, advocates and enemies of Lisp, just give up on picking on the parens Each non-lisper will reinvent the argument from scratch, so advocates can't profitably ignore it. It's a shame. You get past that so quickly after using lisp.
- nathell 9y agoPrevious discussions: https://news.ycombinator.com/item?id=4765067 https://news.ycombinator.com/item?id=4765067 https://news.ycombinator.com/item?id=9575786 https://news.ycombinator.com/item?id=9575786 https://news.ycombinator.com/item?id=1319034 https://news.ycombinator.com/item?id=1319034
- FPGAhacker 9y agoIn case you or anyone reading this were unaware, there is a link underneath stories called "past," which provides the service nathell did in parent.
- stingraycharles 9y agoHuh I never knew that. Have I been completely oblivious of it, or has that been added recently ?
- akvadrako 9y agoWoah, I've been reading hackers news for years and never noticed that. I would suggest it be an expanded list by default. It would really cut down on dupes and encourage everybody to build on the old conversation instead of rehashing it.
- spion 9y agoThe surface problem of LISP are the parenthesis. The deeper problem is that its a very potent NIH enabler: most of us are not really that talented or have the time to properly invent things; those that are tend to not quite like other people's things (and are good at spotting flaws in them) so they work on their own "better" things (e.g. see arc).
- aaron-lebo 9y agoThe biggest problem, related to the NIH or not, is that other language ecosystems every month race ahead with new libraries, features, and compelling reasons to use them. The best arguments for lisp are 12 years old, in comparison. Over time the advantages of lisp have gotten smaller and smaller, assuming they were ever anything more than the rationalizations of happy users. When the options were Python, Ruby, PHP, C++ 03, and Java, this held much more weight.
- outworlder 9y agoIf you are just gluing code together, Lisp is not necessarily the best choice. If you are working on difficult problems where you actually have to devise non-trivial algorithms, then Lisp is a good choice. The problem then becomes feeding that algorithm – when there are so many great libraries everywhere else to retrieve data from and send to other places, it becomes cumbersome to do it in Lisp. There is also value in restricting programmer flexibility. I suspect Golang got popular precisely because of its straighjacket (and I say this while staring at Golang code in another monitor). Turns out most people want Legos. Real artists are fewer in number, but those will want clay instead. Edit: typo. Edit2: everywhere else
- aaron-lebo 9y agoIDK, I feel like this is the kind of slightly smug reasoning that's seen lisp get passed by. Just because I believe the factory-made, cheap, and standardized building blocks are a better medium than your artisan homemade clay blocks doesn't mean I'm just a dumb pleb churning out junk. I just have different values than you. I've spent lots of time crafting the greatest macros and trying to deal with missing/half finished/supported libraries in lots of languages, but at this point I just want to build and spending time on those details isn't worth my time, it doesn't help me make a better product. It turns out that declaring yourself the greatest and resting on those laurels can lead to myopic overconfidence. There's very little at this time that lisp is actually the best choice for, unless you have very limited reliance on outside libraries, and even then, other languages have different tradeoffs. Real artists are fewer in number, but those will want clay instead. This is incredibly pretentious and might not match reality.
- outworlder 9y agoAm I the only one who finds it hilarious that there are complaints about Lisp syntax, when the language itself is almost infinitely modifiable? You can replace parens with reader macros. You can replace built in names with ordinary macros(in some dialects, even reassign the built-in functions altogether). Don't like the let syntax? Modify it yourself to something completely different. You could modify Lisp to look like json if you were so inclined. You have access to the compiler at compile time and runtime. Do whatever you want. If anything, people should be complaining about other languages that don't allow for syntax modification. Want to not type semicolons in C? You are essentially out of luck, unless you want to make your own preprocessor (I don't think the standard one has enough expressive power to do so, but I'd love to be proved wrong). Complaining about parentheses takes zero effort though. You don't have to spend a single second trying to understand why it looks weird like that...
- willismichael 9y agoI'm a lisp fan, but to be fair, I don't think I know anybody who wants to live in a world in which everybody has created their own personal language syntax. Reader macros should be used very judiciously unless you don't care about anybody else being able to understand your code.
- outworlder 9y agoI agree. But if you care that strongly, you can do something about it. (I am also kind of hoping that, by the time one gets to reader macros, they will be experienced enough, and will understand why the parentheses exist so that they will no longer care about them)
- threatofrain 9y agoBut for many people "caring that strongly" and "doing something about it" means choosing another option. As opposed to essentially writing a new language. Good defaults do matter, and I would also echo the feeling that the parentheses get in the way, and that a non-small component of my thinking or polishing process is how to responsibly reduce parentheses. I find that it's generally a modest but palpable boost to visual ease. I do wonder whether there's a better way to denote nested lists?
- juanmirocks 9y agoBack in 2009, when I first learned Common Lisp, I had the hope Lisp would one day become mainstream. Then in 2012 I had the same hope for Scala. ... I got older and I'm not anymore a dreamer Legacy code and imperative thinking is heavy.
- DannyB2 9y agoSimilar experience, dream. Started playing with XLisp in late 1986. Common Lisp in 1989 to 1993. Loved it. Was greatly influenced by it. But never used it commercially. Now I dabble with Clojure on the side.
- mncharity 9y ago> I'm not anymore a dreamer Perhaps it's time to start dreaming again? Rewriting the world for VR/AR is coming up. And unlike the rewrite for mobile, this time our software development environments will be transformed as well (mobile wasn't a place for writing code). And while we're perhaps running out of time for new compiler targets and languages, there seems a lot of potential for changing infrastructure. For example, a talk went by, which I recall as someone dropping linux instances on google lambda, and setting up deterministic C compilation, for massive parallelism and caching. So push a button, and some seconds later a linux kernel has been recompiled (from empty cache). Which rather changes the constraint space on "our language or type system can't provide nice-thing X, because it would take too long to compile". Golang's story of runs fast on a couple of local cores, may shortly sound like "my IDE runs on a PDP-11!", sort of "that's cute - nice art piece". Is it ok to take two days to run some proof obligation? ... well, is it cached now, so no one ever has to do that again? Eye tracking; hand/finger tracking; escaping from 2D's crippling real-estate constraints; speech recognition; fine-grain code sharing; rich compilation frameworks ... there's a lot of fun incoming.
- posterboy 9y ago(It (is :wonder (we can (read :text without (as much :brackets as) LISP)))). Well, "as _ as" is technically bracketing, but you get the idea. So I tried once to use a dot as list terminator, which didn't work well. I found myself adding different terminators for each level of depth. Because, at some point the encapsulation over multiple levels leads to ambiguity, if outfix notation isn't used (as for the encapsulation in this sentence). A common wisdom is to avoid deep indentation. 3rd normal form schemes are enough for most cases, thank Codd. By the way: I've been hugely interested in historical linguistics recently and came to conclude counting must have been a huge boost for the development of language facility. Basic phrases are just enumerations. Which reminded me of list processing. Many old languages actually tend to follow VSO word order, too. Plural is often enough expressed as reduplication. But I don't have deeper insights to offer from this on how to avoid the parens, except that zeroth order logic is fundamental and a linguistic approach to programming languages might prove fruitful (grammar, not syntax). And by the by the way: Isn't "everything is an object" similar in power to homoiconicity?
- dropit_sphere 9y ago>And by the by the way: Isn't "everything is an object" similar in power to homoiconicity? This is the only part of your (very interesting) comment I feel qualified to talk about. I think there may be something there, but you'd have to be extreme about it, making methods into objects, and proabably even keywords like "if." This is a high bar---but macros clear it.
- AdieuToLogic 9y agoLISP is great, but the problem with making programs in it is that one invariably ends up trying to answer the meaning of life, the universe, and everything. (just kidding (sardonicly? (isn't it obvious? (depends on how one writes it (like with what editor? (we all know there is only one editor (emacs? (Stallman's own (not to imply ownership (as editors should be free (along with all software (like knowledge (which are just ideas with proven value (requiring recognition (implying awareness of self (assumed when using LISP) )))))))))))))))