Skip to content

Instantly share code, notes, and snippets.

@fumokmm
Created December 13, 2010 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fumokmm/738556 to your computer and use it in GitHub Desktop.
Save fumokmm/738556 to your computer and use it in GitHub Desktop.
(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