Ask HN: Which Lisp should I learn?
My one requirement is that it must be available in ubuntus repositories.
Where should I start?
My one requirement is that it must be available in ubuntus repositories.
Where should I start?
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.
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)
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.
>> 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
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:
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.
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.
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.
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)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 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. [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 >>> [if dark then moon else sun]
File "<stdin>", line 1
[if dark then moon else sun]
^
SyntaxError: invalid syntax1. 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).