 i  and type of collection. Map aways returns a sequence.
 - We would have to worry about the imperative flow of control.
 
-Reduce  applies a function to a collection producing a single value
-"
-(fact (reduce max [0 -3 10 48])
-  => 48)
+Reduce  applies a function (taking two values) to a collection producing a single value
+"
+(fact
+  (reduce max [0 -3 10 48])
+  => 48 )
 "similar to:"
-(fact (max (max (max 0 -3) 10) 48)
-  => 48)
+(fact
+  (max (max (max 0 -3) 10) 48)
+  => 48 )
 
 (fact "initial seed value"
   (reduce + 50 [1 2 3 4])

is higher-order functions
"
(defn adder
  "produce a function that add a given number to it's result"
  [n]
  (fn [x] (+ n x)))

(fact ((adder 5) 18)
  => 23)

(def add5 (adder 5))

(fact (add5 18)
  => 23)

(defn doubler
  "doubles the result of the given function"
  [f]
  (fn [& args]
    (* 2 (apply f args))))

(def double-+ (doubler +))

(fact (double-+ 1 2 3)
  => 12)

[[:subsection {:title "Primitive Logging System Example -- page: 72"}]]


(fact "prefix with a number of arguments"
  (apply * 0.5 3 args)
  => -60.0 )

"
'apply' applies a function to all arguments in a sequence, 'partial' only applies
some of the arguments returning a new function that applies to the rest.

partial ::  fun args -> fun
"
(def only-strings (partial filter string?))

(fact "partial application in clojure"
  (only-strings ["a" 5 "b" 6])
  => '("a" "b"))

