16 ms·
The truth about Lisp (2006)
- adamnemecek 10y agoYou should add 2006 to the title. The topic is very mid 2000s.
- blunte 10y agoWith anything (especially technical) I read online, the first thing I look for is the post/publish date. Some tech content is timeless, but much of it is useless if older than two years.
- mcguire 10y agoAbsolutely. All of the jokes in this article have been reimplemented in Ruby and then in Javascript since it was published.
- calibraxis 10y agoBraced myself before reading this, but what a pleasant surprise! > infinite number of closing parentheses Nowadays, you can express it with finite parentheses using -> macros popularized by Clojure.
- yomly 10y agoThe thread macro is really a treat and allows for more expressive functional piping of data. A lot like dot chaining in your python/scala/rubys or cascading in Javascript - get a lot done with minimal boilerplate
- JBiserkov 10y agoClojure even has a .. macro which makes dot chaining even more readable - the resulting code has less dots and less parenthesis than the equivalent java/python/ruby/scala code!
- DonaldFisk 10y ago> Braced myself before reading this You should have parenthesized yourself.
- JBiserkov 10y agoReminds me of an old joke: CEO: Someone stole the last 50 megabytes of our main product's source code Programmer: The last megabytes you say? No worries, it's written in Lisp.
- deleted 10y ago[deleted]
- kossmoboleat 10y agoI still do wonder why reddit was reimplemented in Python, but with rewrites in other languages I think that rewriting in itself made it more readable and not using the other language. Plus maybe using a web framework instead of doing most by hand, because I assume lisp had even fewer good web frameworks than python then.
- coldtea 10y ago>I still do wonder why reddit was reimplemented in Python Because they new Python better and/or it has a better and vastly bigger ecosystem and libs, and it being Lisp only gave the very marginal returns of being cool to your programming peers.
- qwertyuiop924 10y agoPython had better libs. And they wrote web.py. Which is just barely less cool than Flask.
- mbrock 10y agoThat seems like an unnecessary jab.
- coldtea 10y agoNot if it's true. Python does have a better and vastly bigger ecosystem and libs. And doing something in Lisp doesn't offer any huge benefits over Python -- besides the cool factor. Sure, Lisp has some tricks Python doesn't have -- macros, homoiconicity, uniform syntax, etc -- but still with those, in real life, people haven't been able to come with anything like an order of magnitude or at least several times better programs or faster development than with something like Python. Just ask Norvig.
- fractallyte 10y agoActually, someone did ask Norvig... ;-) https://news.ycombinator.com/item?id=1803627 https://news.ycombinator.com/item?id=1803627
- avindroth 10y agoI am fairly deep into learning Haskell. After I am done, should I learn Lisp (SICP)? Smalltalk? Prolog? I am learning these languages for mind-expansion. I am also studying AI, will learning Lisp be relevant? (e.g. Help me reason about and write AI systems)
- weavie 10y agoI think once you are done learning Haskell you will know the answers to all these questions. Although one could argue you will never be "done" learning Haskell.
- i_don_t_know 10y agoPersonally, I like programming languages that force me to think about a problem completely differently than what I'm used to. So for mind-expansion I would suggest Smalltalk and then Prolog, because they are completely different from Haskell, much more different than Lisp/Scheme is. I'm not an expert on lisp and AI. From what I understand lisp has been the traditional go-to language for AI research, and for "classic" AI you probably cannot go wrong with learning at least the basics of lisp. However, a lot of recent AI research seems to be on neural networks, deep learning, and statistics. I don't know how important lisp is in those fields.
- lispm 10y agoIf you use Lisp, you have Prolog and Smalltalk, too. Built-in.
- i_don_t_know 10y agoYes, and while that may be an advantage for actual use of the language in practice, I think it's a disadvantage for learning the concepts behind OOP and logic programming. Prolog forces you to solve your problem with logic programming. You cannot take the easy way out and solve it (wholly or partially) in some other way that you already know. Likewise, Smalltalk forces you to solve the problem with OOP. Haskell forces you to deal with pure functions and lazy evaluation. APL forces you to solve the problem with vector operations. Some of the approaches and solutions may be clumsy and worse than what you can do with a mix or some other programming paradigm. But I thought the point of the exercise was to learn the different programming paradigms, and in that context I prefer programming languages that do not offer alternative ways of solving the problem. I prefer a more restrictive approach and lisp is anything but restrictive (CLOS, kanren, etc). Also I find that a different surface syntax helps me context switch to a different programming paradigm. For example, when I see s-expressions my mind switches to scheme and thinks accordingly, and that would be a distraction to me if I wanted to program imperatively, for example. When I see Prolog, I have a hard time thinking in terms of OOP. Maybe that's just me. The reason for suggesting Smalltalk first was that it's farther away from Haskell than Prolog (Prolog clauses can appear similar to functional programming). Switching to Prolog after Smalltalk is another big jump. I like big jumps. They help me switch context. The OP may be different, I don't know.
- grabcocque 10y agoClojure is currently the sexy lisp du jour. When I first learned Clojure, to me it was the first time programming truly clicked with me. That first time I ever felt that spark of "oh my god, so that's what programming can be like!"
- weavie 10y agoWhat was it about Clojure that made it click?
- grabcocque 10y agoLisp's propensity for terse, expressive code. Persistent data structures. A novel approach to concurrency by mainstream language standards.
- madmax96 10y agoI like Clojure because it's a Lisp 1 and the novelty of having MVCC implemented in my language. With respect to the Lisp 1/2 debate, I hate how this: (defun foo (g y) (g y)) (foo #'- 10) ; error Is an error in Common Lisp. Instead, you have to: (defun foo (g y) (funcall g y)) (foo #'- 10) ; works That's just so inelegant IMO. Scheme does the "right" thing and lets you do: (define (foo g y) (g y)) (foo - 10) ; works but lacks a de facto build tool and package management system. (I also really like Scheme's macro system, but not everyone agrees). Clojure solves the build tool and package management system, does the "right" thing with higher order functions, and offers seamless Java(Script) interop, which is why it has enjoyed more "mainstream" success than other Lisps.
- bitwize 10y agoR7RS has a standard package system. There seems to be some consensus on using Marc Feeley's Snow for distribution of R7RS packages. If you're running Racket, there's also PLaneT.
- lispm 10y agoBut: (define (foo lst) (list (map + lst) (map - lst))) WTF? Or: (define (foo + - lst) (+ (reduce + lst) (reduce - lst))) (foo - +)
- grabcocque 10y agoExtant lisps rated by their likelihood of changing your life: Scheme: 7/10 Common Lisp: 3/10 Racket; 8/10 Emacs Lisp: 0/10 Clojure: 9/10 LFE: 9/10 These rankings are scientific fact.
- qwertyuiop924 10y agoThey'll all change your life, but Scheme will change your life more, and better.
- tehmillhouse 10y agoAnd thus the student was enlightened.
- JohnStrange 10y agoI prefer Racket to Lisp. But in a sense it's also Lisp, just not Lisp-2.
- qwertyuiop924 10y agoI prefer Scheme to Racket. But that's also lisp. And scheme and racket are far closer together than Common Lisp.
- timewarrior 10y agoWhen I started using Clojure, the first two weeks were mess. I was trying to fit everything in procedural way of thinking and boy was it a mess. I felt really miserable and maybe that is how it felt when I first started to walk. And then suddenly everything clicked and the world was beautiful. Clojure has a steep learning curve when you start. After about a year and a half there is another much steeper curve and if you cross it, I have heard it feels like you have super powers. I am probably 4/10 on Clojure and 9.5/10 on Java. However I take around 10% of time to get better results with Clojure vs Java. I can try taking a shot at listing why I love Clojure however for me it is as difficult as explaining why I love someone: 1. Computers are functional. You give them a massive subroutine and they execute it. All procedural languages have built semantics to make it supposedly easy for humans to write code but end up with a lot of hacks. Only you start writing functional you feel finally connected to the computer. 2. Immutable structures: With most languages it's difficult to have assumptions about how your code will work. You pass your data to a function, can they change the data due to a bug or bad design. Do you create a copy before sending it to them? All those issues go away. It's better to understand expectations and stupid errors go out of the way. 3. Reusable code: because it's functional and without side effects it's much more easier to create reusable code as a part of standard library. You have functions like butLast (give me all elements of an array except last), even?, rest (return all elements of array except first). Imagine how much less boiler plate would it be. Check out some of the functions here: http://clojure.org/api/cheatsheet http://clojure.org/api/cheatsheet 4. Encourages you to write smaller chunks of functions, not 2000 line long functions. Improves code reusability and testing. 5. Doesn't allow bad design practices - circular dependency. 6. Because the language is built on a very few core constructs, you or anyone else can enhance the language. I have seen situations where someone had a proposal to extend the language, they just releases it as a library. If people like it and use it, it would get included as a part of core framework. 7. The quality of available talent - Because there is a steep learning curve almost everyone Clojure programmer that you meet is likely to be very smart. 8. Has inbuilt support for magical stuff like macros, STM. You can Google it to find out more. 9. Imagine all the java libraries that were very complicated to use and with their confusing java docs. Clojure community has built a lot of super easy to use wrappers on top of it and you could easily write one too. 10. In other languages if I see a library on github which hasn't been updated for years, it feels like it has been abandoned and I would not consider using it. With Clojure, because of functional and no side effects - a code which works now is likely to keep on working with it's current contract. It is not uncommon to see libraries which were built by some of the rockstars in the community within a day and not updated for years but still they work great. 11. Because of being functional and no side effects, code hot replace actually works. Many other languages have attempted it, but it always comes with a bit of caveats. With Clojure it just works. My developer code flow was that I would use an IDE and which I am writing code, it would hot replace the code in VM, find the tests which depends on the changed code and run just them. So I can see the code I am breaking while I am writing code. This is unbelievable. When we had an issue, I used this to connect to a REPL (a commandline for VM) - hot swapped a code to add logging, figured out the issue, fixed the code locally, copied the function to replace the code on running server, fixed the code and pushed it again (I wouldn't recommend people do this, but explains the power at your fingertips). This list could go on and on. In my current job, I am building a big team where any set of people could come together and build a startup. Like Google's Area 120, but started more than an year before that. Unfortunately I am not encouraging people to use Clojure here, because it would set them back by months. I really love my current job, however I keep getting impulses of quitting everything and just code Clojure full time. I hope people can see that I am smitten. Give it a try and I promise you wouldn't regret. edited: for readability
- qwertyuiop924 10y agoThis really is a great piece of affectionate satire. Lisp evangelism is annoying, even to Lisp programmers. In any case, Lisp may be the best language, but it's not the most powerful. What is the most powerful? The language from which god wrought the universe.(https://xkcd.com/224/ https://xkcd.com/224/)
- reidrac 10y agoI found really interesting the amount of broken links in a blog post that is 10 years old, besides the fact that the blog post still exists after 10 years.
- tempodox 10y agoOne of those links has a domain of “webhost4life.com”. That must have been a short life.
- kleptako 10y agoSame thing is probably going to happen in a few years, but with URL shorteners
- 0xmohit 10y agoThe link in the following line: > Lisp is so simple to learn that you can learn lisp in just a few minutes. can be found on the wayback machine: http://web.archive.org/web/20061011071033/http://blog.amber.org/2004/12/23/learning-lisp/ http://web.archive.org/web/20061011071033/http://blog.amber....
- type0 10y ago> Paul Graham originally wrote reddit, in lisp, on the back of a napkin while he was waiting for a coffee. it was so powerful that it had to be rewritten in python just so that ordinary computers could understand it. Because you need a true Lisp machine... Next thing you know, you'll be waking up in "the matrix".
- criddell 10y ago> Because you need a true Lisp machine... Next thing you know, you'll be waking up in "the matrix". Hey now, Symbolics machines may have not been the fastest, but I rarely fell asleep in front of them.
- jackfoxy 10y agoI would like to see a light-syntax dialect of Lisp that recognized semantic white space to get you out of the parentheses maze. (But you could still optionally use parens when you wanted.) Disclaimer: I've been coding almost exclusively F# and SQL for nearly 3 years, and any kind of ceremony and noise characters in code just throw me off. Typescript is being hard on me right now.
- jackfoxy 10y agoPredictably I offended somebody. Discussions of parens in Lisp often turn out this way. I actually think Lisp is a beautiful language, the only language (other than assemblers) that I'm somewhat familiar with that is homoiconic. (At least a couple more according to https://en.wikipedia.org/wiki/Homoiconicity. https://en.wikipedia.org/wiki/Homoiconicity.)
- qwertyuiop924 10y agoActually, that's already been done in Scheme. Three times. Wisp(http://www.draketo.de/proj/wisp/ http://www.draketo.de/proj/wisp/) is probably the best one. It runs as a preprocessor, but if you use a scheme with the right syntax hooks (guile, racket, a few others), you might find a direct implementation. In fact, the main distribution has one for guile. There's also something similar for Common Lisp, but I don't know where or what.
- zeveb 10y ago> I would like to see a light-syntax dialect of Lisp that recognized semantic white space to get you out of the parentheses maze. Take a look at sweet-expressions: http://readable.sourceforge.net/ http://readable.sourceforge.net/
- qwertyuiop924 10y agoI'd reccomend wisp over readable: it's more readable than readable.
- zeveb 10y ago
- peter303 10y agoLISP is powerful because its fundamental syntatic structure and data structure are the same- a list where the first element is the function-name or keyword. You can basically write programs that extend themselves by writing out new functions and data. Other modern languages like html and json have the nested list as the fundamental data structure. But they arent self-executing like LISP. But having one main syntactic and data structure- the list- is what makes LISP annoying too. You have to translate other syntax and data structures into lists. Its always possible, but sometimes kludgey and unreadable. An advantage of LISP in the 1960s was that it was interpreted, i.e. relatively high speed feedback for short programs, compared to its competitors which where batch-compiled, and might take hours to see how they would run.
- mordocai 10y ago> But having one main syntactic and data structure- the list- is what makes LISP annoying too. You have to translate other syntax and data structures into lists. This is what macros (especially reader macros) are for. Just translate it once and then save the transformation as a macro and write it the natural way for you. Of course, that's a lot easier to do/maintain when it is just you working on the project.
- TheLarch 10y ago"But having one main syntactic and data structure- the list- is what makes LISP annoying too. You have to translate other syntax and data structures into lists. Its always possible, but sometimes kludgey and unreadable." I like everything but the quotation above. This is a higher-level version of the ubiquitous "the parens are ugly" objection. This objection misses the point because "Lisp is a building material, not language." In order to use Lisp effectively you design an intermediate language appropriate for the problem domain. This approach is fundamentally at odds with a language such as Java, whose premise is that it provides all the abstractions you need to solve the problem directly. With Lisp you literally have whatever language you want. Non-Lisps leak more and more as complexity increases. Two examples that jump to mind right away are lambdas in Python and generics in Java. In both cases the designers plugged holes in the abstractions they chose years before. Both are kludgey in my eyes, clear afterthoughts. Both features are trivial in Lisp. Lisp is so simple that the limitations never arose in the first place. Your language has made a compromise to simplify these things, but at the expense of flexibility. C++'s accretion disk is a marvel at this point. You can use macros to streamline elaborate data structure creation by the way.
- Impl0x 10y ago> computers of the future will not be able to implement any of our ideas without creating time-travelling algorithms that borrow processing power from other computers that are further into the future. > This sounds difficult, but in lisp it isn't difficult at all. > in haskell this is a built-in feature The creepiest part is that it's almost true: https://hackage.haskell.org/package/tardis-0.4.1.0/docs/Control-Monad-Tardis.html https://hackage.haskell.org/package/tardis-0.4.1.0/docs/Cont...
- catnaroek 10y agoThat blog post is tagged “functional”, but Lisp isn't a functional language - not even an impure one. Functional programming is expressing computations as the evaluation of mathematical functions whenever it's possible. Sure, some operations are intrinsically not mathematical functions (like sending data over a network, returning the system date, you name it), but, in general, data structures and algorithms should be implemented as values and mathematical functions on them. Mathematical functions are mappings from values of a domain to values of a codomain. Naturally, if we want mathematical functions to be a basic building block for programs, we need a rich set of values on which said functions may operate. Now, here's the thing: Lisp doesn't have compound values. The only values Lisp has are numbers, characters and references to objects. All of them are primitive and indivisible. “But, catnaroek, what the hell are you smoking? Aren't lists, structs and vectors compound values?” No, in Lisp, they're not. They're mutable objects whose state at any given point in time may be interpreted as a value in your favorite metalanguage of choice. Maybe if the metalanguage isn't Lisp itself, you can interpret the object's state as a useful value! In case the above wasn't too clear, let's review the difference between values and objects: (0) A value is something you can bind to a variable. (At least in a call-by-value language, which Lisp most definitely is.) It doesn't matter, or even make sense, to ask whether “this 2” is different from “that 2”. There is always one number 2, regardless of how many times the number 2 is stored in physical memory. Nor does it make sense to ask whether 2 will suddenly become 3 tomorrow. 2 and 3 are always distinct values. (1) An object is an abstract memory region. Every object has an identity and a current state. The identity is always a primitive, indecomposable value. The state may be compound, but it isn't always a value. (This depends on the language.) Even if the current state is a value, the state at a later point in time might be a different value. Objects with immutable state are largely impractical - why bother distinguishing the physical identities of entities that never change? Now it becomes perfectly clear that, while Lisp has compound objects, it doesn't have compound values. Sadly, without compound values, you can't have functions taking compound values as arguments, or returning compound values as result. Since compound entities are unavoidable in practical programming, this means you pretty much have to use objects. “But, catnaroek, what if we encode compound values as Gödel numbers?” Hah! Have fun with that! --- As an exercise for the reader, for each of the following languages, determine whether it's functional or not: Scheme, Racket, Clojure, Scala, F#, Erlang, JavaScript. Justify your answers.
- jokoon 10y agoI sense it would be way more entertaining to learn how to make a language with clang, learning BNF notation, understanding LL and LR parsing, than learning lisp or haskel. That way you quickly overwhelm zealous and eager students so they can calm down and stick with the languages normal people use, and stop with those usual functional rabbit holes.
- spdionis 10y agoToday we could add node.js to the replacements list.