62 ms·
How Lisp is Going to Save the World
- carlesfe 14y agoWow, that went from a supposed linkbait title to a surprisingly amusing and interesting explanation of Lisp
- smartial_arts 14y agoThank you. Admittedly, I intentionally worded it to look like one :)
- hayksaakian 14y agoWas that with the intent of baiting clicks, or as satire?
- smartial_arts 14y agoNeither - I cannot measure how many times it gets clicked, since it's not my website, and I didn't really mean it in the satirical sense. I guess I just wanted to see how many points it collects. So far it has exceeded my wildest expectations, although that is mainly due to the content, not the title.
- sp332 14y agoIn the Explanation on Brevity Guild Micro Fighter, you use "i" as the variable, but the code snippet uses "n". I only found this because I was having fun following along! :)
- smartial_arts 14y agoThat's not my comic, unfortunately :) You'd better let the website owners know.
- mbesto 14y ago> although that is mainly due to the content, not the title I'd beg to differ.
- marcofloriano 14y agoNo bugs when programming in Lisp? No way ...
- santu11 14y agoI am a intermediate programmer with just over one year experience. Everywhere I read about the power of lisp and really want to use it. If it is so good why ain't it is used more? It is very easy to get sites running using ASP .NET, wordpress, RoR or Django. I have worked on production sites using the first two. And personally tried on small projects on the last two. Is there a way to use Lisp professionally?
- smartial_arts 14y agoI am not too sure about Lisp in particular (especially there's at least few dialects of it, afaik) but I am currently looking into Clojure and, apart from bending my brain, tossing it into a rubbish bin then fetching and putting it back in, I like it very much. Also, there's a Noir [1] framework build on top of it. [1] http://www.webnoir.org/ http://www.webnoir.org/
- jonahkagan 14y agoApparently Noir is deprecated in favor of Compojure, according to http://news.ycombinator.com/item?id=5027560 http://news.ycombinator.com/item?id=5027560.
- DigitalJack 14y agoI was surprised to hear this, but it's true: http://blog.raynes.me/blog/2012/12/13/moving-away-from-noir/ http://blog.raynes.me/blog/2012/12/13/moving-away-from-noir/
- Sandman 14y agoNoir lives on through lib-noir [1]. I also suggest checking out Luminus [2]. [1] https://github.com/noir-clojure/lib-noir https://github.com/noir-clojure/lib-noir [2] http://www.luminusweb.net/ http://www.luminusweb.net/
- lukego 14y agoCheck out Lispjobs. http://lispjobs.wordpress.com http://lispjobs.wordpress.com
- ratonofx 14y agoA Fantastic metaphor!
- david927 14y agoWith the deepest reverence to John McCarthy, I regret to say that Lisp is our cosmological constant. It creates a static universe that is otherwise expanding; it reduces the problem to a solvable one and then declares victory. The truth is, it's all state. All of it. Remember that movie "Boy in the Plastic Bubble," about a boy with an immune system deficiency who lives instead a hermetically-sealed, sterile bubble? That's not the answer. We instead need to create immune systems (read: robust systems) rather than simply avoiding them. [I know I'm simplifying things, and this is not meant to be a slight.]
- gnosis 14y agoLisp is a multi-paradigm language that's perfectly capable of representing state. Perhaps you're confusing it with some purely functional language like Haskell.
- david927 14y agoI'm not saying it can't represent state; I'm saying that it promotes avoidance of state as a virtue.
- gnosis 14y agoOne of the reasons avoiding state is promoted is to make it easier to write robust software. State is too often the enemy of robustness.
- larholm 14y agoAnd robustness is often the static plastic bubble that hides in itself, never accomplishing much in the real world. State is too often the real world. Mind you, I like robustness. It's like the cinder blocks I use to build my house, each robust and contained in itself. I just can't disregard state when stacking my cinder blocks on top of each other; the flexing and distribution of load is an emergent state that I have to consider when building each cinder block.
- revjx 14y agoSuperb. I went on to read the sample chapter, which was equally amusing and interesting. I think I'm going to order the book, despite the fact I can't really think of any practical applications for Lisp in my day job - although who knows.
- dschiptsov 14y agoThere is less insane way to personal insights - http://www.paulgraham.com/onlisptext.html http://www.paulgraham.com/onlisptext.html
- mwexler 14y agoGreat intro. Any comments on "Land of Lisp" as a book for a "want to learn Lisp" journey?
- craftman 14y agoExcellent book to discover and learn Lisp, maybe the best one actually. It covers all aspect of Lisp and provides lot of examples code based on games. This is somehow more fun than the math example of SCIP (even if this is another great book I deeply appreciate too)
- muraiki 14y agoThanks for this -- I've been thinking about taking up SICP but I'm not that math-oriented (I do want to change that, though!) I think that I'll pick this book up first.
- spacemanaki 14y agoIf you enjoyed this little taste, you should get the book. It's really fun. There's a lot of code in it, and although it uses games as the subject for the examples, the code is definitely not fluff. It's been a year or two since I read it, but I recall that there's a bunch of graph traversal and search programs and even some low-level HTTP code.
- chimeracoder 14y agoLand of Lisp was how I first got into Lisp - I was hooked already before finishing even a third of it. For production code, I ended up abandoning Common Lisp for the most part in favor of Racket, simply because of its library support and compatible, scoped dialects, but the principles are the same in either case. I'd actually recommend starting with something less 'batteries included' if you have the patience, because it makes it easier to see the fundamental beauty of the language, without getting distracted by something as "irrelevant" as library support. Some people say that Land of Lisp makes it hard to develop 'useful' applications afterwards, but for that, I think Practical Common Lisp is a good secondary resource, and it's easy to skim once you've completed Land of Lisp. Land of Lisp is much better as "Lisp Propaganda" - ie, for someone who's interested in giving it a shot, it does a good job of selling the Lisp paradigm as a whole philosophy, even if it doesn't have space to cover all of its practical uses[0]. [0] I won't sell it short, though - it does a good job for that too... several of the games it implements are non-trivial.
- dsafhkjsdh 14y agowho write this crap? i wrote in lisp (scheme), this is the most bugged language i ever used. and i used more then 5. this is non debugable language, it it makes it bug full. you have to follow complex ideas, and keep scores of ideas, this is not for normal humans. when you pass the wrong type and not support it, it goes to hell, and as a programmer you start to flame. list, is a piece of shit for the masses, its useful for handful, who didn't distribute the ideas well, and people when to the place where it was easier to write code, and less is needed for getting your path going.
- slurry 14y agoI enjoy Lisp, but I got to agree with you about scheme debugging. MIT/GNU scheme has to be most unhelpful interpreter I've ever used. Error messages are loud, completely unhelpful, and by the end of it I was convinced the REPL was actively trying to make me feel stupid.
- spacemanaki 14y agoDid you read the manual? http://www.gnu.org/software/mit-scheme/documentation/mit-scheme-user/Command_002dLine-Debugger.html#Command_002dLine-Debugger http://www.gnu.org/software/mit-scheme/documentation/mit-sch... It's not as easy as setting breakpoints in an IDE like Eclipse and using a visual debugger there, but it's definitely a workable command-line debugger. You just need a little patience in order learn how to use it, and also probably have a pretty good understanding of Scheme's execution model, but that would be true for debugging any programming language.
- slurry 14y ago> Did you read the manual? For real? > It's not as easy as setting breakpoints in an IDE I don't use an IDE. I'm comparing against command line tools for scripting languages, Haskell and Common Lisp. Some fail more helpfully than others.
- spacemanaki 14y ago
- bjourne 14y agoGreat story. Unfortunately, the API documentation and tutorial writing guilds went extinct decades ago and has never been able to return to Lispland. :)
- stcredzero 14y agoSeriously, this is a great point. One of the big problems with a small community of programmers who all think of themselves as elite, is that tasks like documentation and tutorial writing go by the wayside. This comment should be a wake-up call to any smart and far-sighted individuals who want to promote a language.
- pnathan 14y agoIs there a open source Common Lisp library that you'd like to see better documented? Also, if you're (or anyone else is) interested in working on a Common Lisp environment tutorial, shoot me an email. I've been working on one but haven't launched it yet.
- stcredzero 14y ago> Is there a open source Common Lisp library that you'd like to see better documented? I was talking as a long time member of a different programming community with similar attributes. (Smalltalk - since 1998)
- ludston 14y agoI would love to see cffi, opengl and one of the gtk binding libs have better documentation.
- orthecreedence 14y agoThe opengl bindings don't really need documentation, as they're automatically generated to mirror the C API. Really, if you want to know how to use `cl-opengl`, you memorize a simple naming convention and the rest is a matter of "how do I use OpenGL," not "how do I use cl-opengl?"
- TomMasz 14y agoThis looks like a comic from the 70s, photocopied and hanging on the bulletin board in the computer lab.
- S4M 14y agoI fail to see how this is going to convince anybody who hasn't tried lisp to give it a shot. This cartoon can be summarised as "All languages are accumulating bugs while lisp has some magic X and Y that provide a way around them." A blub user will think "yeah whatever", IMHO.
- king_magic 14y agoMy thoughts exactly, but I'd add this: I love and respect Lisp; I've written my fair share of it. There is absolutely nothing inherently magical in Lisp that prevent you from introducing bugs. You can just as easily make a logic error in your code that results in a bug. Bugs happen. Bugs will happen. There is no silver bullet. The only way to reduce bugs is to test thoroughly. tl;dr: nice cartoon, "lisp means no bugs" == total BS, bugs can totally exist in Lisp code
- S4M 14y agoYeah, I think the link posted here is doing little to make lisp popular, especially compared for example to a nice tutorial like the Seesaw example one to build GUIs in Clojure [0]. There, you can see how interactive Clojure is, and how fast it can be to develop stuff. Note that I took this example because it's on the top of my mind, but I am sure similar proves of interactivity can be made for other lisps. [0] https://gist.github.com/1441520 https://gist.github.com/1441520
- king_magic 14y agoHoly crap, Seesaw looks awesome! See, that's far more powerful - I had no idea that even existed, and now I'm excited to play around with it. This is great! I don't need a cartoon to sell me on something. I need to see how something can be used.
- disgruntledphd2 14y agoThank you so much for that link!. I'd been meaning to check out Seesaw, and it really lives up to its promise of making Java GUI's less painful.
- borplk 14y agoAm I the only one having a hard time reading lisp? Non-functional programs read like plain English. Particularly Python but I just can't get my head around the functional ones.
- loup-vaillant 14y agoImperative programs read like English. Functional ones read like Apache. The Main difference is, a functional programs mainly talks about what things are, not what they do. For instance: // C(++) int square(int n) { return n * n; } -- Haskell square :: Int -> Int square n = n * n The C code reads like a procedure to follow: "return n times n to whoever called you" (I'm anthropomorphising square(), here). The Haskell code reads like a description: "the square of n is n times n". That was the first major difficulty. Now the second one: functional code is often like reversed imperative code: // C(++) int compute(int n) { int x = foo(n); int y = bar(x); int z = baz(y); return z; } -- Haskell compute :: Int -> Int compute n = baz (bar (foo n)) -- alternate definition compute n = baz . bar . foo $ n where g . f = \x -> g (f x) -- function composition f $ x = f x -- function application So, in the Haskell code, you see that the data flows from right to left, instead of top to bottom. Like Unix pipes, only reversed. The final difficulty is getting used to the fact that functions are passed around directly. In C++, Java, or Python, we often pass around objects, who may or may not hold the same methods than the others that where passed around in the same way (that's polymorphism). Subtype polymorphism is neat, but most often, you need it because you want one method to change depending on various factors. A simpler way to do this is pass around the function directly. That leads to some powerful, though uncommon in the imperative world, idioms. For instance, you can write your own customized loops. Imagine for instance that you want to process lists in Haskell: -- A List is either data List a = Empty -- an empty node, | Cons a (List a) -- or a cons cell, -- with an element and a list. Now let's process the list inc-all :: List Int -> List Int inc-all Empty = Empty inc-all (Cons e l) = Cons (foo e + 1) (inc-all l) dbl-all :: List Int -> List Int dbl-all Empty = Empty dbl-all (Cons e l) = Cons (foo e * e) (inc-all l) See how much they have in common? There's a way to factor out that, with a map: map (a -> b) -> List a -> list b map f Empty = Empty map f (Cons e l) = Cons (f e) (map f l) Note that the first argument is a function, hence the (a -> b) between parentheses. Using it is very simple: inc-all l = map (λe -> e + 1) l dbl-all l = map (λe -> e * e) l And Haskell can make it even more concise, with what we call partial application. Haskell functions actually have only one argument. Multiple arguments are simulated by having the function return another function. Here: add :: Int -> (Int -> Int) add x = λy -> (x + y) Which is the same as: add :: Int -> Int -> Int add x y = x + y Or even add :: Int -> Int -> Int add = λx -> (λy -> (x + y)) So, inc-all and dbl-all above can be written as: inc-all = map (λe -> e + 1) dbl-all = map (λe -> e * e) Without those fundamentals, one doesn't stand a chance at understanding real world functional code. It's just too different. It's no harder, though. The main difficulty here is to change your mindset. Now I haven't talked about macros…
- nemetroid 14y agoI had Haskell as the subject in my intro course at university (my first experience with functional programming). I've tinkered a bit with it since then as well, and I'm at the "somewhat intuitive grasp of monad transformers" state. I tried Clojure some week ago through the Clojure koans that were posted here. Compared to Haskell I found the syntax very obtuse and it was not obvious why Lisp would be more powerful than Haskell. The bare-bones syntax felt more like a "proof of concept" than an actual strength. (of course, the koans took less than a day to do so I'm not dismissing Clojure because they didn't impress me, but I got the idea that the koans were an attempt to showcase Clojure's strengths)
- artursapek 14y agoDo you go to Yale?? Haskell school of music?
- gajomi 14y agoI would advise checking out the problems at http://www.4clojure.com/ http://www.4clojure.com/ over the koans. You will definitely find some challenging problems. The nice thing about these is that you can look at how other users all solving the problems, which helps to convey a sense of style. I haven't done a problem in awhile, but I oftentimes gotten something out of looking at solutions from 'amalloy' and 'chouser' in particular. Of course, you can also check out my own ('gajomi') solutions :).
- nemetroid 14y agoThank you. I will check it out when I get some spare time.
- chimeracoder 14y ago> I found the syntax very obtuse and it was not obvious why Lisp would be more powerful than Haskell. The easiest answer to that is, there's no syntax, which makes reimplementing your own Lisp parser trivial (one single function call, in fact). This in turn makes reimplementing your own Lisp, inline in Lisp, similarly trivial. That sounds like something out of an SICP exercise - and it is - but the same properties make it easier to reason about your code in a way that's far more abstract than other languages let you. Once you start treating your code as data that other parts of your code can manipulate, you can start refactoring in ways that simply aren't possible in other languages. This explanation by a well-known Perl programmer explains it very well: http://lists.warhead.org.uk/pipermail/iwe/2005-July/000130.html http://lists.warhead.org.uk/pipermail/iwe/2005-July/000130.h... Another way I've heard it (this may have been pg, but I can't remember), is that, when writing idiomatic Lisp, you first think, "What language would make solving this problem really easy?" and then proceed to implement that language.
- sek 14y agoI thought Lisp is the pinnacle of programming until I discovered Haskell.
- lispm 14y agoThere is a lot of cool stuff out there. Haskell is one of them.
- ericmoritz 14y agoI'm missing something; how does LISP enable bug-free programs?
- tome 14y agoThis is the crucial point which the whole discussion seems to have missed.
- benjoffe 14y agoDid you click on any of the blue links in the comic? They contain articles on language features with sections: 'Synopsis', 'How it kills bugs', 'Explanation' and 'Weakness'.
- goostavos 14y agoWhoa, hopefully I'm not the only one who missed that. I thought it was just animated text, not a link.
- thecombjelly 14y agoI love lisp. I use/used it to build my web service product[1] and anything else I can. =how do I do X?= java: something similar to X is already done in Y. add abstract class and redo X and write Y. +200 LOC lisp: something similar to X is already done in Y. realize you can generalize X and Y into a new pattern and use it for ABC too. -70 LOC =there is a bug in function X= java: open X.java. edit line. restart program. X seems to be working correctly. lisp: two hours later, ah ha! I understand this code. fix X. write unit test. eval unit test. X works correctly. [1] demo: https://a.keeptherecords.com/demo https://a.keeptherecords.com/demo, source: https://github.com/ThomasHintz/keep-the-records https://github.com/ThomasHintz/keep-the-records
- theevocater 14y agolook I like lisp as much as the next guy, but you can "spend two hours" reading java code, write a unit test; eval said test and then woohoo! You can do that in basically any modern language. And your first example is something that most modern languages are sold on. The truthiness of those statements can be debated, but your examples are flawed to say the least. Point is: you can generalize and write unit tests in any language.
- thecombjelly 14y agoThat is true to a degree but you really can not generalize very well at all in java. You will also be hard pressed to find java code written functionally enough that you can just run a unit test and know it is working correctly. Usually you have to instantiate many other classes and stub in test data via something like guice. There are many places for those bugs to hide in that type of setup.
- manish_gill 14y agoI'm foraying into the lisp land for the first time with SICP, and the one thing that bothers me the most is that Scheme is so hard to debug. As a Python programmer who is used to just used to print debugging, this becomes very frustrating very early on.
- stcredzero 14y agoMost of the time, you don't want to save the world because this presents scaling problems. Instead, save a little corner of the world and be open about how you are doing it. If you do this right, then you will garner lots of imitators. Then if your way of "saving the world" is well documented and robust enough to avoid the "cargo cult" pitfall, you will convince some large part of the world to save itself. Note the implication: You don't save the world by telling it, "You're doing it wrong." You save the world by getting the world to covet your success.
- chiquitabacana 14y agoI can't even look, it's too ugly. 1) Lisp writes bug-free software???? C'mon!! 2) That looks like a ridiculous atempt at comics coming from an 8 year old child.
- mrinterweb 14y agoThis book seems inspired by _why's poignat guide to ruby book http://mislav.uniqpath.com/poignant-guide/book/chapter-1.html http://mislav.uniqpath.com/poignant-guide/book/chapter-1.htm... Not that that's a bad thing, but I'm just surprised, no one else has mentioned the same.
- zem 14y agoapart from the excellent comic, i loved the insight into how laziness helps fight bugs. i'd never thought about it in those terms before.
- cafard 14y agoI have no problem believing in insectoid domination of earth. Bug-free software, Lisp or otherwise, does strain my credulity.
- gclaramunt 14y agoTypical Lisp propaganda: many brave non lispers are part of the functional, brevity, continuation and DSL guilds. And it chooses to ignore that the biggest battle was won by the type system guild...