4 ms·
This article fails to explain why lisp. People talk about it on HN sometimes. This article says "here's how to learn it". Why should I learn it? There's a mill
by ativzzz 2y ago
This article fails to explain why lisp. People talk about it on HN sometimes. This article says "here's how to learn it".
Why should I learn it? There's a million languages out now that I can learn instead. The author gives a few ways I can use lisp. Why would I choose lisp over any of the other languages that have stronger ecosystems that solve those same problems and are built specifically for them?
The syntax looks arcane and it seems that the most prevalent modern use for lisp is emacs, so if I don't use emacs, why lisp?
- uncleshelby 2y agoMatthew Butterick wrote a book about Racket (a dialect of Lisp) which has a great appendix that tries to explain why Lisp is worth learning: https://beautifulracket.com/appendix/why-racket-why-lisp.html https://beautifulracket.com/appendix/why-racket-why-lisp.htm... There are lots of evangelist explanations for why Lisp is The Best out there, but this is one of the better and more concrete ones.
- nomilk 2y agoNot sure how much other languages developed in 22 years since this essay, but PG makes the case for lisp here: https://paulgraham.com/icad.html https://paulgraham.com/icad.html Computerphile riffs on the importance of homoiconicity and the ability for a language to programatically alter itself: https://www.youtube.com/watch?v=dw-y3vNDRWk https://www.youtube.com/watch?v=dw-y3vNDRWk Uncle bob had tried many languages and settled on lisp: https://www.youtube.com/watch?v=UBXXw2JSloo&t=2m40s https://www.youtube.com/watch?v=UBXXw2JSloo&t=2m40s > for 30 years I thought I don't want to learn lisp, it's a dumb language, and I read (Structure and Interpretation of Computer Programs) and it changed my mind... I thought I'm going to get (clojure) and dither around with it.. and I just fell in love with the language and I've been using it ever since
- lgrapenthin 2y agoThe article is not trying to sell you on Lisp, in its first sentence it clarifies, that it is written for people who were "asking for advice on how to learn Common Lisp"...
- deleted 2y ago[deleted]
- pjlegato 2y agoIn brief, Lisp's S-expressions (the parentheses) are a straightforward instantiation of the abstract syntax trees to which all other languages parse. You can manipulate that tree easily and directly in Lisp, whereas other languages (that are not variations of Lisp) hide parts of it, to varying degrees. All other languages are either equivalent to Lisp, perhaps with a different superficial syntax (there are very few of these; one is Mathematica) or expose only a strict subset of this capability (most other non-Lisp languages.) In particular, Lisp makes it trivial to do (real) metaprogramming -- programs that write other programs, including the introduction of entirely novel syntactic constructs -- via macros. Lisp macros can create new language syntax that controls when and how code is evaluated, perhaps rewriting it. Non-Lisp languages can't do that fully, only subsets of it. Ruby metaprogramming, for example, is clever syntactic sugar. You can give methods clever names and use clever calling conventions so that they read more similarly to English, which is called "metaprogramming" in Ruby; but you don't have universal control of the parsers from the level of ordinary Ruby code, and you can't completely control when and how code evaluation happens. Now, how practical or useful is all that? Opinions vary, from hardcore "you should invent a full DSL with unique syntax for each particular application" Lispers, all the way to those who say macros are a fun but dangerous toy with limited practical value.
- ativzzz 2y agoThanks! As someone who hates reading metaprogrammed ruby code, I imagine since Lisp gives you even more power, trying to understand what's happening in code is even harder. I know some people enjoy writing this style of code, but I personally do not
- lispm 2y agoIt's not that difficult. Lisp makes it easier, because one can look at code. For example look at this built-in Lisp macro example, which iterates from 0 to 9 and writes the numbers. CL-USER> (dotimes (i 10) (write i)) 0123456789 NIL Common Lisp has tools like a pretty printer for code (-> PPRINT) and a tool for expanding a macro form: CL-USER> (let ((*print-right-margin* 30)) (pprint (macroexpand '(dotimes (i 10) (write i))))) (BLOCK NIL (LET ((I 0)) (DECLARE (TYPE UNSIGNED-BYTE I)) (DECLARE (IGNORABLE I)) (TAGBODY (GO #:G267) #:G266 (TAGBODY (WRITE I)) (PSETQ I (1+ I)) #:G267 (UNLESS (>= I 10) (GO #:G266)) (RETURN-FROM NIL (PROGN NIL))))) From above one can see that the code gets transformed in very low-level Lisp code, with a GO operator (-> a GoTo). It's a low-level loop expressed by loop made from a simple goto operator. One can look at the code and try to figure out what it is doing. One is not guessing what the expanded code looks like, one can generate the expanded code and see what it looks like.
- floxy 2y agoThe real reason to learn SBCL, is because that is an existence proof that garbage-collected multi-paradigm (procedural, functional, object-oriented) dynamic languages don't have to suck performance wise (speed and memory usage). I'm going to go off the rails and say that 'defmacro' isn't the reason one should use a lisp. ~90% of 'defmacro' instances are really just to prevent evaluating expressions, which could also have been done with a lighter syntax (e.g. reader macro) for lambda (smalltalk for instance). Why didn't lisp catch on? Some 30-40% of people really hate parenthesis with a passion. There is no accounting for taste I guess. Lisp advocates also spent too many decades comparing lisp to C (instead of Python or Haskell or Java). And it seems like there was at one time a faction that looked down on free-software/GPL for a while, so there wasn't as much activity that people (especially college students) could see and engage with. The standard library is sparse and could use a CLOSified refresh, but everyone disagrees on how that should look. Too many lofty promises of 10x or greater productivity gains, and not enough wins showing it. Who knows, I haven't looked as common lisp in a while, maybe there are now vectorized/parallel array libraries targeting GPU's now that everyone uses, because things "just work" out of the box. Or a polished off McClim, or other lispy gui, instead of wrapping Tk. That combined with the usual network effects. https://www.sbcl.org/ https://www.sbcl.org/