Created
March 19, 2025 05:40
-
-
Save sebastiancarlos/b059c33315302d9f770c849039a268f3 to your computer and use it in GitHub Desktop.
Examples for the Python-Combinator (A multi-argument Z-Combinator for Common Lisp)
This file contains 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
(let ((factorial (PY (lambda (self n) | |
(if (<= n 1) | |
1 | |
(* n (funcall self (- n 1))))))) | |
(fibonacci (PY (lambda (self n) | |
(if (<= n 1) | |
n | |
(+ (funcall self (- n 1)) | |
(funcall self (- n 2))))))) | |
(ayy-lmao (PY (lambda (self ayy lmao) | |
(if (equal ayy "lmao") | |
"ayy lmao" | |
(funcall self lmao ayy)))))) | |
(list (funcall factorial 5) | |
(funcall fibonacci 10) | |
(funcall ayy-lmao "ayy" "lmao"))) ; => (120 55 "ayy lmao") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment