💾 Archived View for gemlog.blue › users › verachell › 1644777094.gmi captured on 2022-03-01 at 15:26:15. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Note: This post is a Gemini space version of my post originally published on March 6, 2020
At first, Lisp just didn't seem very readable to me. And yes, by this I meant even my own relatively simple code. But as I programmed more and more in Lisp, things became more and more readable. Probably not a surprise, right?! But actually, Lisp is a lot more readable when you are used to it, than a lot of other languages when you are used to them.
Lisp is very readable because of its function-oriented syntax.
Let's take a look at how this is, with some examples.
Lisp statements have the format
(function arg1 arg2 ... argN)
Thus, any statement must begin with the name of a function. This makes it easy to tell what's going on right away by simply reading left to right within each statement. Also, starting with a function name makes syntax errors extremely easy to spot. For example, let's take a look at this incorrect Lisp code:
(12 / 4)
Before even getting past the 12, it should be very clear that what's wrong here is that I'm trying to call a function named "12". Unless I have defined a function named 12 in my program, this code will cause an error.
Most likely, what was intended with this code would be:
(/ 12 4)
translating to 12 divided by 4.
You don't necessarily have to read the entire line to spot an error. An open parenthesis is like a capital letter at the start of a sentence. Things start falling into place.
Statements in other programming languages can vary a lot in how they start; with a variable name or a function name, making them a lot more difficult to interpret right away. You need to look at the entire statement as a whole before you know a) what's going on and b) whether there are any errors in it.