Created
December 13, 2010 01:49
-
-
Save fumokmm/738556 to your computer and use it in GitHub Desktop.
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
(def plus #(+ % 3)) | |
(def times #(* % 2)) | |
; 適用順は右から | |
(def f (comp times plus)) | |
(def g (comp plus times)) | |
; (times (plus 4)) | |
(println (f 4)) ;=> 14 | |
; (plus (times 4)) | |
(println (g 4)) ;=> 11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment