Here's a simple trick to make Lisp instantly readable. Take a line of code from an algol-like language:
foo(bar(), baz(quux))
then, shift every opening parenthesis one token to the left: (foo (bar), (baz quux))
and drop the commas: (foo (bar) (baz quux))
Now you have an equivalent piece of Lisp code.It has three levels of notation, depending on what you want. There is even a quick lisp library.
The ubiquity of parenthesis has a purpose - it lets you treat code as data. Your argument only makes sense if syntax choice were 100% based on taste. But it's not (simplicity of syntax brings with it practical features), so it's great that some people are exploring other options.
And it's not intrinsically less readable than say, something like: https://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/api/a0111...
Are you sure? Plenty of languages[1,2] allow you to treat code as data and they don't need that many parenthesis.
[1] https://docs.python.org/3.8/library/ast.html
[2] https://docs.julialang.org/en/v1/manual/metaprogramming/inde...
>>> parse("2 + 2")
['eval_input', ['testlist', ['test', ['and_test', ['not_test', ['comparison',
['expr', ['xor_expr', ['and_expr', ['shift_expr', ['arith_expr', ['term',
['factor', ['power', ['atom', [2, '2']]]]], [14, '+'], ['term', ['factor',
['power', ['atom', [2, '2']]]]]]]]]]]]]]], [4, ''], [0, '']]
"This was rather a disapointment to me. The Lisp parse of the equivalent expression is (+ 2 2). It seems that only a real expert would want to manipulate Python parse trees, whereas Lisp parse trees are simple for anyone to use."-- Peter Norvig, https://norvig.com/python-lisp.html
julia> :(a + b*c + 1) ==
Meta.parse("a + b*c + 1") ==
Expr(:call, :+, :a, Expr(:call, :*, :b, :c), 1)
true
Why not just use a single representation (+ a (* b c) 1) ?I would say: you can execute it, therefore it's code. What am I missing?
> Why not just use a single representation (+ a (* b c) 1) ?
Are you saying you don't like the default print? You can write a println method for type Expr which prints it any way you want. Seems like a miniscule thing to nitpick.
Why wouldn't anyone want to write code like this:
Expr(:call, :+, :a, Expr(:call, :*, :b, :c), 1)You can of course parse code in any language and treat it as data (and it may resemble lisp code!) but it’s not quite the same thing.
Lisp benefits greatly from a decent text editor, but it is quite readable.
I don’t much care about other peoples’ preferences for politics, programming language selection, or religion (or lack thereof).
It seems best for a team to choose a stack by some form consensus, and stick with it.
I have read the linked article several times in the 5 years since it was written, and I enjoy the shared experience. But the article could also have been about using Clojure, or Ruby, etc., etc. And also been interesting.
We are talking lisp here. I don't think there's anything that compares.
Humans being human, I would think it strange if a forum written in Lisp failed to have some sort of pro-Lisp bias.
But I don't understand the unreadability claim: lisp syntax is extremely simple, and therefore (for me, someone is not a developer by profession) extremely readable.
What makes it unreadable for you? The parentheses? (https://i.redd.it/9gwghrz9rcs11.jpg)
That's a lambda that does nothing, right?
Lisp is hard to master, like playing the violin, but if you master it you can get enormous rewards.
Other languages are more like "playing guitar hero", most of the work is done for you and it it way easier to learn.
HN is like a musician network but for programmers. It attracts lots of people around the world that master lisp like musicians master an instrument.
I will tell you about myself, I had a lisp master that did teach me that what had taken me weeks in c, c++ and python code he could do it in lisp in minutes.
As I saw this man "play his instrument" it was obvious that if I wanted to be a good programmer I should master it myself.
Because I had this master teaching me, I could learn it fast.
The "secret" of Lisp is that you can automate your code writing, making you tens or hundred of times more capable with your code.
"Ivory tower" means it is not related to reality. Lisp is very real, like violins are real.
> Other languages are more like "playing guitar hero", most of the work is done for you and it it way easier to learn.
What does that even mean? Python might be easier to learn than Lisp, but surely C++ is much harder to learn and impossible to master. And if you talk about "batteries included", Python may have more but C has obviously much less than Lisp.
Lisp is a fine language, but the ridiculous claims is hurting it more than helping it. I do not believe claims about the amazing productivity of Lisp from someone who doesn't know the difference between C++ and Python.
Not "weeks vs hours" but let me offer my personal experience. I already had around 3 years of professional experience in Python and about the same in Common Lisp.
Last year I had to create a small utility to help some document scanning process, this included doing some OCR. I had the choice to do this in Lisp or Python or whatever language (I also could as well have written the stuff in Java, C#, C, JS, etc.)
Initially I thought "ok, i have good tesseract binding and PDF output libs in Python, where as the Lisp bindings look unmaintained" so i chose Python.
Well, back into Python's antiquated way of working: No compiler-time checking of anything, and, even worse, upon finding an error, there was no way of correcting the offending function and restarting program execution at that point (restarting a stack frame). No sir, I had to run my whole program again (this was an interaction heavy program) to test it again.
So MANY hours were lost in just having to restart the program again and do all the clicks needed to bring back the program to a specific state.
Where with Common Lisp those hours would be reduced to zero, since I can modify the program while it's running and I can always inspect all stack frames and restart them at will. Not to mention other benefits in terms of being able to write code that is way higher in abstraction level. Not to mention I can actually SAVE the current program's state to disk and resume it back at a later date.
And not to mention that the Lisp program would probably had executed 20 to 30 times faster as well.
So far, that's the last time I chose to use Python for non-trivial tasks.
I suspect the issue is that a flight booking system is basically the only significant commercial system written in Lisp, which is why it is always dragged out in these discussions.
Here is some background on that particular application:
https://www.msri.org/people/members/sara/articles/airfares.p...
http://www.paulgraham.com/carl.html
> I suspect the issue is that a flight booking system is basically the only significant commercial system written in Lisp
How would you know that?
I just don't see how it is any form of evidence for that rather extraordinary claim? It just shows it is possible to write complex software in Lisp, but I wasn't disputing that. I'm disputing the claim of 100 x productivity.
There was no general claim of 100x productivity. The commenter wrote: "I had a lisp master that did teach me that what had taken me weeks in c, c++ and python code he could do it in lisp in minutes"
That was his personal impression, not a general claim. I can't also imagine how this could be a general claim.
The feature of Lisp that was heavily used in the code was the use of macros and metaprogramming. These are the kinds of problems were lisp excels. ITA made use of the fact that Lisp is a programmable programming language and they adapted programming language to the domain.
Well, what I mean: can you elaborate a bit more?
More details here http://www.paulgraham.com/carl.html you can also glean more information by searching over older discussions about ITA on HN.
(Of course anybody can chime in, it should be actually easy, if the claim that here the experts are lingering around)
Is this what we do now? Instead of agreeing to disagree, or (better!) explaining our viewpoint, we make comments fade into the background? Whatever happened to edification?
Because, these are valid comments! The real world bears them out! I strongly disagree, but that does not make me (or anyone else) right. This is a forum for discussion, so - discuss!
He wrote: 'Contrary to popular opinion, Lisp is an incredibly practical language for building production systems.'
Today, C++ is a dominant programming language. Lisp is only used in niche applications. Therefore, it is likely only to be understood by a small number of people with specialized knowledge -- hence, it is esoteric.
I don't agree with the conclusion you draw from a definition of esoteric, that is without context anyway, taken from a natural language dictionary.
Which niche btw?
With Lisp you don't even need to write lisp code. You can write java, c++,c, swift code... using lisp.
That is , you can write lisp code without people realizing you are writing lisp code. The only thing they will notice is that your code looks almost too perfect, too well formatted and justified, are extremely productive and never make mistakes.
For example the first version of the .net garbage collector was written in Common Lisp and then translated to C++. Since then it was maintained and enhanced in the C++ version.
https://web.archive.org/web/20150307034829/http://blogs.msdn...