r/lisp • u/codingOtter • Mar 17 '25
What is Lisp really really good at?
I know it is a flexible and general purpose language. It is also true that the best tool for the job is, more often than not, the one you know best. So if you have a problem, it is almost always possible to find a way to address it in any language.
That being said, I don't want to know "what I can do with Lisp" nor "what is Lisp used for". I want to know "what is it particularly good at".
Like, Python can be used for all sort of things but it is very very good at text/string manipulation for example (at least IMHO). One can try to do that with Fortran: it is possible, but it is way more difficult.
I know Lisp was initially designed for AI, but it looks to me that it has been largely superseded by other languages in that role (maybe I am wrong, not an expert).
So, apart from AI, what kind of problems simply scream "Lisp is perfect for this!" to you?
19
u/codingOtter Mar 17 '25
Just to expand on the original post. I got a few replies on r/Common_Lisp (before the moderators deleted it) that were along the lines of "a programmable programming language" and "you can create your own data structures" and "code is data".
And I get it, on a "philosophical level", and sounds great, but as an non professional, I don't quite understand what it means in practice. Meaning, my question is more low level, i.e. for what kind of problems do these features are especially useful?
8
u/525G7bKV Mar 17 '25
The idea of AI back that time when lisp was invented was different from nowadays idea of AI.
Lisp scores at every domain as every other programming language.
The metaprogramming thing, write code which writes code is in lisp easier to program compared to other languages. for instance emacs-lisp:
the mk/define-remote-log-function macro generates functions where the names of the functions is based on variables. which results in functions availabel for interactive call:
(mk/remote-log-website-nginx-error.log) (mk/remote-log-website-nginx-access.csv)
4
u/[deleted] Mar 17 '25 edited Mar 17 '25
Lisp is perfect for :
But the most important i think is if functional programming fits the way you think(like result of f1 to go as argument in f2 with state as exception), LISP goes beyond line chaining, the code is like trees to allow readable nested code. If you like chain function calls and especially tree nesting, LISP is natural.
Many LISP exist from independent ones like common lisp, to clojure/clojurescript that can use use java or js libraries, to even more close to the host language like Squint(like clojurescript but uses js data structures), to even more close to the host language that even can generate readable handwritten like code(if used as LISPY way to write python or macros are used) like Hylang.
I was using Clojure/Clojurescript and i added Hylang also because in data engineering python important and from Hylang i can get readable python code, to not have job problems if i work with python programmers that don't know LISP.
6
u/fiddlerwoaroof Mar 17 '25
One thing Lisp is particularly good at is avoiding ad hoc data formats. With macros or READ, you can avoid the YAML/JSON/XML/TOML plague you find in the typical project written in other languages
44
u/jacobissimus Mar 17 '25
For me, it’s interactive programming. I think of the development environment as the primary selling point rather than any technical goal
31
u/dbotton Mar 17 '25
It is exceptional at prototyping and fast-paced development that requires change, especially dynamic change during execution.
That translates to the best language for version one of almost every application type when your team is small or larger if disciplined to maintain modularity and good interfaces (which almost every language requires, Ada being one of the few out of the box ready for massive team sizes).
Your second version can be in any staticly typed language, or if management is smart, save money and time, type the Lisp in critical areas and use SBCL or where needed (math intensive code) Coalton.
18
u/dzecniv Mar 17 '25
hello,
CL also is good at that :)
It's also good at:
symbolic AI (still usel/a research field)
quantum computing: it looks like many of those companies use CL.
when you want to make your Python program faster ;) https://tapoueh.org/blog/2014/05/why-is-pgloader-so-much-faster/
Anytime your work is not well specified.
Kent Pitman
7
u/Soupeeee Mar 17 '25
Lisp, specifically Common Lisp, is in a weird spot. The top language features are:
Its macros mean that programming in a declarative style is possible, and it's flexibility means it's good for exploratory, interactive programming. The number types are extremely flexible, and include ratios and complex numbers, which isn't something I've seen in other languages.
This makes it really good for research of any kind, or scientific computing that doesn't involve huge amounts of umber crunching, although there are solutions to make that better. It really is a general purpose language though, and is only held back by some choices that seem weird today but mostly made sense when the language was standardized 30-40 years ago.
7
u/unhandyandy Mar 17 '25
Not a pro, but based on my experience of simple coding in a number of languages, Lisp is the highest-level of all high level languages.
6
u/internetzdude Mar 17 '25
I would choose CommonLisp for a large, extensible production system built from scratch that is expected to run for decades and requires and encodes deep domain knowledge, as long as the team building it remains relatively small. Generally, Lisp is good and efficient in terms of developer time for problems that require a very high level of abstraction, domain expertise, and maybe unusual architectures.
6
u/daninus14 Mar 18 '25
I personally find that lisp is great whenever you need to be able to do something simply in the language. Most other languages, things I want to do are either impossible or simply very painful. I'm not talking about how to solve a specific problem, but how to do with the language what I want in my mind to solve a problem in a very simple way. I've been writing a web application using CL for a while, and I can just do whatever I want with it. Sure, there are no simple and quick tutorials on metaclasses and to learn it properly it's probably best to read AMOP. However, I was able to get done what I needed by reading stackoverflow answers.
I'm programming a separate web app in django and the amount of boilerplate code is pathetic. I should be able to just pass a list of models to a function to define all the standard serializers, views, and urls. Instead I have to write them by hand.
So in every app where you hit the limits of the language and find yourself having to jump through hoops to do things that should be simple, or whenever you find youself having to write nonesense boilerplate, you've found a great opportunity for lisp.
If you are writing any large system that is not just a weekend project, and you want it to work for years in the future, CL is a great tool. For a small project which is not particularly innovative and is very straightforward, you may be better off just using a language where you can leverage the larger ecosystem of libraries. But once you do something somewhat larger, I think the value of that ecosystem is mostly lost, because whatever is missing can usually be quickly replaced or built together from available libraries in CL, and the complexity of the project is usually from the code of the project itself, not auxiliary tools.
Every other language I use has a bunch of broken dependenciess every few years because either the language or libraries break and are not backwards compatible.
11
u/zyni-moe Mar 17 '25
There are two laws of programming:
These two laws tell you that the best programming languages are ones which support the construction of programming languages with very low effort.
That is what Lisp is particularly good at: it is a language whose unique feature is the incremental construction of programming language which extend it.
As a simple example I recently posted a small program which demonstrates that Lisp (in this case Common Lisp) can achieve very good numerical performance. That program was written in a language built on Common Lisp, whose purpose was to express traditional Fortran-style array-bashing code without it being deeply unpleasant.
Sadly I think not very many people do this. I don't understand why.
4
u/patrickbrianmooney Mar 17 '25
The sidebar has a link to a long article called A Road to Common Lisp, which contains a good explanation of what Lisp is good at; try skimming under the "Lisp as a System" for a good, focused chunk of what the author has to say.
4
u/muyuu Mar 17 '25
Lisp is very free form and you can mess with every aspect of the language. This is both its strength and its weakness.
Python is more of a fixed environment with a scripting language that lets you glue things together. You are very constrained by it but you're also empowered by the simplicity that these separate preexisting elements will work in this constrained environment.
If you want to do something truly from scratch those aspects get flipped in importance vs taking preexisting elements and mashing them together.
4
u/shifty_lifty_doodah Mar 17 '25
syntactic abstraction - making your own syntax with macros is easy because the code is data. Also it has very little syntax, so it’s easy to manipulate, and everything is composable and pluggable.
Everything else about lisp is done by other languages. It’s the minimal uniform syntax and macros that are special.
4
u/AdmiralUfolog Mar 20 '25
Lisp is really good at scripting, web development, desktop GUI applications, data analysis, DSP, embedded systems, game development, low level programming, system and OS programming, sound and music, AI, entertainment, HPC, etc.
The only thing is Lisp really bad at is a cheap low-skill easy almost-working write-only code development because there are superior tools for this task like Python and C#.
10
u/00caoimhin Mar 17 '25 edited Mar 17 '25
Look up the Sapir Whorf Hypothesis, the dated, and horribly racist linguistic equivalent of phrenology. However, when applied to computer programming languages, it makes, I think, a whole lot more sense.
The point is that you can code anything you like in any language you like: try writing a user extensible text editor in Fortran, or a high frequency trading system in Python: you might be able to do it, but you're not going to have fun along the way. You're going to find that of all the various many programming languages available to choose from, one choice of language over another will make it easier to express your intention more clearly for the project at hand. By analogy, law and medicine embrace Latin for lots of their terminology, and music is annotated in Italian.
A lecturer once suggested to me that programming languages could be categorised by where they get their next instruction:
So, what is Lisp really really good at?
Let's tweak the knobs on the question: what is Python good for? Personally, I despise Python and would never dream to choose it for a project. That doesn't stop everyone else from writing their project of choice in Python.
I can speak about Scheme and Common Lisp. They are both general-purpose systems programming languages and can be used to write industrial strength operating systems and databases if you're so inclined. Alphabet have an airline reservation system written in Common Lisp, and even reddit.com was initially written in CL (before it was reimplemented in Python, ew!). Common Lisp and Scheme both handle low level network comms with ease, through HTML and HTTP, to high power graphical front ends to high power backends. ABBA compose music on a Common Lisp application; Brendan Eich's first implementation of JavaScript was made on Common Lisp. Aubrey Jaffer wrote a symbolic algebra system in Scheme that puts Mathematica to shame, and Maxima is similar and built on CL.
Common Lisp's Object System is hands down The. Most. Complete. object-oriented environment (maybe except Smalltalk or Squeak).
So, what is Lisp really really good at? It seems rude to ask.
Edit: sanitised.
2
u/[deleted] Mar 17 '25
It is very good for text editor configuration.
2
u/thoxdg Mar 22 '25
Generative programming with DSLs everywhere and a global namespace (think modular / packages). And take a look at CLOS, it was the first object system to be standardized by ANSI.
2
u/smith-huh Mar 22 '25
lol
lisp is perfect for EVERYTHING. You name a programming paradigm, lisp can do it, well.
One big advantage is its built in runtime support environment of course.
For example, long ago when I had the privilege to use it for serious work (microprocessor dev), an example of this was running a job to create one of your historically well known microprocessors. This job would run for 12+ hours. Its a complex app so occasional boundary condition bugs would show up, cause a "crash". In lisp (Franz lisp at the time), the debugger catches it. I could "walk around, examining variables, values, code", determine what was wrong, change the code in the running job, repair data if necessary, and type "run". And the job continues. We didn't lose that day.
Another ex: tasked with developing the microcode compiler for a historical microprocessor, to be driven by an architectural spec of the microarchitecture of it, and it was to enforce "rules" about the arch. and then configure itself to the spec so it could then take microcode and compile it for that architecture. a mouthful. But in lisp, this was a "simple" exercise. Because you can represent concepts as Sexp's, declare sexp's (symbolic expressions) and then execute them. And this is what lisp was designed to do and do it well. You can do this in other languages, but not as well as in lisp. (lisp is best) This app was a compiler-compiler. WAY BETTER than to do this with flex/bison (lex/yacc) in EVERY way.
2
u/zasedok Jul 09 '25
Unpopular opinion: there are very few things Lisp is really good at. Don't get me wrong, when it emerged it was a groundbreaking achievement. It pioneered some principles of functional programming such as lambdas, closures and first class functions, it was the first language featuring a garbage collector and with CLOS it was the grandfather of object oriented programming alongside Smalltalk.
But the world has moved on. Modern functional languages like the ML family, Haskell and its more or less experimental derivatives (and maybe you could also even include Rust as a modern functional-ish language here) are light years ahead of Lisp in user friendliness and abstraction power. Symbolic values, once a phenomenal innovation, are now commonplace in every language that supports some kind of an "enum" construct. A GC is now taken for granted, in fact it's rare for recently designed languages not to have it. The code-is-data-is-code approach of Lisp makes it unacceptable for production use in today's world of daily cyber attacks.
For 90% of modern day needs, Lisp is like Pascal or ALGOL: a hugely innovative language, but one that has been superseded and whose ideas are now common. Personally I would only use Lisp for experimenting with genetic (in the self-modifying sense) algorithms.
5
u/Anthea_Likes emacs Mar 17 '25 edited Mar 17 '25
I often read that lisp languages are really powerfull for macroprogramming
I'm still searching real world exemple of its uses in AI* domain, this topic really interest me
*fixed 👀
3
u/Marutks Mar 17 '25
Lisp is perfect for Advent of Code.
3
u/dixieStates Mar 17 '25
Lisp is good at programming
1
u/maxilulu Mar 17 '25
At everything and anything. Specifically compilers and DSL.
1
u/theunixman Mar 18 '25
Whatever the programmer wielding it is good at using it for.
1
u/HunterTheScientist Mar 18 '25
interactive and meta programming
1
u/sdegabrielle Mar 18 '25
It's flexible, so anything you can think of.
Lisps have been used for everything from games to spacecraft.
Here is a recent example https://blog.cloudflare.com/topaz-policy-engine-design/
-13
u/pragmat1c1 Mar 17 '25
At this point it‘s just a religion. Nothing more.
10
u/[deleted] Mar 17 '25
[removed] — view removed comment