News for hackers. Stuff that matters.

Ask HN: Which Lisp should I learn?

I'm a hands-on kind of person, so I need to install something on my computer and play with alongside reading..

My one requirement is that it must be available in ubuntus repositories.

Where should I start?

( 21 comments | 12 points | on HN )
Re:Ask HN: Which Lisp should I learn? by db48x on Saturday October 31, 2020 @07:20PM (#24956049)
Scheme is the best pedagogical language, primarily because it is simplified specifically so that it is easier to teach, while still retaining all of the power of Lisp. It also has the absolute best computer science textbook, The Structure and Interpretation of Computer Programs.

Common Lisp is the most practical Lisp, because it's actually designed for building large systems and for supporting all possible programming paradigms (procedural, functional, object-oriented, logical, etc). There are also a lot of great books written about it. On the other hand, it's a much larger language with many more parts, so learning it is not as easy. You can still get started with simple programs pretty quickly, and gradually learn the large standard library and the more complex features over time.

If you're at all interested in physics and you've read SICP, then you should also read The Structure and Interpretation of Classical Mechanics. This is a very advanced book, but it uses some really clever language extensions present in MIT Scheme to do both numeric and symbolic calculus in order to both teach and implement physics. MIT Scheme is worth checking out if you're interested in advanced programming language design, even if you're not particularly interested in physics.

Re:Ask HN: Which Lisp should I learn? by Wezl on Saturday October 31, 2020 @07:17PM (#24956022)
Common Lisp[1] is pretty easy to set up, you can use portacle[2]. It's also one of the oldest and most popular. If portacle isn't in the repos, sbcl[3] is.

EDIT: For reading you can try Practical Common Lisp[4] or the Land of Lisp[5] if you want a dead tree. These I've read but there are more[6].

[1]: https://common-lisp.net/downloads

[2]: https://portacle.github.io/

[3]: http://www.sbcl.org/ (EDIT: fixed link)

[4]: http://www.gigamonkeys.com/book/

[5]: http://landoflisp.com/

[6]: https://www.cliki.net/Lisp%20books

Re:Ask HN: Which Lisp should I learn? by brudgers on Monday November 02, 2020 @03:22PM (#24972757)
What are you going to be reading alongside it?

Common Lisp goes well with Peter Norvig's Paradigms of Artificial Intelligence: case studies in Common Lisp. And Norvig's book is a good way to learn what makes Common Lisp a big deal from an engineering perspective while still being entirely accessible to a below average programmer with some experience (at least that's my experience).

Racket goes well with the many Racket tutorials online and Felleisen's How to Design Programs. HtDP is a good beginner resource for software engineering and the many online Racket tutorials are suitable for many other levels of experience.

Racket will work with Structure and Interpretation of Computer Programs with a bit of configuration. But MIT Scheme is simpler to use with SICP right out of the box.

There are reasons Clojure is popular and I think it's a great language, but learning Clojure is more about learning Clojure than about learning what people usually mean by "Lisp."

Emacs Lisp (elisp) is great if what you are going to be reading is it's documentation and it maps up reasonably well with a lot of Common Lisp. It's a very good language that becomes a great language if you like Lisp and EMACS because it hooks into "Emacs as an operating system" natively. It's a practical approximation of the mythical LispMachines at your finger tips.

Re:Ask HN: Which Lisp should I learn? by haakonhr on Sunday November 01, 2020 @02:45AM (#24957852)
Racket is also worth a look if you're curious about programming language design as it is very easy to make small DSLs. It is also a great language and eco-system if you're looking for a playground to explore different programming concepts. The community is also very helpful.
Re:Ask HN: Which Lisp should I learn? by gus_massa on Sunday November 01, 2020 @06:50AM (#24958844)
I like Racket, but

>> My one requirement is that it must be available in ubuntus repositories.

You can install Racket directly from the download page or you must add the PPA https://launchpad.net/~plt/+archive/ubuntu/racket

Re:Ask HN: Which Lisp should I learn? by brudgers on Sunday November 01, 2020 @05:29PM (#24963104)
Ubuntu includes a Racket package. It’s rarely if ever the latest, but certainly a reasonable starting point.

https://packages.ubuntu.com/search?keywords=racket

Re:Ask HN: Which Lisp should I learn? by st3fan on Saturday October 31, 2020 @07:21PM (#24956055)
Clojure is pretty popular. Big community. Lots of code. Definitely more momentum than Common Lisp. If that is what you are looking for.
Re:Ask HN: Which Lisp should I learn? by kazinator on Sunday November 01, 2020 @12:17AM (#24957184)
Try TXR Lisp.

Though not available in a Ubuntu repository, there are binaries for Ubuntu 18 (32 or 64 bit) in tarball format: you can unpack these relative to / to get it into /usr/local. Or anwyhere in your tree: TXR is self-contained and relocatable: it will run from wherever you unpack it, finding its own files relative to the executable location.

It's easy to build from sources: just clone the repo; ./configure; make; make install. In the most recent release, I dropped the build-time dependencies on several tools, to make things even easier. The only special library you need is libffi (so at build time you need the libffi-devel package on Ubuntu). It will configure and build without it, but then you can't use FFI.

Git: http://www.kylheku.com/cgit/txr/

The documentation is all in one big man page, which is very convenient in the GNU/Linux and Unix environment. There is a hyperlinked HTML form:

https://www.nongnu.org/txr/txr-manpage.html

Re:Ask HN: Which Lisp should I learn? by timonoko on Sunday November 01, 2020 @03:49AM (#24958120)
Emacs and elisp is the only sensible choice, because gained knowledge will not be wasted.

Lisp is not fun general purpose programming language and tiny examples teach you nothing. Only when you are confronted with huge datasets and enormous problems you might appreciate freedom of expression in Clojure vs Javascript.

Re:Ask HN: Which Lisp should I learn? by Jtsummers on Sunday November 01, 2020 @04:24AM (#24958275)
While I agree that elisp is a very practical choice, the three main other lisps out there today are general purpose languages. Common Lisp, Clojure, and Scheme are all general purpose languages.
Re:Ask HN: Which Lisp should I learn? by timonoko on Sunday November 01, 2020 @04:42AM (#24958350)
Yes yes but they are not "fun". Like Python is.

Clojure is especially messy piece of spaghetti code, if you are not already familiar with the underlying engine.

Commonlisp is just ugly with very annoying error processing (how do I get out of here (I made recursive error (while trying to exit from error (what (is (this (shit))))))))).

Scheme is for academics, full of weird stuff, like (local ..), which I am not gonna learn ever.

Re:Ask HN: Which Lisp should I learn? by Jtsummers on Sunday November 01, 2020 @01:33PM (#24961418)
"Fun" is way too subjective to use as a differentiator here. There are some languages most people would consider "not fun", at least outside the puzzle sense like "Can I make a Ruby on Rails clone in Cobol?" And there are some languages that most people would consider more "fun" for some specific thing, like Processing is "fun" for the ease of getting graphical and interactive results. I'd say that Racket is at least as fun as Python given the readily available graphical and network libraries. Common Lisp, for me, is as fun as Python but requires a bit more work. And I can't comment on Clojure's "funness" because I haven't used it extensively, but with its Java interop it has access to a lot of things that should put it on par with Python. Here I'm equating "fun" with relative ease of entry + ease of accomplishing more complex tasks (like GUI building, or making a basic interactive web app) + relative simplicity/consistency of the language. What's your definition of "fun"?

I find it puzzling that you describe Clojure as spaghetti code because I have literally no idea what you mean with that statement. Spaghetti code, in programming, has a rather specific meaning that I cannot conceive of applying to Clojure. Namely: spaghetti code = unstructured code that abuses goto/jumps or their equivalents. So that sentence makes zero sense as presently written.

Re:Ask HN: Which Lisp should I learn? by timonoko on Sunday November 01, 2020 @02:54PM (#24961995)
Programming system is "fun" when you do not have to read stupid manuals ever and error reporting system tells you what you should do. I do not remember ever reading anything about python.

Clojure is the most unfun lisp indeed, unless you know java.

    Clojure 1.9.0                                                               
    user=> (+ 'a 1)                                                             
    ClassCastException class clojure.lang.Symbol cannot be cast to              
    class java.lang.Number (clojure.lang.Symbol is in unnamed module            
    of loader 'app'; java.lang.Number is in module java.base of                 
    loader 'bootstrap')  clojure.lang.Numbers.add (Numbers.java:128)
Re:Ask HN: Which Lisp should I learn? by Jtsummers on Sunday November 01, 2020 @02:58PM (#24962029)
I am impressed that you were born with the knowledge of Python embedded in your brain.
Re:Ask HN: Which Lisp should I learn? by mod on Sunday November 01, 2020 @03:54PM (#24962432)
Since you've taken the worst possible interpretation of his comment: He's saying that clojure errors are not user-friendly and give you little idea how to implement a fix.

I agree with him, and I have spent a lot of time scratching my head debugging clojure.

Python gives a better idea of what's wrong, where it's wrong, and what a fix might be.

Here's roughly his example, but in python:

    >>> "a" + 2

    Traceback (most recent call last):

       File "<stdin>", line 1, in <module>

    TypeError: cannot concatenate 'str' and 'int' objects
Re:Ask HN: Which Lisp should I learn? by lispm on Monday November 02, 2020 @05:31AM (#24966515)
in the Lisp I'm using I get this:

    CL-USER 24 > (+ "a" 1)

    Error: In + of ("a" 1) arguments should be of type NUMBER.
      1 (continue) Return a value to use.
      2 Supply a new first argument.
      3 (abort) Return to top loop level 0.

    Type :b for backtrace or :c <option number> to proceed.
    Type :bug-form "<subject>" for a bug report template or :? for other options.

    CL-USER 25 : 1 > 
There is a clear error message and direct ways to fix/report the problem. Including another REPL to investigate the error.
Re:Ask HN: Which Lisp should I learn? by timonoko on Monday November 02, 2020 @06:51AM (#24967058)
CL Loop-macro error reporting is legendary:

    [1]> (loop until sun dies and moon explodes)
    *** - LOOP: illegal syntax near DIES in
        (LOOP UNTIL SUN DIES AND MOON EXPLODES)
    The following restarts are available:
    ABORT          :R1      Abort main loop
Re:Ask HN: Which Lisp should I learn? by lispm on Monday November 02, 2020 @11:56AM (#24970207)
Python is most advanced:

    >>> [if dark then moon else sun]
      File "<stdin>", line 1
        [if dark then moon else sun]
          ^
     SyntaxError: invalid syntax
Re:Ask HN: Which Lisp should I learn? by philly_flowers on Tuesday November 03, 2020 @12:05PM (#24981494)
Try out Gerbil. It's a very practical scheme, built on top of Gambit, for systems programming. It also supports the actor model out of the box. It's also very fast, with lots of batteries included.

https://cons.io

Re:Ask HN: Which Lisp should I learn? by lumberjack on Monday November 02, 2020 @04:14AM (#24966070)
Last I touched Lisp I had settled on Chicken Scheme after trying them all. Don't quite remember why.
Re:Ask HN: Which Lisp should I learn? by Jtsummers on Monday November 02, 2020 @11:06AM (#24969577)
When I was specifically learning and using Scheme I also settled on Chicken Scheme. For the following reasons:

1. It was very fast. Code written in it was comparable to the C code I was writing at the same time.

2. Very good C interop. Writing code to make use of C libraries was a near painless experience.

3. Very good collection of eggs (packages, think Rust's crates). I rarely needed to make use of (2).