(sarcasm over)
If Lisp is so amazing, why does it not get more followers?
(sarcasm over)
If Lisp is so amazing, why does it not get more followers?
E.g. Lisp is so much better than pretty much every other programming language (except maybe APL) that it truly is bizarre and therefore interesting that it doesn't get wider adoption. (I don't even use it, despite having such a near-worshipful attitude towards it.)
>I don't even use it, despite having such a near-worshipful attitude towards it.
How do you know that it is so much better then?
Anyway, I know this is "argument from authority" by some rando on the Internet, so I don't expect you to take it seriously. :)
At least in my opinion: Lisp is amazing for its simplicity and homoiconicness and the great powers that come with those. Erlang is amazing for its approach to distributed computation and reliability. Haskell is amazing for at least its theory, and probably more I'm not yet aware of.
It's not popular because the majority of programmers are mediocre and will never understand the point of homoiconicity.
I guess the masses can muddle through with rust or typescript.
I personally vastly prefer Python's syntax over Lisp's, because the parentheses require two buttons pressed (shift + 9) instead of one (tab). That may sound trivial, but it's why I jump to Python instead of a Lisp.
That said, I do suffer from Python problems: the GIL, clunky immutable data structures like pyrsistent, poor support for shared memory for multithreading and so on.
Edit: I just realized in Lisp you could replace the built-in data structures if you wanted, so libraries like pyrsistent would require little change in client code syntax. I guess that's one example of homoiconicity in action.
Can you come up with another one? It is not very often that I find myself wanting to redefine the language I'm using (which comes with its risks: other coders and/or their tooling might find my code hard to follow).
Hilariously enough the project that made me switch to lisp from python as my scripting language was writing a lightweight parser for ascii delimited files - https://en.wikipedia.org/wiki/Delimiter?useskin=vector#ASCII... - instead of csv files. After doing it in both I had the eureka moment of using nested s-expressions in the scheme version instead of special characters. All of a sudden I had access to a csv like file which could be arbitrarily nested and didn't require me to worry about escaping. The next mind blowing moment was when I realized I could embed the code of the parser as the header of the format as the type definition and use it to evaluate the format with the program that was used to create it.
You don't even need some deep insanity to do it just:
(eval `(,(car ls) (cadr ls)) (interaction-environment))
It also shows why I wouldn't use lisp for everything: if I wanted to ingest a file of a known csv dialect that won't fit in memory I'd do it in C after doing the prototype/master version in lisp. I also wouldn't trust running unverified source code from the internet. But for internal projects it's better than sliced bread.Here, `_from_source` goes from a plain array of tokens to a nested one (tree), depending on their arity:
https://github.com/danuker/symreg/blob/7c6593d3046f6c52dfb92...
S-Exps are almost valid Python. The exception is the single-element tuple which needs a comma: (x,)
But I still preferred to use Python as a programming language, and Lisp as a sort of AST. It's just easier. I am curious what roadblocks you faced in your ASCII delimited parsing.
Do you by any chance still have the two parsers? I'd love to see them. If you are worried about your anonymity, you can find my e-mail on my blog, and my website on my HN profile. I promise not to disclose your identity publicly.
You're 90% there. Lisp notation obviates the need for arity tracking, which is why in lisp + and sum are the same function:
scheme@(guile-user)> (+)
$416 = 0
scheme@(guile-user)> (+ 1)
$417 = 1
scheme@(guile-user)> (+ 1 2)
$418 = 3
scheme@(guile-user)> (+ 1 2 3)
$419 = 6
Add higher order functions, e.g. (λ (x) (x x)), and lisp notation is the simplest/only way to deal with the general case where you don't know ahead of time the arity of the function you'd be applying because of partial currying and data persistence.As for the parsers this was 10 years ago at university. I've long since lost the source code. There weren't any problems with python, it's just that once I wrote the lisp version I realized just how useful the brackets actually are. There's a reason why every computer language is more or less context free. Lisp just takes that to its logical conclusion.
Cheers!
The fastest composite Python "framework" is uvicorn at 17.9% of the fastest run in Java (officefloor). The fastest Clojure run is Aleph at 36.4%.
https://www.techempower.com/benchmarks/#section=data-r21&l=z...
About SBCL, I get conflicting results. The Benchmarks Game shows it roughly as fast as Java for many problems:
https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
But here it's significantly worse than the Clojure runs, likely due to the slow DB bindings (the other test types show it roughly in line with Clojure; though it uses a "Stripped"/unrealistic HTTP implementation):
https://www.techempower.com/benchmarks/#section=data-r21&l=z...
I am not sure which Lisp implementation is used; is it SBCL? Does this file speak to you?
https://github.com/TechEmpower/FrameworkBenchmarks/blob/73eb...
[1] https://renato.athaydes.com/posts/revenge_of_lisp-part-2.htm...
In reality, they work pretty much the same way in the two languages, but due to the syntax, it was easier (at least for me) to grapple with the ideas in a lisp first.
I very rarely write macros, but I sure use them all the time via the web framework and db-wrapper libraries that dominate the Elixir ecosystem and they've been useful for all the "business applications" I've worked on in the past several years.