#58
Function Composition
 

Difficulty:Medium
Topics:higher-order-functions core-functions


Write a function which allows you to create function compositions. The parameter list should take a variable number of functions, and create a function applies them from right-to-left.
test not run
(= [3 2 1] ((__ rest reverse) [1 2 3 4]))
test not run
(= 5 ((__ (partial + 3) second) [1 2 3 4]))
test not run
(= true ((__ zero? #(mod % 8) +) 3 5 7 9))
test not run
(= "HELLO" ((__ #(.toUpperCase %) #(apply str %) take) 5 "hello world"))
Special Restrictions
  • comp


  • Code which fills in the blank: