Last active
December 31, 2015 17:29
-
-
Save kosugi/8020252 to your computer and use it in GitHub Desktop.
マクロに apply できない問題
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 or/l (args) | |
| (let ((r nil)) | |
| (while (and args (null r)) | |
| (setq r (or r (car args))) | |
| (setq args (cdr args))) | |
| r)) |
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
| (define (or/l xs) | |
| (if (null? xs) #f | |
| (let1 x (car xs) | |
| (or x (or/l (cdr xs)))))) | |
| ;; https://twitter.com/anohana/status/413272565629456384 | |
| (any values xs) ; ここまでくると define し直す意義ないか. |
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
| (define (or/l xs) | |
| (fold (lambda (r l) (or r l)) #f xs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment