I am still learning clojure and I have doubts.
when I write an anonymous function, I do it
fn [parameter] (do something)
ok .. function body is enclosed in parentheses
now i'm reading a fibonacci solution like this
(iterate (fn [[a b]] [b (+ a b)]) [0 1]))
My doubt is why I don't like it
(iterate (fn [[a b]] ( [b (+ a b)] )) [0 1]))
I turn on the function ()
()
(iterate (fn [[a b]] "(" [b (+ a b)] ")" ) [0 1]))
it receives a vector and then returns a function of the body than another vector ...
This is different when I call a function with a vector parameter or I make a big mistake.
, , . "" , , , .
, , "" [foo,bar,baz]. , {:a foo, :b bar, :c baz}. , .
[foo,bar,baz]
{:a foo, :b bar, :c baz}
, "" , , (fn [] ...), #(...) (defn [] ...).
(fn [] ...)
#(...)
(defn [] ...)
: [, ], { } (vector) (hash-map) , [1,2,3] - , (vector 1 2 3), {:a foo, :b bar} (hash-map :a foo :b bar). , "", , Clojure, .
[
]
{
}
(vector)
(hash-map)
[1,2,3]
(vector 1 2 3)
{:a foo, :b bar}
(hash-map :a foo :b bar)
, , Semperos, [1 2 3] / ( 1 2 3), ! {: a 1: b 2}, (hash-map: a 1: b 2).
, , clojure , - [..] (vector...) : -).