In https://www.thc.org/root/phun/unmaintain.html Lisp is regarded such that "LISP is a dream language for the writer of unmaintainable code."
and then proceeds to provide some code examples. These were regarded as somthing [that] "can literally be read and understood in about a second by anyone who knows lisp." on a recent Hacker News comment.
My question is, as someone with only a very small bit of experience in Clojure — what do they mean?
(lambda (*<8-]= *<8-[= ) (or *<8-]= *<8-[= ))
I imagine that some of this syntax means something like the
#(blah %)
syntax from clojure, right?(defun :-] (<) (= < 2))
Mostly lost here. Defining a function called :-] that takes an argument < and checks if it's = to 2? Perhaps (<) is a partial function regarding less than?
One speciality of Lisp and Common Lisp is that it does not have things like operators and a complex operator syntax. Identifiers are all symbols.
Symbols are delimited by a small amount of characters or whitespace. For example the closing parentheses ends any symbol before it.
So
and
are read the same.
Otherwise other characters like *, =, -, _, &, %, ... are valid characters of a symbol, even without escaping.
In practice you will see symbols like above, but not those mentioned in the question.
Really disturbing it gets when the read table is changed or when the numeric input is changed.
or even
Also note that not every Lisp implementation allows functions with keywords as names:
Their point is just that the range of available identifiers is larger, but the semantic overloading of certain characters makes it easy to write code that looks like it might be doing something weird.
If you take a closer look at the first sample,
and rename the variable
*<8-]=
toa
, and*<8-[=
tob
, we see that it's a pretty simple function:In the second case, it's just making the point that since things like
+
,<
, and so on aren't special operators or anything, they're just symbols with the names"+"
and"<"
, you can use them as variable names. Again, we can rename variables and turninto
This one is rather unusual, since the colon prefix indicates a keyword (a special sort of self-evaluating constant in Common Lisp), but SBCL seems to handle it:
Putting function definitions on keyword symbols is somewhat unusual, but it's not unheard of, and can be useful. E.g., see Naming functions with keywords.
That reminds me of a conversation we had on our work IM today, where one of my coworkers commented that this appears in the Sidekiq source:
The latest versions of the Scheme standards support Unicode, too, and in fact, the following code works in Racket and Guile (and probably most other Scheme implementations too):
And this Common Lisp version worked when tested with SBCL: