But it still has better compactness than Python, in my comparison full of caveats.
https://danuker.go.ro/programming-languages.html#overall-map
What Python needs 350-400 chars for, you can do in 250-300 in Lisp or Clojure.
With lisp is still trivial to make a metacircular editor and bootstrap another language, also to create DSLs, but the industry is not appreciating such things anymore as standarization and tool homogeinity seems to be nowadys much better valued.
Everything is expression already makes Lisp beyond what Python can ever reach, unless it sacrifices backwards compatibility.
Also; I would forget about macros generally. In my opinion they should be used in very rare cases where other solutions are not pretty enough or really do not work for the usecase and these are rare in my experience.
I’ve read a few pieces by prominent lispers who moved on to Python for similar reasons, along with wider adoption with a bigger ecosystem.
So you’re not wrong in thinking that. But I do believe there are a few things beyond macros that Lisp makes fantastically trivial that wouldn’t be so in other languages. It just doesn’t seem as magical anymore since we’ve raised the baseline for what is possible, for what to expect from a language. That is due in part to the influence of Lisp itself - lambda the ultimate own goal.
(just a famous example: https://tapoueh.org/blog/2014/05/why-is-pgloader-so-much-fas...)
It is basically a lisp language, but with a "curated" set of standard libraries that do a lot of the stuff one may commonly need in a predictable way.
Documentation is definitely not ideal, but it exists and there is a lot of it. Often one has to look through already written code to figure stuff out, but there is lots of that code in for example guix.
In summary, would I suggest anyone uses guile(or lisp in general) for a commercial project instead of python? In 99% of cases the answer is "definitely no", but does this diminish benefits of learning it? No, too. IMO one almost always benefits from learning new languages as long as the new language introduces new concepts. One gains a wider perspective and who knows, perhaps one day, one is involved in scoping that 1% of commercially written software where one may think, yes guile is the way to go.
That's a standard feature of many Lisp implementations since the dawn of time.
Yes, of course. I mean this from the point of view of someone who doesn't know any other lisp. Not as an advantage of "guile over lisp" . Guile is a lisp after all.
When I discovered that I could forget the cons, car, cdr of LISP and rebuild them from the ground, the lambda-calculus, a very basic "text rewriting" tool, the Swiss knife of the code, the TAO of code ...
as other said, python got a lot from lisp so of course it looks underwhelming
but the lisp history and culture is still worth a lot (and there's more to mainstream lisp than is usually shown, people did context oriented programming prototypes, aop, interface passing ideas. As always lisp evolves)
A massive win over Python I get is performance! The performance of SBCL or another good implementation beats Python hands down. And I don't have to lose anything to gain that performance. The syntax is much cleaner and more enjoyable than Python. Quicklisp provides a wide variety of packages that I can use to build software. So it has the advantages of Python and superior performance.
On a broader "performance" side though, the executables are enormous. If I'm tinkering with a new language on the side, I like to build little utilities - like, say, transposing a csv file. Having a 60MB executable for doing it seems... weird. Can't quite put my finger on it.
Of course, if I were to "compile" Python that way, it wouldn't be much smaller.
The reason why I don't pursue it further is that as a language toolkit, each project evolves effectively into its own language with less portable knowledge if you were to work on a different project with a different team. [For that reason and I do like static types.] Lisp might be more comparable to Perl "there's more than one way to do it". If I were to pursue lisp, I might choose Clojure which has more 'batteries included' and an ecosystem that makes different projects perhaps share more.
For example, most languages have "if" statements, but I can't define my own "unless" statement. I have to make do with "if not". In Lisp, it's pretty trivial to make an "unless" that works just like "if" does (except for the negation, of course).
In practice, I'm working on a pretty large Java code base right now, and if I have the need to pass around a value that is evaluated "later", then I have to pass around a lambda expression, and the syntax makes it very clear that there is a lambda expression here. For example, if I want to pass a boolean and a number and I want to make sure that the number isn't computed unless the boolean is true, then I have to write, in Java:
someMethod(b, () -> a + 5);
Here, "b" would be the boolean, and "() -> a + 5" is the lambda expression that allows "someMethod" to avoid evaluating it in the first place.In Lisp, I can pass a lambda, too:
(someFunction b (lambda () (+ a 5))
But I can also define a macro, so that I can call it like this: (someMacro b (+ a 5))
Much less ceremony. It does, of course, however, require that you know that this is a macro and that it has special evaluation rules. If you need someFunction/someMacro often in your code base, then it makes sense to go for the macro, and your fellow devs will learn how it works. But if there are just one or two spots in the code base, it might be better to go with someFunc and the lambda because then it will be obvious how it works.I've basically resigned myself to passing around lambdas all over the place, but it doesn't make me happy.
Python REPL can't compare to what CL offers. In CL, I load up a bunch of files and start coding with my codebase running in a REPL. Whenever I make code changes, I can patch in those changes to the running instance. I can try them out instantly. If I've accidentally caused complex conflicts with running code, CL has the tools to deal with them. You can even do this kind of interactive updating against running CL instances (more importantly, you can do interactive debugging against production instances).
In Python, you can have a repl open, but there's not a good way to monkey patch everything. Loading all the things is painful. Stuff like adding new libraries to the repo can cause conflicts. If you update just one definition in a file, you must reload everything which makes those complex conflicts more likely, but Python also doesn't have the tools to solve those conflicts. You aren't getting anything interactive unless you are explicitly running your app in a debugger (and doing this in production just isn't going to happen).
Another fun thing about Common Lisp is dynamic bindings for some things. It's not strictly necessary, but makes certain things a lot easier where you can configure a variable that updates the variable in the called function(s) rather than having to pass it in every time you call those function(s).
Finally, on the macro front, macros are compile time while your Python equivalents are runtime. This is a huge difference when it comes to performance. Python is already dog slow and doing a bunch of dynamic stuff makes that even worse.
It's not that I found either to be bad. I quite like the syntax actually. There were some nice things too, I get how macros are neat.
But I didn't get that cathartic realignment of magnetic domains. I saw a neat programming language. In fact (gasp) I couldn't see many massive wins over my go-to Python.
- yes, lisps are compiled and to some extent statically typed, so that's one
- I get the REPL programming experience is better, though somehow it didn't hook me.
- Macros... Yes Python doesn't have them, but there's so much introspection that in practice, whenever I saw a macro example, it was clear how to achieve the same thing with Python.
I didn't get that deep into it, but every time I was presented with a Eureka moment, it was a bit underwhelming.
I can't quite reconcile the promise/hype with my experiebce. Maybe i didn't give it enough time, but then how much is enough?