
Getting Started with Lisp in 2019 - wheresvic3
https://smalldata.tech/blog/2019/08/16/getting-started-with-lisp-in-2019
======
reikonomusha
This is the document [0] we maintain for new Lisp hackers at Rigetti, where we
use Common Lisp to build open source quantum software development tools.
Following that, here’s the rundown of some basic Lisp nomenclature and how to
edit in Emacs [1].

The article isn’t _bad_ , but it also doesn’t provide you with a sustainable
way to develop Lisp; interactive and incremental development together form a
great proportion of value of using the language in the first place.

[0] [https://github.com/rigetti/qvm/blob/master/doc/lisp-
setup.md](https://github.com/rigetti/qvm/blob/master/doc/lisp-setup.md)

[1] [https://github.com/rigetti/qvm/blob/master/doc/editing-
and-r...](https://github.com/rigetti/qvm/blob/master/doc/editing-and-
running.md)

(PRs are welcome!)

~~~
adamnemecek
What are the advantages of lisp over julia?

~~~
dreamcompiler
One big one is that Lisp is probably much faster. Common Lisp is AOT compiled
to the metal so it starts up fast and runs fast. CL is often within a factor
of 2 of C speed and dramatically faster than plain Python. I haven't used
Julia but recent stories on HN suggest it's no speed demon.

~~~
ddragon
Julia should be faster than CL for long running numerical computation at least
(reaching C/Fortran speed for type-stable code) as it was designed for that
purpose (plus the good GPU support and use of libraries like BLAS). But there
is no AoT option yet so you'll have to deal with JIT, making it much slower
for any shorter running scripts because of all the compilation, which makes CL
speed much more consistent across tasks.

~~~
reikonomusha
“It was designed for that” doesn’t justify a claim. Common Lisp is a general
purpose language with excellent support for fast numerical code. In SBCL in
particular you can even write assembly if you want to do crazy AVX stuff.

~~~
ddragon
While it doesn't justify by itself, it means that this area will be constantly
profiled and optimized tricks will be implemented to handle it better, like
auto-simd, using multiple dispatch to detect optimal BLAS method for every
matrix operation, implementing broadcast/loop fusion. Even matlab which will
poorly handle almost anything is pretty competitive in numerical processing.

And saying CL is fast because you can write in assembly is like saying Python
is fast because you can write in C. And while you can't write in assembly in
Julia, you can go down all the way down to the LLVM (and intercept the
compiler right between detecting types and compiling so you can rewrite every
intrinsic with your new backend in a more flexible way than multiple dispatch)
like they did with XLA.jl for TPUs and CUDANative for GPUs.

~~~
ihnorton
> And while you can't write in assembly in Julia

Julia allows inline LLVM IR, so this is technically possible, if a little
awkward:

[https://julialang.org/blog/2017/03/piday#π-via-inline-
assemb...](https://julialang.org/blog/2017/03/piday#π-via-inline-assembly-
instructions)

------
eatonphil
I'm not a fan of Roswell or Portacle, personally, because I'm used to taking
control of my setup. I try to stick with well-maintained distribution systems
(e.g. Debian's .deb or the source itself if need be) otherwise upgrades tend
to be complex, not well documented, and supported by few people. Additionally,
as one new to Common Lisp, it is difficult to understand the abstraction layer
at which Roswell & Portacle operate with respect to abstraction layers
implicit to Common Lisp.

I better understood these layers by installing SBCL myself and playing with
Quicklisp (a package manager) and ASDF (a package definition library). I wrote
about this a year ago [0]. It was confusing at first. But it became clearer
after exploring and writing that post. Ultimately I don't find it very
different than writing a Python library with setuptools.

re: SLIME; I never ended up remembering the keyboard shortcuts as a CL
hobbyist so I turned it off after a few uses and stuck with vanilla Lisp-mode.
Parenthesis completion and auto-ident are the only two tools I expect of my
text editor (vs. in a GUI, buttons take the place of keyboard shortcuts you
must remember). I use Emacs at work and home but I hardly remember any
extension shortcuts (as much as I want to benefit from projectile and magit).
It even took me a few years before I felt comfortable using package-install
vs. just `git clone`-ing new modes and adding their paths to my .emacs.

For all these reasons, Portacle as a distribution isn't really my style.
Roswell didn't solve anything for me either once I got familiar with ASDF and
Quicklisp.

Complacency on tool UX doesn't help a community. Roswell & Portacle may be a
forward iteration on UX. But I also want to share the fundamentals (or at
least N-1 layer down) and get other hobbyists comfortable there too.

[0] [http://notes.eatonphil.com/starting-a-minimal-common-lisp-
pr...](http://notes.eatonphil.com/starting-a-minimal-common-lisp-project.html)

------
dtornabene
Adding my own disagreement about using either portacle or roswell. If you're
running literally any widely used Linux distro, or {Free|Open}bsd you are a
package install away from a working common lisp install. I've seen this come
up alot in irc and reddit, this push to get people to use a C library (!) to
get to common lisp, and its downright bizarre. If you're that bent on
packaging and C, use Guile or Gambit. And if you're just a random person
perusing this thread, just go download the simplest thing and get started, not
slime (which is awesome) not Lem (which is fine), just lisp and a text editor

~~~
snazz
Yes. A detail that I found quite amusing about Roswell was that it segfaults
on OpenBSD; the problem could have been altogether avoided by writing it in
Lisp. I had to dismiss Lem because it seemed to depend on Roswell and Roswell
was not going to cooperate.

The entire point of _Common_ Lisp is to make stuff work across
implementations. You shouldn’t need to test five implementations on your
development machine. The only time I can see something like Roswell (but not
in its current form) being useful is an automated CI tool, but even then it
isn’t really necessary.

~~~
dtornabene
So, due to someone taking the time on irc, I managed to get Lem installed on a
box at some point recently sans roswell. It doesn't actually depend directly
on it, though I think there are some things built on Lem that use roswell.

------
TurboHaskal
I would recommend to ignore Roswell and just install SBCL or CCL from your
package manager. For a quick Emacs setup with good defaults, use Spacemacs
with the common-lisp layer.

If you have never used Emacs I would just ask the LispWorks guys for an
evaluation license. It's the closest thing to experiencing one of those Lisp
environments of the 80s (Emacs doesn't come close). You'll be impressed.

~~~
_emacsomancer_
> ask the LispWorks guys for an evaluation license. It's the closest thing to
> experiencing one of those Lisp environments of the 80s (Emacs doesn't come
> close).

Could you say something about what additional features LispWorks has that
Emacs doesn't?

------
verisimilitudes
This article would have someone believe Common Lisp is any other UNIX
language, where near-meaningless UNIX configuration and other things abound.
It indents the Lisp in an odd fashion, with closing parentheses on their own
lines, and it doesn't mention the REPL but in one paragraph.

As for Steve Losh's article, I don't recommend that one either; it recommends
using a Discord _server_ ; it recommends using C libraries; it discusses
performance and representation characteristics that are allowed, but not
required, in interfacing with things such as graphics cards; and it has other
characteristics that I don't believe someone new to Common Lisp would
recognize it, so I don't recommend that article to novice Common Lispers.

~~~
patrickmay
Agreed. Install SBCL, Quicklisp, Emacs, and bring up Practical Common Lisp in
a browser, then start hacking. Roswell doesn't add any real value, in my
opinion.

------
pmoriarty
I was very fortunate that my university had a ton of old Lisp books, and after
browsing through a bunch of them I found some really good ones and learned
from those. Unfortunately, I don't remember the titles (though a book on CLOS
stands out in my memory as being an excellent introduction to the awesome
power of OO programming in Lisp), but if you have a university with a good
comp sci library you may want to check it out.

Parenthetically, I don't know if it's true but I'd heard that there have been
more books published on Lisp than all books on other programming languages
combined.

I'd also recommend that anyone who starts out with Common Lisp give a modern
Scheme (like Chicken, Racket, or Guile) a try. I found Scheme to be much more
to my taste and once I learned it I viewed CL as quite backwards in many ways,
so Scheme is what I use today if I can at all help it.

Finally, newbies should check out Emacs and eLisp. eLisp is more primitive
than either CL or Scheme, but it's still great when combined with Emacs, which
you can customize and improve to your heart's content. In addition, there's a
mountain of eLisp code to build on for you Emacs improvement projects. I came
to eLisp after learning both CL and Scheme, so it was pretty easy to pick up,
and that's what I'd recommend others do too, just so you first learn what Lisp
is truly capable of.

~~~
reikonomusha
CL has warts, but at least ANSI CL is portable across a dozen implementations,
has an excellent IDE and debugger, and lots of other boring “practical”
things. Scheme is fantastic, if you’re willing to write code that only works
for one implementation.

~~~
pfdietz
Scheme is a language in which the order of evaluation of arguments to a
function call is not specified by the standard. There is no excuse for that.

~~~
UncleEntity
> Order of evaluation of the operands of any C operator, including the order
> of evaluation of function arguments in a function-call expression, and the
> order of evaluation of the subexpressions within any expression is
> unspecified (except where noted below). The compiler will evaluate them in
> any order, and may choose another order when the same expression is
> evaluated again.

Umm...

~~~
pfdietz
Yes, that also sucks.

Every undefined behavior in a language standard is a failure of the standard
making process, and should be a source of shame. Sometimes it's politically
unavoidable (because there are multiple implementations that do something
different), or practically unavoidable (the best behavior is not yet known, or
impossible to make precise) but every such imprecision is a landmine through
which bugs, often insidious ones, can enter programs.

------
iovrthoughtthis
I’m not a fan of Roswell it’s self but I see the value. The LISP ecosystem is
not bash centric as most languages today are.

It wraps everything it’s own cli which, while powerful break the common
interface that most developers today have become accustomed to.

I know that I would have enjoyed a good bash cli interface for managing my
lisp packages using some of the notions developed in ruby / python /
javascript e.g. project local installs (quick-lisp i stalls packages globally
by default), project lock files for versioning, package binaries / commands
(things like Rake, Rspec, NPM run scripts).

You can do all of this stuff with your lisp install it’s just more complicated
and requires more steps.

------
madiathomas
Each time I see a LISP related article on Hacker News, I always ask myself why
LISP is so popular only on HN. This is the only website where I hear about
LISP. Is LISP popular on HN because it brings advantages to the table or is it
popular because it looks cool to say you use it, or something else?

Please help me understand. I am tempted to learn it but needs justification.

~~~
badsavage
HN creator Paul Graham was really into Lisp. HN has been built with his own
Lisp, Arc. HN attracted many experienced programmers and experienced
programmers usually like Lisp, because Lisp dialects are simple, elegant and
powerful.

~~~
madiathomas
I understand the PG part but I don't agree with the experienced Programmers
part. I know hundreds of experienced Programmers and zero of them are using
LISP. I am one of them. They are using C, C++, C#, Java, JavaScript, PHP,
Perl, Python etc. Anything but LISP.

I won't even be surprised if LISP has a market share of less than 0.01%. Even
in the US. Do you have examples of popular system built using LISP?

~~~
reikonomusha
Rigetti is a company that builds quantum computers and uses Lisp.

* [https://github.com/rigetti](https://github.com/rigetti)

Google Flights is built on Lisp as well.

* [https://travel.stackexchange.com/questions/87540/google-flig...](https://travel.stackexchange.com/questions/87540/google-flights-what-programming-language-is-used-in-the-google-flights-ita-so)

I don’t think the parent meant that experienced programmers are heavy users of
Lisp, or that they use it as their main language, but rather they often know
it and have an interest in it, even if it’s not paying their bills.

~~~
madiathomas
Out of those 100s of Developers that I know, none is interested in learning
LISP. Not even as a hobby. Experienced Developers have already chosen their
tools and they focus on improving on those skills.

~~~
reikonomusha
I’m interested in why you asked 100s of developers if they’re interested in
Lisp.

In my experience, which is evidently quite different to yours, excellent
developers _also_ want to increase their breadth, understand which tools are
good for which jobs, and generally increase their knowledge about programming
and software engineering. It’s usually the poorer engineers, experienced or
not, that stick to just a few tools with no knowledge of others.

~~~
madiathomas
They talk about what they are interested in on a daily basis. You don't even
need to ask them. They will tell you.

There are millions of development tools in this world. No-one has time to
learn all the tools. Even if they want to. I don't understand why LISP have to
be the only exception when coming to tools a Developer can ignore. I doubt
Linus Torvalds has time to learn every obscure technology out there. He
focuses on delivering kick-ass solutions using C. Same as other great
Programmers. It is the book writers and consultants who are busy learning each
and every tool.

~~~
lispm
A bunch of programming language developers learned Lisp and were influenced by
it: James Gosling (Java), Yukihiro Matsumoto (Ruby), Brendan Eich
(JavaScript), Alan Kay (Smalltalk), Robin Milner (ML), ...

Hardly 'book writers and consultants'. These are among the most influential
people for programmers... if you had learned Lisp decades ago, you would have
learned much of the basics for those newer languages: managed runtimes,
evaluation, automatic memory management, programming with first class
functions, virtual byte code machines, etc etc...

~~~
madiathomas
Then we should relegate LISP to an academic programming language and stop
pretending that it is a major player when all the data proves the contrary.
LISP failed for half a century because it isn't the best tool for the job, not
because we are just stupid and only the select few have the brains for it. It
is not the case. It is just not good for the job at hand -> delivering
solutions.

I have used 80% of those programming languages you listed in a professional
environment and I didn't require to learn LISP. I didn't see any resemblence
of LISP on any of them. To correct you, Java was heavily influenced by C/C++,
not LISP. In such a way that my transition fron C++ to Java only took me few
hours.

"Lisp isn’t a language, it’s a building material." \- Alan Kay

~~~
lispm
Btw., 'LISP' is now 'Lisp'.

> Then we should relegate LISP to an academic programming language and stop
> pretending that it is a major player when all the data proves the contrary.
> LISP failed for half a century because it isn't the best tool for the job,
> not because we are just stupid and only the select few have the brains for
> it. It is not the case. It is just not good for the job at hand ->
> delivering solutions.

Nobody claims that it is a major player. My claim was that it was influential
- not academic, but actually practically. People like Matz (Ruby) literally
learned how to implement a programming language runtime by studying Lisp, in
this case the Emacs Lisp runtime.

> I have used 80% of those programming languages you listed in a professional
> environment and I didn't require to learn LISP.

Nobody said it's required. It's just that when you knew Lisp, you would have
already known about garbage collection, first class functions, virtual byte
code machines, managed memory, etc. Nothing which is directly in C++.

> I have used 80% of those programming languages you listed in a professional
> environment and I didn't require to learn LISP. I didn't see any resemblence
> of LISP on any of them. To correct you, Java was heavily influenced by
> C/C++, not LISP. In such a way that my transition fron C++ to Java only took
> me few hours.

If you don't know Lisp, how would you know which influence it had on Java?
C/C++ had directly no Garbage Collection, no managed memory, no runtime code
loading (-> Java class loader), ... thus these things about the Java runtime
were not coming from C/C++. You got the curly braces from C/C++.

Guy Steele, who co-wrote the Java language spec: 'We were not out to win over
the Lisp programmers; we were after the C++ programmers. We managed to drag a
lot of them about halfway to Lisp.'

And you even didn't notice it...

~~~
madiathomas
Curly braces, for loops, while loops, if statements, case statements, variable
declaration and initialisation etc. All those things were carbon copied from
C/C++, not Lisp.

The features you mentioned aren't part of the Java language, they are tools
used by Java language. JVM isn't part of Java as a language, they are part of
the Java platform. Most people confuse the language with the platform. JVM is
a tool used by the language. Even Javac isn't part of Java. It is a tool used
to compile Java [1].

I doubt any Java Programmer was dragged halfway to Lisp. If it was the case,
we were going to see at least 10% of those Developers finishing the trip to
Lisp but we didn't. That's why Lisp remains an obscure language used by 100
people on a good day.

[1]
[http://sheikyerbouti.developpez.com/tmp/j2se5.gif](http://sheikyerbouti.developpez.com/tmp/j2se5.gif)

~~~
lispm
> Curly braces, for loops, while loops, if statements, case statements,
> variable declaration and initialisation etc. All those things were carbon
> copied from C/C++, not Lisp.

That's all minor stuff. But, even the very invention of conditional statements
are originally from Lisp. [http://www-
formal.stanford.edu/jmc/recursive/node1.html](http://www-
formal.stanford.edu/jmc/recursive/node1.html) John McCarthy proposed
if/then/else and recursion to the Algol (the grandfather of C) community in
59.

> JVM isn't part of Java as a language

Historically there is no independent invention of the Java language. The Java
language was developed together for and with the platform -> the JVM. Thus
Java assumed on day one that it runs on a garbage collected platform.

> I doubt any Java Programmer was dragged halfway to Lisp.

There are a bunch of Java developers which struggle with Lisp-derived
languages (like Clojure).

> If it was the case, we were going to see at least 10% of those Developers
> finishing the trip to Lisp but we didn't.

You didn't know where many of the features of the Java runtime come from or
where they originated from. The originally first garbage collected language
implementation was Lisp 1 in the end 50s. Here on Hackernews you can learn
about it. Java (originally called oak) was explicitly designed to be garbage
collected. The Java developers (Gosling) explicitly didn't want C++ like
memory management.

> That's why Lisp remains an obscure language used by 100 people on a good
> day.

I have no idea where you get your numbers from.

~~~
madiathomas
> You didn't know where many of the features of the Java runtime come from or
> where they originated from.

You are making a mistake of talking about tools when we are discussing
programming languages. I have seen most people make that mistake with .NET
platform. Java programming language isn't Java platform. In fact, as a Lisper,
you should know better to dissociate the tools from the platform because Lisp
is so fragmentated.

> Historically there is no independent invention of the Java language.

J++ was a Microsoft independent implementation of Java programming language.
Also Java used by Android is an independent implementation of Java programming
language. It doesn't contain tools which are shown on the Java platform
architecture diagram I pasted on my previous comment.

GC isn't part of Lisp. Never was. Never will. It was invented as a tool to be
used with Lisp. In fact, some Lisp dialects don't even have garbage
collection.

> I have no idea where you get your numbers from.

I was exxagerating to emphasize my point.

~~~
lispm
> Java programming language isn't Java platform.

Java was originally developed by SUN together with its platform. SUN did not
develop Java and then later looked how to implement it. Java was specifically
developed with its implementation for a few specific projects - originally set
top boxes and mobile devices.

SUN didn't develop Java for Microsoft or Google - Microsoft and Google just
copied parts of it years later. If it were legal, they would have copied all
of it. Microsoft then mostly abandoned Java and is no longer relevant in the
Java world. Same for Google, Kotlin is now their favorite language for Android
development. Incompatible platforms for Java are on the way out.

> GC isn't part of Lisp. Never was. Never will.

It's like saying flying is not something birds usually do, just because there
are a few birds which don't fly.

95% of all Lisp installations (including Lisp 1) use some form of automatic
memory management, usually a form of GC and the language is designed to be
used that way. Lisp implementations which don't use GC need extra facilities
for manual memory management.

> was exxagerating to emphasize my point.

Well, it's too easy to see, that you have no idea about actual data and it
kind makes your arguments exposed to be on shaky grounds.

~~~
madiathomas
> Java was originally developed by SUN together with its platform.

That's incorrect. Java programming language is part of the platform.

> Microsoft then mostly abandoned Java and is no longer relevant in the Java
> world.

Another incorrect statement. Microsoft didn't abandon Java, they were forced
to abandon Java because of legal issues with Sun. That's why they created
.NET. They are irrelevant because they decided to stop fighting Sun and
created their own platform.

> Well, it's too easy to see, that you have no idea about actual data and it
> kind makes your arguments exposed to be on shaky grounds.

Lisp isn't even in the top 30. My exxageration were accurate.

> Kotlin is now their favorite language for Android development.

Google is only doing that because they were forced by Oracle. It is a forced
choice.

> It's like saying flying is not something birds usually do, just because
> there are a few birds which don't fly.

That's not what I mean. All I am saying is that Gabrge collection isn't a
feature of a programming language, it is a feature of the platform

------
pvaldes
> use roswell

or apt install cl-launch...

------
mac_was
I can see Lisp is the ‘new’ React. Two years ago there were loads of articles
about React, prior to that it was just Javascript. I can see people got enough
of Javascript.

~~~
iovrthoughtthis
Lisp is like 50 years old.

~~~
mac_was
So what? Javascript is like 20 years old but there is definitely hype for Lisp
now.

~~~
Insanity
HN loves LISP, there's a LISP (the entire family of languages) article quite
often. It's a joke that goes around here and there - the fascination with LISP
in this community.

Also, I would not say there is any more hype for lisp now than 3 years ago.
It's still an esoteric language to most, and one that few people actually
bother learning these days.

All the javascript articles are more "practical" because a wide audience uses
them, but Lisp is a language most people only use at home or at uni.

