Created
December 15, 2011 06:10
-
-
Save smihica/1480016 to your computer and use it in GitHub Desktop.
lambda短縮マクロ ref: http://qiita.com/items/1380
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
;; #[+ 1 2] | |
;; => #'(lambda () (+ 1 2)) | |
;; | |
;; #[+ _ 1] | |
;; => #'(lambda (_) (+ _ 1)) | |
;; | |
;; #[if (< _0 10) (+ _1 2) (+ (- 100 _0) _2)] | |
;; => #'(lambda (_0 _1 _2) (if (< _0 10) (+ _1 2) (+ (- 100 _0) _2))) | |
> (funcall #[+ 10 100]) | |
; 110 | |
> (funcall #[+ _ 100] 1) | |
; 101 | |
> (mapcar #[list _0 _1 _2] '(1 2 3) '(4 5 6) '(7 8 9)) | |
;((1 4 7) (2 5 8) (3 6 9)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment