pathom

sheluchin 2023-06-10T13:25:57.546859Z

Does Pathom happen to have a helper for creating a vector of keywords with a common namespace?

Thomas Moerman 2023-06-10T14:36:41.592149Z

Not that I know of, but easy to write. Perhaps:

(defn make-kws [kns & kws] (mapv #(keyword kns %) kws))
; => #'user/make-kws
(make-kws "my.namespace" "foo" "gee" "bar")
; => [:my.namespace/foo :my.namespace/gee :my.namespace/bar]

sheluchin 2023-06-10T14:37:53.366439Z

@thomasmoerman Is there some way to make it work with namespace aliases declared with :alias-as?

wilkerlucio 2023-06-10T14:40:43.021989Z

no such helper in pathom

wilkerlucio 2023-06-10T14:49:19.910329Z

@alex.sheluchin helper that uses aliases:

(defn make-kws [kns & kws]
  (let [kns (if (qualified-keyword? kns) (namespace kns) kns)]
   (mapv #(keyword kns %) kws)))

(comment
  (make-kws ::pci/_ "foo"))

👍 1
sheluchin 2023-06-10T15:10:08.728929Z

@wilkerlucio Ah, nice trick with the throwaway _ kw. Thanks! I'm a little surprised this isn't in Pathom because of the number of such vectors I have when calling resolvers.