Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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



Sure.

    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’.


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>




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: