Hacker News new | past | comments | ask | show | jobs | submit login

I must admit, I don't know what this is doing, and why.





The semi-colon symbol is the single-line comment symbol in Lisp, but the percent symbol means nothing special in Lisp.

SET-MACRO-CHARACTER is used to modify what happens when certain characters are found while reading code. In this case, SET-MACRO-CHARACTER is being used to instruct Lisp to start treating % as if it were a semi-colon (i.e. the third line is a comment), thus extending the syntax of Lisp on-the-fly.

The (GET-MACRO-CHARACTER #\;) portion could have been any code at all; GP could have defined % to do anything, such as "treat the remainder of this line as if it were a line of Python code", using calls to a Python implementation, such as cl-python [0].

[0] = <https://github.com/metawilm/cl-python>




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: