clojure, function argument is vector, but it takes a map without problem.
(defn flower-colors [colors]
(str "The flowers are "
(:flower1 colors)
" and "
(:flower2 colors)))
(flower-colors {:flower1 "red" :flower2 "blue"})
;; -> "The flowers are red and blue"
Function flower-colors suppose to take vector type argument, but with a map as input, it is still fine. Why?
You are misunderstanding the format of a function definition.
In your function, the single argument 'colors' is untyped and can be anything. The square brackets are used to denote the beginning and end of the arguments list (i.e. the symbols for the arguments are wrapped in a vector to distinguish them from the following code expressions). So this function:
accepts 2 args and returns them in a simple map.
Without the square brackets, some other way of marking the first & last arguments would be required.