Reputation: 1331
I did not know how to phrase that but here is the problem :
(defmacro defbasic [val-fn]
(let [;; Like str but keywords are str'd without :
fn-name (fdat/->string "make-" val-fn)
;; This is a hashmap got from basic-builders
;; which is def
options (get basic-builders val-fn)]
`(defn ~fn-name
([]
(~fn-name {}))
([descriptor]
(->basic-operation ~options descriptor)))))
The function ->basic-operation works and is defined before. The intent of the macro is to create generic coercers like :
(defbasic :cat) ;; ==> defn a make-cat function
I saw the clojure spec throws but I do not see what the problem is. I see the map and the right data.
I thought that maybe the problem was the fact that there is a list of arities ?
Thanks
Upvotes: 1
Views: 204
Reputation: 1331
Ok I finally found the problem by tral-guess-error :
(defmacro defbasic [val-fn]
(let [fn-name (symbol (fdat/->string "make-" val-fn))
options (get basic-builders val-fn)]
`(defn ~fn-name
([]
(~fn-name {}))
([descriptor#]
(->basic-operation ~options descriptor#)))))
I forgot two things :
It hope all of these would be documented in a single place, many learning content does not explicitely explain these symbols (or I missed it).
Upvotes: 3