A Road to Lisp: Which Lisp

(scotto.me)

63 points | by silcoon 2 hours ago

13 comments

  • nobleach 37 minutes ago
    Since a few folks here recommended Common Lisp to me as the language that would "tick all my boxes", I've been doing a deep dive. Right now, I'm working through SICP again with DrRacket. The first time I worked through it with MIT Scheme MANY years ago. It's shocking how much I've forgotten.

    What I like about this article is that it walks through the different "camps" of Lisp. Scheme is so intriguing to me because of how small it can actually be. I can build nearly any paradigm I want to exist. The problem is, if I were to actually go find a job where they were using a Lisp, (I hear those actually exist) they wouldn't want to use my "Result monad + match statement - railway pattern" that I've used from OCaml and Rust. So learning something that is truly "common" can make more sense.

    As far as learning though, Scheme feels "just right". I've imposed a "no AI until I've found a working solution" rule that keeps my mind engaged. Couple that with a willingness to say, "I don't know that right now... I'll think about it throughout the day and maybe by this evening I'll have an answer".

    • AyanamiKaine 5 minutes ago
      I can also recommend clojure. For me it has the best parts of common lisp and the best of the java ecosystem. But its also quite different from common lisp and scheme. Different enough to find some unique ideas.

      Writing scripts using [0] Babashka is also really nice.

      [0] https://babashka.org/

  • pratikdeoghare 9 minutes ago
    Shut up and learn Common Lisp using Practical Common Lisp.

    This would be my advice. Why? My own road was haphazard. Other books broaden your mind and teach you really cool tricks. This book gets you using lisp like you would say golang. But it still teaches you the lisp things and broadens your mind. Time spent choosing will be better spent reading this book. After that PAIP, On Lisp, SICP etc.

  • groundzeros2015 56 minutes ago
    For me the complete spec is the killer feature. You can learn Common Lisp in 1990 and write it the same now. As long as we can keep the compilers alive it will be forever.

    It’s funny to me that it was critiqued for being “bloated” when now it looks like a focused minimal library.

    • dismalaf 5 minutes ago
      Common Lisp wasn't standardised until 1994.

      Also, SBCL has some nice features specific to them, I'm sure it's the same for other implementations. So while there's a lot that's common between them all I find myself using a lot of platform specific functions.

      • Jtsummers 3 minutes ago
        Yes, but it existed before then (from 1984 on), and a large amount of code written for CL pre-standardization still runs without alteration or with minimal updates.
  • varjag 7 minutes ago
    I use Common Lisp daily. But pondering programming language choices is nearly pointless now that the models have eaten the trade of programming.
  • dieggsy 1 hour ago
    CL also has pretty much arbitrarily extensible syntax:

    - https://sr.ht/~dieggsy/whisper/

    - https://dieggsy.com/json-literals.html

    And could also be used to build languages, supporting more modern programming paradigms (though yes, I believe Racket does make this easier):

    - https://coalton-lang.github.io/

    I also might have written the Common Lisp example using reduce as well, which is in the standard library, but that's preference. Nice to have the option though:

      (defun calculate (instructions)
        (reduce
         (lambda (result op-value)
           (destructuring-bind (operation value) op-value
             (case operation
               (:add (+ result value))
               (:subtract (- result value))
               (:multiply (* result value)))))
         instructions
         :initial-value 0))
    
      (calculate '((:add 5) (:multiply 3) (:subtract 4))) ;; => 11
    • BoingBoomTschak 53 minutes ago
      I'd have used

        (funcall (ecase operation (:add '+) (:subtract '-) (:multiply '*)) result value)
      
      instead, looks funkier =)
      • dieggsy 51 minutes ago
        Oh yeah, way more fun :) I just kinda saw CL in the Clojure and was trying to make it look like that.
  • 0xb0565e486 1 hour ago
    I really wanted to Lisp as a main programming language, and sometimes I still do.

    I just find readability such a hurdle regardless of how long I used it. I didn't find that it ever became as natural as the other group of programming languages.

    I find a procedural style of programming so much easier to reason about, both when writing and reading.

    Either way, I'm really happy I took some time to learn it and use it a little at some point.

    • Jtsummers 6 minutes ago
      Common Lisp code can be very procedural if that's what you want to do. The entire loop macro is basically importing Algol-styled procedural loops into Lisp.
    • dieggsy 1 hour ago
      For me, the most effective way to read Lisp is to essentially forget the parentheses (I shadow them out in matching, low contrast colors) and go almost entirely by indentation. I find this makes it more similar to reading other languages, though granted not exactly the same.

      You do have to keep up with the parentheses of course, but editor settings or extensions can make this automatic if not invisible.

    • whartung 16 minutes ago
      > I find a procedural style of programming so much easier to reason about, both when writing and reading.

      Then do that.

      There's nothing stopping you from using pretty much any style of programming that you like. Or mix and match. Or evolve over time.

      Loops, lists, arrays, structures. Simple iteration: dotimes, dolist, loop. If those are your bread and butter, then feast! CL will happily do that. That's what I do. I just don't think "functionally" when I do CL code, I'm just not there yet, so its unnatural for me, and not what comes spewing out of my fingers when I write code.

      And it's "OK".

      You don't have to use the other features of the language, but they're there if you want to dip your toe into it.

      With CL, also, I tend to be really wordy on variable and function names. I'm really fond of kabob-case-for-identifers.

    • groundzeros2015 59 minutes ago
      (Heresy alert. Inb4 homoinconcity)

      I do find that most of my lisp skills carry over to JavaScript quite well while allowing me to write imperative functions more fluently.

      Prog blocks are pretty good. I wonder if another DSL could be better.

      • hnarayanan 50 minutes ago
        Maybe because Brendan Eich was tasked with "doing Scheme in the browser" before it pivoted to JavaScript.
        • lvncelot 8 minutes ago
          Imagine what could have been...
  • davidw 3 minutes ago
    When people have a lot of choices, that can create problems, because it's often the people with the least information trying to make that choice.

    For instance "I'm new to Lisp, I want to try one..." is a person without a lot of background and information to make that choice. And they probably realize it and it makes them nervous about making that choice.

    See: https://en.wikipedia.org/wiki/The_Paradox_of_Choice

  • hnarayanan 1 hour ago
    So many words to say: Scheme.

    :)

    • nobleach 36 minutes ago
      Perhaps, but Chicken? Guile? Chez? They're all pretty cool.
    • tmtvl 21 minutes ago
      R5RS, R6RS, or R7RS?
  • criddell 1 hour ago
    Another Lisp of note is AutoLISP.

    Elisp::Emacs as AutoLISP::AutoCAD. AutoLISP was my first introduction to Lisp-style language. When I first started using it (1987) for macros in AutoCAD, I really had no idea what Lisp was. It was just a fun and easy way to automate AutoCAD.

    • hnarayanan 1 hour ago
      I had forgotten about this. The last I saw this was 20+ years ago!
  • ynniv 37 minutes ago
    I have a work-in-progress called Modus. 100% written by Claude, so take that however you will. The current release boots on a Raspberry Pi Zero 2 W. The next release (unreleased in the pipe for ~ months) is standard Common Lisp on bare aarch64 (pi) and x64 (qemu for now), with linux aarch64 and x64 command line interfaces à la sbcl.

    https://github.com/modus-lisp/modus

    Since you can't use an OS by itself, I've rounded out the Common Lisp environment with portable ssh client and server, web browser, and a bitcoin node. Framebuffer with VNC in the pipe

    • whartung 7 minutes ago
      That's pretty neat!

      God help me if I fell down a hole like that.

      I must say, however, that e.g. code like (compile-compound) is something only an AI can love!

    • z0ltan 36 minutes ago
      [dead]
  • wollowollo 37 minutes ago
    I wonder if Hylang is still alive.
  • BoingBoomTschak 58 minutes ago
    (Disclaimer: CL weenie) A decent and balanced writeup IMO. But it should really have contained the following:

    Warning about the issues that come with ANSI CL's frozen spec (threads/sockets/unicode/extensible sequences/gray streams/etc... as extensions with a varying amount of support with compatibility layers often available to write portable-ish code, "bolted-on" CLOS never fully integrated) and its various rust spots, not just the good points.

    Mention that CL has provisions for gradual typing (with limits) which are exploited by SBCL.

    Scheme, obviously, along with the same warning as CL about pain of writing portable code that interacts with the OS (does it have compatibility layers like CL?) amplified by the R6RS vs unfinished R7RS-large mess.

    A few words about the build system/third-party packaging situation and alternative implementations.

  • ChrisArchitect 43 minutes ago
    Related:

    A road to Lisp: Why Lisp

    https://news.ycombinator.com/item?id=48845209