|
|
|
|
|
by anamax
6286 days ago
|
|
> (defun f (x y) (let ((z (gethash x :a))) (+ z y)) vs > (defn f [x y] (let [z (get x :a)] (+ x y))) The CL defn of f is a function that is called with two arguments. That function is called like "(f a b)" If the Clojure definition is comparable, that is, the call looks like "(f a b)", why are []s used in the definition and the let? > This slight decrease in regularity makes a lot of functionality more visible. What functionality? x,y aren't part of a vector and neither is z. (x,y may come from a vector in the caller, but I'll assume that the defn works if they don't, so
that shouldn't matter.) |
|