Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(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
You can’t perform that action at this time.