This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-07-12
Channels
- # announcements (2)
- # babashka (22)
- # babashka-sci-dev (15)
- # beginners (62)
- # calva (2)
- # cider (8)
- # clj-kondo (33)
- # clojure (52)
- # clojure-europe (46)
- # clojure-losangeles (1)
- # clojure-norway (5)
- # clojure-spec (7)
- # clojurescript (31)
- # conjure (20)
- # data-science (4)
- # datalevin (16)
- # fulcro (28)
- # hyperfiddle (71)
- # introduce-yourself (3)
- # lsp (50)
- # off-topic (16)
- # polylith (8)
- # portal (3)
- # practicalli (1)
- # reitit (1)
- # releases (2)
- # tools-build (22)
- # vim (8)
- # xtdb (17)
How would I spec an higher order function such as map
. The function parameter passed in should validate against
(s/def ::f (s/fspec :args (s/cat any?) :ret any?))
but if I try to validate (valid? ::f (fn [i] (* i 2)))
then this fails because it will generate non numerical values according to the above spec.yes, I can but then I don’t check that the signature/shape matches. The real signature is something like this:
(s/fspec :args (s/cat :state any?) :res (s/cat :state any :result any?))
I always want to get a vector with 2 or more elements back.I know, it’s much more than a type system! This is the first thing I did find that would be easier with a static type system. That’s why I mentioned it.