11 ms·
It is a little clearer to me how this works with things like primitives, but how do you annotate a function that takes a map as input and returns a list? (defn
by axle_512 13y ago
It is a little clearer to me how this works with things like primitives, but how do you annotate a function that takes a map as input and returns a list?
(defn my-keys [m]
(keys m))
Edit: Just found Seqable. Looking into it now.
This link helped me a lot.
https://github.com/clojure/core.typed/wiki/Types https://github.com/clojure/core.typed/wiki/Types
- adambard 13y agoAmbrose pointed me at this link for documentation of core.typed's convenience type wrappers (Vec, Seq, List etc.): http://clojure.github.io/core.typed/#clojure.core.typed/Seq http://clojure.github.io/core.typed/#clojure.core.typed/Seq
- ambrosebs 13y ago(ns my-ns (:require [clojure.core.typed :as t :refer [ann]])) (ann my-keys (All [a] [(t/Map a Any) -> (t/Coll a)])
- axle_512 13y agonice, thanks!