9 ms·
The Liberating Experience of Common Lisp
- adamc 2y agoI can relate. I read Graham's book on Common Lisp more than 20 years ago and was entranced. But opportunities to use it in the day job are few and far between, and I would have qualms about recommending it, in most contexts. For a lot of purposes, its libraries are just nowhere near as good as Python or JavaScript or Java. And some of its superpowers (macros!) can also be used really, really badly. There was an essay about Lisp being a "language for smart people" that captured some of what would give me pause. On average, most shops have average people (for that occupation/industry). Not sure Lisp is the best solution for that context.
- sbenitez-mwb 2y agoYou don't need to be too smart to use it effectively.
- felideon 2y ago> There was an essay about Lisp being a "language for smart people" Presumably, you are referring to The Bipolar Lisp Programmer[1], an HN classic[2]. [1] https://www.marktarver.com/bipolar.html https://www.marktarver.com/bipolar.html [2] https://hn.algolia.com/?q=bipolar+lisp+programmer https://hn.algolia.com/?q=bipolar+lisp+programmer
- adamc 2y agoNo, I was referring to this: https://paulgraham.com/vanlfsp.html https://paulgraham.com/vanlfsp.html
- wglb 2y ago> Lisp being a "language for smart people" But doesn't autocad have lisp as a language behind the scenes and I would guess that autocad is used by folks who aren't full-time programmers? Also, I always found a way to use lisp, even when I was CSO. But admittedly these were side projects.
- pfdietz 2y agoIt has a version of lisp behind the scenes. It's not Common Lisp.
- dingnuts 2y agoI write Go for a living. I run Emacs. I read the first part of the article, thinking about how Lisp used in a personal project makes so much sense because you can build the meta-language to your liking and not make something so weird you confuse your coworkers -- and then I got to the section on Go and I thought wow! This guy really doesn't get it! >On average, most shops have average people Yes, hello, that's me! I don't want to figure out some genius's Lisp code. Instead, Go forces the geniuses to write code that I can understand. >There was an essay about Lisp being a "language for smart people" that captured some of what would give me pause I think about this a LOT. There is a LOT of this blindness in software philosophical thinking. Just look at FOSS: everyone should be able to view and edit source code. Well that sure made a lot of sense when "everyone" was MIT students because they were Richard Stallman's audience. But it stops making sense to expect users to inspect source code when users aren't all MIT students. Likewise, use your smart person language on your personal project -- I'm sure it's great. I'll keep using the dumb people language. And get replaced by an LLM, I guess. But if an LLM can generate Go code (like the author surmises) and not Lisp then it might as well just emit machine code and put us all out of work so I don't know why he thinks Lisp is a moat
- wglb 2y agoI think that the idea that Lisp is for smart people is misguided and wrong. I don't think a person needs to be a genius to do well in Lisp. As a long-time C and Fortran and Python programmer (and many other languages) it took a long time for me to adjust to the different way of thinking necessitated by Lisp. Also if Copilot or LLM write Go code, why do we think it can't write Lisp code? I've dealt with code in many languages that were written by "geniuses" and find that they can be as hard to understand as any Lisp program. Often this depends on the problem being solved. There is a story about Donald Knuth and Edsger Dysktra working on a problem that required no less than four stacks to process. (If memory serves correctly, they found a solution using iteration rather than stacks that was much clearer to understand.) The solution of Sudoku by Peter Norvig (https://norvig.com/sudoku.html https://norvig.com/sudoku.html) is a bit of a genius solution but it is written in Python. It would be a disservice if the article's distinction of smart vs average were to dissuade anyone from learning a new language.
- f1shy 2y ago>>> There was an essay about Lisp being a "language for smart people" Boy! Nothing can be further from the truth! At least my experience, trying to teach people to program in java, c, c++, lisp and assembly to both technical and non technical people, the only language that is easy to teach is lisp. By far the only language that everybody “got” and could actually do something on it. Compare that to c++, where experienced programmers shoot themselves the feet every single day.
- adamc 2y agoI think the essay had less to do with syntax than appreciating what makes lisp special. But sure. I love Lisp's ultra-simple syntax. And it makes macros work, which is indeed a superpower.
- asjir 2y agoI do web dev now, but it reminded me of good times coding in Julia. Like I once wanted to have my own syntax for querying a SQLite, so built my own ORM. The query syntax is defined in like 50 lines of code. Doc for it here [1] 1. https://asjir.github.io/FunnyORM.jl/dev/#FunnyORM.TableQuery https://asjir.github.io/FunnyORM.jl/dev/#FunnyORM.TableQuery
- netbioserror 2y agoLisp really is an eye-opening experience when learning to structure programs and computations. Stumbling on Lisp in college was a fascinating experience for me in particular because I had been raised around C++ and Java, and my programming life up to that point had been a struggle understanding how to abstract a program into objects and how to build those objects' interfaces. Once I started down the path of functional programming and Clojure, it became clear in retrospect that "objects" as C++ and Java envisioned them were poor fits for most problem domains, which is why their purpose never clicked in my head. Reducing data down to...well, data, and methods down to functions, and programs down to pyramids of expression calls made everything about program structure click in my head. Functional, expression-based style was FAR more intuitive to my brain than stateful object style. I now try to lean heavily into expressions and referential transparency no matter what language I use, though some languages make it easier than others. Funnily enough, C program structure came much more naturally to me than either C++ or Java. Maybe because it's easy to decouple data from operations on that data, even if stateful. Hard to say.
- monsieurbanana 2y ago> Maybe because it's easy to decouple data from operations on that data, even if stateful You can use objects in C++ and Java without mixing code and data (by having data-only and code-only classes for example). I haven't fully read it, but there's a book from a clojure developer about about this: https://www.manning.com/books/data-oriented-programming https://www.manning.com/books/data-oriented-programming The book itself uses Java, not Clojure.
- netbioserror 2y agoI know Java programmers use static-method classes, which are just like modules in newer languages. Which just further illustrates the point. It's a hack on top of a language that requires everything to be defined inside of a class. That layer of abstraction on top of things that could be much simpler kills understanding. It massively complicates answering the question "What even is a class?" for a learner. I also realize C++ has simple structs, and classes can be avoided entirely, but that's definitely not the way the language is taught. Maybe I needed to "git gud", but learning Lisp enabled a career building valuable products currently in production. Java and C# were a roadblock on the way to my current productivity.
- xixixao 2y agoOne minor point mentioned: I find it odd how many great PL designers I’ve known are hostile to learnings from other languages. Maybe because they field a ton of naive “why can’t A do what B does”. But languages are similar in many respects, and there are a great many lessons to share across.
- anthk 2y agoTwo books, for beginners and experts: - A Gentle Introduction to Symbolic Computation. Get both the book and the figures. https://www.cs.cmu.edu/~dst/LispBook/ https://www.cs.cmu.edu/~dst/LispBook/ Paradigms of Artificial Intelligence Programming https://github.com/norvig/paip-lisp https://github.com/norvig/paip-lisp https://unglueit-files.s3.amazonaws.com/ebf/59f74a93bbc1435c9ca1557b4bb6e9ba.pdf https://unglueit-files.s3.amazonaws.com/ebf/59f74a93bbc1435c... Get SBCL as the compiler/interpreter, it's the fastest FLOSS one. Portacle has everything to begin with minus the books. https://portacle.github.io/ https://portacle.github.io/
- wglb 2y agoThis is cool.
- efilife 2y agoWhy is this downvoted Not anymore, I balanced it out
- zelphirkalt 2y agoIt was probably downvoted, because it does not add anything.
- tmtvl 2y agoPractical Common Lisp is also a nice read, and the Cookbook* seems to be coming along quite nicely. There's also CLiki (the Common Lisp wiki), but I'm not sure how up-to-date it is. * https://lispcookbook.github.io/cl-cookbook/ https://lispcookbook.github.io/cl-cookbook/
- pjmlp 2y agoI wish this kind of comparisons actually would look beyond Emacs, into Allegro, LispWorks, Clozure CL.
- ds9soft 2y agoYes. I used Clozure CL before and now I use Lem as editor. But I stick to SBCL (at least for now, though I can see myself using CCL again when it supports ARM64). As for LispWorks, I installed the Personal edition and played with it. I can't afford it (actually I can, but I have to find a reason other than tinkering).
- wglb 2y agoHaving programmed professionally in 36 languages, I must agree with this. I am having so much fun with Lisp, that I am not likely to go back. > Often developers say how you can make a mess of a Common Lisp codebase because of such freedom it provides. But isn’t that the same with any language? There is a story about the code behind the terminal interface for Tops-10 for the PDO-10. It had been tweaked over the years adding various features, such as using control-T to see what was happening in the running program. Many attempts were made to rewrite it, but it was so intertwined, that whoever tried fixing it gave up. Three things are killer features for me with the slime+emacs running sbcl. First is that you can see the underlying source for anything down to the lisp implementation, e.g. the definition of 'macrolet'. The second thing is if there is an error, it displays the stack with the ability to see what the local variables are in any function on the stack. The third thing is that one can patch a running program, either once a breakpoint ('break) is encountered, or by doing control-C at the repl. And then resume it. It is also fun that SBCL is unreasonably fast. It compiles itself in 2m15s. I am pretty sure that gcc/clang/llvm take longer than that and also likely Rust. I have developed a habit of using s-expresions for lots of things, such as configuration files, and web page representations. I blame paredit and lisp for this tendency. See https://github.com/wglb/configuration-r https://github.com/wglb/configuration-r
- ilc 2y agoI wish you could use Genera. If you like emacs/slime. You would see how much we lost :(
- perihelions 2y agoWhat Genera ideas are Emacs/SLIME missing out on that would improve them?
- anthk 2y agoA microcode tweaked down for Lisp. The whole OS being a Lisp image. Imagine running Common Lisp in bare metal. Like Mezzano OS does, but with your Intel malware ^U CPU firmware designed to run CL at even faster speeds.
- wk_end 2y agoApologies for donning my grumpy old man hat. I like CL as much as the average dev who's dabbled with it on weekends but can't find anyone to pay me to use it, but...this essay really adds so little to the conversation about it. There's not an awful lot explicitly wrong in it per se, but people have been writing these little puff pieces on their blogs about Lisp for (at least) twenty years now. This checks all the usual boxes: "it's so powerful and liberating", "working in an image on a living system is amazing once you try it you'll see", "critics are wrong you can write unmaintainable code in any language", etc. OP hasn't even really used Lisp in anger, yet: "my next project is being built with it". I'd be much more interested in seeing a postmortem after that - "Ten Years Building a Major Piece of Software in Lisp" - with some actual self-reflection, rather than just a regurgitation of the usual talking points.
- jwr 2y ago> OP hasn't even really used Lisp in anger, yet: "my next project is being built with it". I'd be much more interested in seeing a postmortem after that - "A Reflection of Ten Years Building a Major Piece of Software in Lisp" - with some actual self-reflection, rather than just a regurgitation of the usual talking points. I should probably write that post, though about "a Lisp", not strictly about Common Lisp. I've been using Clojure to make a living for the last 10 years or so, quite successfully and I can't see anything else that would fit my needs better. I came to Clojure from Common Lisp.
- ds9soft 2y agoBlog post author here: True. But there's no reason not to write when you are in anger about other languages that you do use every single day. I guess I was just venting and also reaffirming my intention to use CL. I have used it before in a previous job for a quick tool and I know it can be used for more complex stuff, which I have already started building. I haven't been writing a major piece of software in Lisp for 10 years, so I can't write about that. But I can compare how it feels to write software in other languages vs Common Lisp. And also, Lisp is a blip compared to Rust or Go right now, so I don't know why it's so terrible to talk about it. People will keep talking about the things they like as much as the things they don't like. And it's fine.
- RandomCitizen12 2y ago> How long before Copilot is able to write all the code any Go developer now writes by hand? A long time ago I read someone saying "Lisp is the only language where I spend more time thinking than typing". Recently, when I was telling ChatGPT what logic I wanted written on what data structures, I realized the same was true about having an LLM write any other language.
- exe34 2y agothey clearly haven't tried Haskell!
- oersted 2y agoHonestly, to me that sounds like a red flag. There are already too many temptations to get on a purist mood and spend ages thinking about elegant code structure. I know, it's ambiguous, "more time thinking than typing" might imply that you spend more time thinking about the core problem you are solving. But let's be real, it's Lisp, you are thinking about how to model your problem elegantly in Lisp, not about how to solve it. This is incidental complexity, you might feel mightily smart and productive, but you are really not getting anything substantial done. Clean code is critical, but in moderation, you need to constantly prevent it from upstaging the actual problem you are working on.
- lispm 2y agoPart of the Common Lisp experience is tool building at the language level. You could be digging a hole with your hands. But thinking a moment, somebody came up with the idea of a shovel. That made a huge difference. Similar, tool building & usage at the language level can also make a huge difference. In larger applications this makes code much more compact and makes a person more productive.
- dunefox 2y ago> But let's be real, it's Lisp, you are thinking about how to model your problem elegantly in Lisp, not about how to solve it. But let's be real, it's Java, you are thinking about how to model your problem as a class structure in Java, not about how to solve it.
- allknowingfrog 2y agoA PG article about "doing what you love" was recently shared and discussed on HN [1], and I think a lot of the same logic applies. The nature of a job is that someone is paying you to do what they want you to do. If we're talking about what makes you happy in your free time, then sure, learn any obscure language that appeals to you. If you find something cool that you can do in CL and nowhere else, that's an amazing opportunity. If you just happen to think that life is too short to use a practical, established language, then I don't want career advice from you. [1] https://news.ycombinator.com/item?id=41687176 https://news.ycombinator.com/item?id=41687176
- ds9soft 2y agoI didn't give any career advice at all. Why did you think this was it? My career advice would be to keep developing in whatever established and practical language you are using and get paid to use if that's what you want.
- allknowingfrog 2y agoAh, then I accept your advice. I happen to like programming, but I also view it as a practical skill and a means to an end. That's the lens through which I was viewing your post. If your central point was that you personally enjoy Lisp, then I don't have an opinion one way or the other.
- ds9soft 2y agoI also view it a as practical skill. I'm paid to write in a practical language which is mutating into a monster I no longer consider fun to write in. But as I started a new project which eventually could be a business, then I can use whatever language I want, as long as it's practical for my use case. Why would I use any other language than one that I already know and like? It would make no sense. If you were to start your project, you would probably pick a language you enjoy using, rather than the one you are paid to use, unless it happens to be the same.
- ivanlinux 2y agoThis is exactly why I exclusively write Perl, C, and Lisp, simply they are fun to write, and provide me with the capabilities to feel powerful as a developer. Most software written these days lands in languages that make me feel like a drone, endlessly fighting a system in place or a pattern for some arbitrary theoretical gain that is never realized in the real world anyways, OOP, Type-Systems, FP, whatever, why would I willingly commit myself to someone else's idea of what code should look like? On side note, they say that 80% of developers are unhappy, do we think that languages have a big part in this? https://survey.stackoverflow.co/2024/ https://survey.stackoverflow.co/2024/
- AnimalMuppet 2y ago> On side note, they say that 80% of developers are unhappy, do we think that languages have a big part in this? Between languages, managers, and processes as sources of unhappiness, I personally would expect languages to come in third.
- ivanlinux 2y agoI think that these practices are almost always tied to languages though. For instance I've never worked at a Java shop that wasn't an overly corporate, manager oriented, scrum/agile mess. Whereas all of the Perl shops have been the extreme opposite. Could be just my experiences, but I see a correlation personally.
- anthk 2y agoIn my case: - Perl: prototype to C, short things to not spawn awk/sed/sh, or silly things from CPAN - C: Sadly, C is to computers what English is to science/tech/world: maybe not the fanciest or easiest language, but it's everywhere on low level business and everyone being educated has at least basic competences. - CL: Crazy things you wont see IRL until 20 years have passed from now.
- tmtvl 2y agoC, Perl, and Lisp? Amazing, it's like I'm looking into a mirror: those are the 3 languages I appreciate the most. The first time I tried coding something pseudo-practical in C (a simple program which counted the instances of every alphanumeric character in a text file) it ran so fast I had to do a double-take. Perl was the first language I decided to learn for fun and coming off Java it was nice not needing pages and pages of boilerplate to do simple stuff. Common Lisp is very close to being my ideal language. It would be neat if I could do something like... (defstruct (Kons (:generic A D)) (kar :type A) (kdr :type D)) (deftype Lyst (&optional e) `(or Null (Kons ,(or e t) (Lyst ,e)))) (deftype Character-Lyst () '(Lyst Character))
- rbanffy 2y agoIt really echoes my first memories of personal computers. You powered it on, and it landed you in a BASIC environment. Apple IIs, C64’s and Ataris all had a full-screen editor environment where you could type code, run it, pause it, inspect variables, and continue running. It wasn’t LISP, sadly, but it was great as an introduction and moving to “more professional” environments and tools took away a great deal of freedom away from us.
- f1shy 2y agoI’m slowly working in something like portacle+multimedia: so you can turn on the computer, emacs starts, an you go doing a little game… I think deep inside the 8-bit retro people miss that, not the slow-low-resolution computers, but the experience of actually “making” something.
- rbanffy 2y agoOnly those who knew something can miss it.
- g-b-r 2y agoWorrying that Swift is getting worse, now that it's been adopted by Ladybird
- ferd 2y agoSimilar experience here... python/typescript during the day, Clojure at night ;-) Shameless plug: just yesterday I published a step-by-step code walkthrough hoping to convey my "Clojure way" of modeling: https://neuroning.com/boardgames-exercise/ https://neuroning.com/boardgames-exercise/
- regularfry 2y agoAm I the only one who just bounces off the ecosystem? I don't mean emacs/slime/sbcl, it's once you get beyond that. In my most recent foray I wanted to give roswell, qlot, and quicklisp a proper try, because I really want to find the Right Way to consume dependencies with proper version management. It's what I'm used to in just about every other context. But the version of qlot you get through roswell is old, nothing in that stack is doing versioned dependency resolution, and despite claims of stability, SBCL and ASDF seem to have had incompatibilities recently that'll trip you up if you happen to install the wrong thing, so you don't get Clojure's "code from a decade ago just works" effect. What have I missed? It feels like I'm holding it wrong.
- martinflack 2y agoI play around with quicklisp to develop and tinker. To test and deploy, I generally use Guix [0] to express a package for my application which pins dependencies to exact versions and optionally can run in a container. I have Guix installed on top of Ubuntu. This is hobbyist and experimental work so it's not battle-tested. [0] https://guix.gnu.org/ https://guix.gnu.org/
- downut 2y agoIn this comment, I am a common-lisp noob, no competency at all. I have used and written a lot of sw in a lot of languages over 40 years though. Keeping in mind the concepts of per-user and per-project installations, I have done the following experiments: 1) Quicklisp only. Not beating on Zach but we're getting close to a year w/o updates, so something like cl-transducers needs to be installed from upstream. Upshot is, other than the lack of updates, adding packages works perfectly. But I am curious how to delete a package. Installation is per-user, although stuffing packages into the asdf visible directories give some customization ability. (I think?) 2) The whole shebang: ros + ros-quicklisp + qlot. I spent a few weeks with this combo, digging around the code and installation structure, and... I have no idea how to manage this thing down the road. Seems to work, but there's a lot of assumptions about per-project vs per-user package installation. AFAICT, ros packaging means per-project quicklisp, which is fine, but no versioning. So then add qlot. Now we have versioning, which is great, but how do ros installed quicklisp packages interact with qlot? Especially since qlot add is a thing. 3) In order to simplify the system (ahem) I decided to follow the hints in the qlot installation section and simply install qlot with no quicklisp or ros on a clean system (ahem). I also reinstalled sly from clean and found out that I had to install sly-quicklisp in order for it to work. That was yesterday and I'm still scratching my head about what kind of a beast I am working with. What part is quicklisp and what part is qlot? I am also working a lot closer to asdf, experimenting at each step. Learning a lot, but, I'm not really getting a lot of happiness out of wading through at the source code level all these overlapping packaging systems (ahem). If I persevere I suspect I'll know a lot about the current state-of-the-art of lisp library packaging. I am right now contemplating clearing the deck once again and doing the 2) ros + ros-quicklisp + qlot again, because it seem to work fairly smoothly and provides the opportunity for per-project versioning. I'll have to defer the understanding part into the future, though.
- dannyobrien 2y agoI'm a big fan of lisps, and haven't played sufficiently with rust to have an opinion -- but I will note that the benefits of a sophisticated type system is qualitatively different from, say, the statically-typed environment of C or Objective-C. The comparison I make when thinking about CL is something like Haskell or Elm, which /do/ have that feel of "if it compiles, it works". Without that, I do have the feeling of working without a safety-net that pushes against that sense of freedom that dynamically-typed languages like CL otherwise offer. (Obligatory mention here of Coalton, which is an experiment in creating that sense of security within a CL paradigm: https://github.com/coalton-lang/coalton https://github.com/coalton-lang/coalton )
- ds9soft 2y agoThe sense of security is provided by a good test suite (which you still need) plus SBCL type annotations.
- dannyobrien 2y agoI've never managed to achieve that (the comparable sense of security), which may be on me. Out of interest, have you worked in one of these typed languages -- Haskell, Elm, maybe OCaml (haven't tried it), Idris, Rust? I think they feel very different in this axis compared to C/C++/Objective-C/Java. Not necessarily better (I am still reminded of the term "bondage-and-discipline language" from the Jargon File[1]), but different. [1]: http://www.catb.org/jargon/html/B/bondage-and-discipline-language.html http://www.catb.org/jargon/html/B/bondage-and-discipline-lan...
- 78tu 2y agoJheng
- 78tu 2y agoYkymg