This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-11
Channels
- # adventofcode (33)
- # babashka (1)
- # beginners (11)
- # biff (3)
- # calva (2)
- # cider (24)
- # clj-kondo (9)
- # cljfx (5)
- # clojure (39)
- # clojure-austin (2)
- # clojure-europe (11)
- # clojure-nl (1)
- # clojure-norway (22)
- # clojure-uk (10)
- # community-development (18)
- # data-science (24)
- # datahike (3)
- # events (3)
- # hyperfiddle (11)
- # lsp (22)
- # malli (3)
- # matrix (1)
- # off-topic (24)
- # other-languages (3)
- # overtone (7)
- # pathom (5)
- # reitit (2)
- # shadow-cljs (34)
- # sql (20)
- # squint (13)
In all function schema examples I find, like https://github.com/metosin/malli/blob/master/docs/function-schemas.md#function-schemas-1 , there's the keyword :cat
. What is it? I tried to read a blogpost about seqexp which went way over my head. In the example below, it seems just fine to use [:=> :int :int]
instead of [=> [:cat :int] :int]
. Why is the :cat
needed, what does it do?
(defn foo
{:malli/schema [:=> :int :int]}
[x]
(inc x))
(defn foo2
{:malli/schema [:=> [:cat :int] :int]}
[x]
(inc x))
(= (foo2 1) (foo 1)) ;; both work the same
:cat is needed when there is more than one argument expected by the function. this is the way to say "function foo expects two integers"