4 ms·
Really? You can `(compile nil my-lambda)` without having to write a JIT yourself? I meant reader macros, by the way: can it do that? ; A comment (set-macr
by BoingBoomTschak 1y ago
Really? You can `(compile nil my-lambda)` without having to write a JIT yourself?
I meant reader macros, by the way: can it do that?
; A comment
(set-macro-character #\% (get-macro-character #\;))
% Also a comment
- auggierose 1y agoI must admit, I don't know what this is doing, and why.
- potholereseller 1y agoThe 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 https://github.com/metawilm/cl-python>
- foldr 1y agoSure. new Function(“…”) There’s no guarantee that it will be JITed, but then the CL standard is also pretty loose about the semantics of ‘compile’.