I’m getting the following error when upgrading from clojure 1.9 to clojure 1.12
Syntax error macroexpanding defact at (up/lib/pvm/fact.clj:23:18).
Don't know how to create ISeq from: clojure.lang.Symbol
The offending code is this:
(defmacro defact
([name fields] (defact &form &env name nil fields nil nil))
([name doc-string? fields] (defact &form &env name doc-string? fields nil nil))
([name fields meta-key meta-val] (defact &form &env name nil fields meta-key meta-val))
([name doc-string? fields meta-key meta-val & meta-data]
(let [gname name
kfields (into [] (map keyword fields))
classword (str *ns* "/" gname)
md-list (when (and meta-key meta-val)
[meta-key meta-val])
md-list (if meta-data
(concat md-list meta-data)
md-list)
md (apply hash-map md-list)
md (if (empty? md) nil md)
doc (or doc-string? (str "Positional factory function for map " classword "."))]
`(do
(def ~(symbol (str gname '-meta)) ~md)
(def ~(symbol gname) ~classword)
(defn ~(symbol (str gname '?))
[m#]
(= ~classword (:fact-type m#)))
(defn ~(symbol (str 'map-> gname))
~doc
([m#]
(with-meta
(assoc m# :fact-type ~classword)
~md)))
(defn ~(symbol (str '-> gname))
~doc
([& m#]
(if (= ~(count kfields) (count m#))
(with-meta
(assoc
(zipmap ~kfields m#)
:fact-type ~classword)
~md)
(throw (ex-info "Incorrect number of arguments" {:got (count m#) :desired ~(count kfields)}))))))))
)
This is very old legacy code that we need to upgrade the clojure version. For some reason I can still build the uberjar
but it fails during lein check
, which is part of our build process.
I think the issue has to do with the change in 1.9.0-alpha3, but I can’t find anything on the recommended solution. This is also low level code that we can’t get rid of. Any help would be greatly appreciated
I have tried removing and moving around various arguments and such however I’m not very familiar with clojure and this seems to be leveraging some features of the language I don’t fully understand and I can’t seem to find resources on.
Jarrod Stone is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.