Returns a vector of vectors representing one or more constraints
separated by commas. Constraints may be specified in Clojure using
strings, keywords, vectors, maps, and/or sets.
(defn format-constraint
"Returns a vector of vectors representing one or more constraints
separated by commas. Constraints may be specified in Clojure using
strings, keywords, vectors, maps, and/or sets."
[c]
[[", "]
(fcase #(%1 %2) c
string? [c]
keyword? [c]
vector? (interpose " " c)
map? (apply concat (interpose [", "] (map #(interpose " " %) c)))
set? (apply concat (interpose [", "] (map format-constraints c)))
(throwf IllegalArgumentException
"unrecognized constraint: %s (%s)" c (class c)))])
Comments top
No comments for format-constraint. Log in to add a comment.