Strategy pattern in Clojure less than 1 minute read Notes clj꞉user꞉> ; Use `alt+enter` to evaluate ;; strategy pattern (+ 4 3) 7 clj꞉user꞉> (* 4 3) 12 clj꞉user꞉> ((if true + *) 4 3) 7 clj꞉user꞉> ((if false + *) 4 3) 12 clj꞉user꞉> (defn add [a b] (+ a b)) #'user/add clj꞉user꞉> (defn multiply [a b ] (* a b)) #'user/multiply clj꞉user꞉> ((if false add multiply) 4 3) 12 clj꞉user꞉> ((if true add multiply) 4 3) 7 Twitter Facebook LinkedIn Previous Next