Created
March 19, 2025 04:42
-
-
Save sebastiancarlos/04b2de48a6f9e9b393c366c83e38778f to your computer and use it in GitHub Desktop.
The Python-Combinator (A multi-argument Z-Combinator for Common Lisp)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun PY (recursive-logic) | |
"The 'Python combinator'. A variation of the 'Z combinator' which takes | |
recursive lambdas with a 'self' recursive argument (hence 'python'), | |
and any number of arguments. | |
How does it work? I have no fucking idea. Ask God." | |
((lambda (x) (funcall x x)) | |
(lambda (x) (lambda (&rest args) | |
(apply recursive-logic | |
(lambda (&rest inner-args) | |
(apply (funcall x x) inner-args)) | |
args))))) | |
;; (PY (lambda (self) (funcall self))) ; Uncomment to summon Cthulhu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment