How to get started with Lisp?

Hi, I’ve been working in Elixir for some time now and I’d like to expand my horizons by getting familiar with Lisp.

There seem to be waaay too many dialects to the point where it’s hard to pick where to start, especially given limited time resources. In the end, I guess I’m more interested in ideas than particular implementation. On the other hand, I’d prefer a nicer development experience (tooling, stuff works out-of-the-box, etc.).

Which dialect of Lisp would you suggest?

2 Likes

I’d say Racket, it comes with a fully integrated and powerful IDE as well, plus an excellent and large set of tutorials and a large ecosystem. :slight_smile:

6 Likes

I’d have to agree with this. You’ll have some lisp purists saying it’s not a lisp (which is true) but I learned a lot using it together with the Structure and Interpretation of Computer Programs book.

3 Likes

True, it is more of a scheme (which is a very lightweight lisp, with default hygenic macro’s instead of unhygenic like with lisp), but it still has every concept you’d ever want, and it’s easily one of the largest out too with libraries for about anything. :slight_smile:

If you want Pure Lisp, you’d go with CommonLisp, but it can be quite a pain to get working on some systems (especially windows systems), and the best IDE for it is Emacs, if that tells you anything. ^.^

Scheme have some classic books.

Such as the wizard book and the little schemer.

Clojure seems more marketable and more successful iirc.

1 Like

If you decide to kick the tires on Clojure then I highly recommend:

I find it to be the most approachable out of the ~8 Clojure books I’ve read, although Living Clojure by Carin Meier is a good intro, too.

On the other hand, Clojure is not without its warts:

Given you’ve experience on the BEAM with Elixir I think it would be appropriate to also mention Lisp Flavoured Erlang by @rvirding

3 Likes

IMO Racket or Clojure, everything else seems way too niche and arcane. Sure I’m not a LISP dev but I found these two accessible while 5 others I had trouble with to even get to a working REPL.

I think you should consider learning Emacs and Emacs Lisp. Its a complete lisp, you can use it to write external programs if you want but its incredibly powerful when your entire editor is hosted in a single language that you can evaluate in any buffer, and you can easily read, debug, understand all the plugins you rely on. Many of the libraries/tools in it that I use I’ve never found suitable replacements for anywhere else, and certainly not in such an integrated, coherent way. Also because its a lisp it tend to has the best tooling for developing any lisp language with. Certainly Common Lisp but also Clojure and Racket have great layers in Emacs, but you kind of have to experience it to understand. I use its lisp-state features like slurp/barf (nesting/un-nesting parenthesis) all the time even in Elixir. Programming a lisp without those features would be really frustrating I think.

5 Likes

One problem is that Emacs lisp is it’s own version of lisp and not really like any other lisp. I would personally go with either Common Lisp or Scheme. Or LFE of course. :wink:

3 Likes

LFE is sort of based on Common Lisp so it does have a CL feel. However, it is tuned to Erlang/OTP/BEAM in what features it has and how interacts with other BEAM languages. In this respect it is definitely an Erlang Ecosystem language.

4 Likes

Just adding a +1 on recommendations already given by others:

  • Structure and Interpretation of Computer Programs (a.k.a. SICP) is an awesome classic book. It can be found online for free, as it is public domain by now.

  • Clojure is in my opinion a great modern and practical lisp, and there are very good books about it (Joy of Clojure is one example).

Elixir meta programming is actually very similar to Lisp macros, so you might find it familiar.

Thank you for all the recommendations! Would you be so kind to try to explain what’s the difference between Lisp, Common Lisp, Scheme, Racket and Emacs Lisp? Thanks to @rvirding I kind of understand how LFE and Clojure were tweaked to fit into BEAM and JVM respectively. Is it about some arcane features or something really fundamental? (When I try to Google those differences, people tend to use terms that are unfamiliar, not even mentioning the consequences of the design choices).

1 Like

FYI:

http://wiki.c2.com/?LispSchemeDifferences

http://www.paulgraham.com/lispfaq1.html

Racket has a manifesto and was formerly known as PLT Scheme.

Racket was used to defined the teaching languages for How to Design Programs (HtDP).

Teach Yourself Racket

2 Likes

My personal opinion is that, when learning your first Lisp, there is no need to worry too much about different Lisp families. You will anyway get to learn a great deal from any of them. I would pick the one that offers the best learning resources, or stimulates your curiosity and motivates you the most. You will then be able to easily pick other dialects and understand the differences better once you are confident enough with one of them.

Broadly speaking, most topics that are specifically interesting in Lisp programming are basically similar in all variants. Most are related to the homoiconic nature of Lisp: code is written using the very same data structures provided by the language. This has powerful implications on metaprogramming, because generating code is equivalent to generating data structures.

As a bonus, when coming back to Elixir, you will find a lot of similarities :slight_smile: In some aspects, Elixir feels like a Lisp in disguise (and I mean it 100% as a good thing).

1 Like

Racket is fun to learn and play around with, but I’d recommend Clojure(script) as a more suitable for real-life tasks (I see clojurescript as a very good substitution to JS on a frontend). It’s much easier to learn something when you can apply knowledge to some real problems.

We’re not talking about learning C# after having done some Python here.

I’d flip it around and speculate that starting with Racket would increase the chances of success simply because you don’t have to fight the vagaries and idiosyncratic behaviour of the host environment and interfacing with non-idiomatic APIs at the same time while you are trying to get accustomed to the “strange syntax”.

Racket is probably a better place to get more comfortable with this strange new world. Learn the syntax, spend some time on exercism.io, play with some of the libraries like Graph Plotting or Web Server.

I personally had no problem with Clojure but I was already very familiar with the Java eco-system - taking on both at the same time is likely going to make things that much harder.

With Racket you can focus on changing your thinking about programming while not getting dragged down by those nagging, disruptive unrelated technical details.

Seeing Elixir doesn’t have lisp’s homoiconicity and extremely simple and consistent syntax I would it doesn’t feel like lisp at all. Having macros isn’t really enough. Whether you feel this is a good thing or not depends on your background. Being an old lisper, the reason why I did LFE, I thing one thing we did wrong with Erlang was not having a lisp syntax, :wink: though the Erlang syntax is simple and consistent.

4 Likes

Sure, Elixir is not a Lisp. What I mean is that, if you are familiar with Lisp, you can recognize many of the underlying concepts in Elixir too, in one form or another.

My personal view is that there are more similarities than differences, with the macro system being particularly close, even without homoiconicity. But mine is a totally subjective judgement, based on the languages I am familiar with, and the trajectory I followed learning them. Someone more experienced than me with several Lisp implementations might legitimately notice the differences more than the similarities.

Admittedly, I have not deep dived into LFE yet, but the possibility to get both a Lisp syntax and the Erlang VM sounds terrific. So let me take this opportunity to thank you for your programming language creations. Also it is interesting to read your perspective on the Erlang syntax. I would be curious to know what made you originally lean toward a non-Lisp syntax for Erlang.

You really should, at least to play around with, it’s awesome!

2 Likes