3 ms·
https://github.com/search?q=lang%3A%22Common+Lisp%22+%22%28lambda+%28%29%29%22&type=code https://github.com/search?q=lang%3A%22Common+Lisp%22+%22%28l... and htt
by phoe-krk 2y ago
https://github.com/search?q=lang%3A%22Common+Lisp%22+%22%28lambda+%28%29%29%22&type=code https://github.com/search?q=lang%3A%22Common+Lisp%22+%22%28l... and https://github.com/search?q=lang%3A%22Common+Lisp%22+%22(lambda+()+nil)%22&type=code https://github.com/search?q=lang%3A%22Common+Lisp%22+%22(lam... indeed gives quite a lot of results.
A (possibly stupid) question: is it possible to generalize this pattern and will it bring any kind of improvements? I'm thinking that for functions shaped like (LAMBDA () X), where X is a literal object or a lexical variable, COMPILE can keep a hash-table with the X being its weak keys and the respective compiled functions being their values. Whenever a form like (LAMBDA () X) is encountered as an argument to COMPILE, it can "intern" the function in the table (if necessary) and return it.
I have no idea if it would bring any or a lot of gains besides the cases for NIL (and maybe T) because of CONSTANTLY and closures, but it's a thought that came to my mind upon first reading this commit.