Fork me on GitHub
#malli
<
2021-04-14
>
ikitommi04:04:23

@qythium looks like a bug in parsing entries.

ikitommi04:04:40

weird thing that haven’t bumped into it before.

Setzer2208:04:59

I was wondering, is there dedicated support in function schemas to handle things like (fn [a, b, & {:keys [c, d]}) I'd like to be able to do: (m/=> fn-name [:=> [:cat Foo, Bar, [:map?? [:c Baz] [:d Other]]]]

Setzer2208:04:26

I couldn't find something to put in place of :map?? in my example

nilern09:04:07

I don't think so You could do [:cat Foo, Bar, [:* [:alt [:cat [:= :c] :any] [:cat [:= :d] :any]]]] (permits duplicates, but so does the fn itself)

nilern09:04:27

It would be good to have something more convenient especially with Clojure 1.11: https://clojure.org/news/2021/03/18/apis-serving-people-and-programs

nilern09:04:09

Like [:cat Foo, Bar, [:alt [:* [:alt [:cat [:= :c] :any] [:cat [:= :d] :any]]] [:map [:c {:optional true} :any] [:d {:optional true} :any]]] or something can handle the 1.11 feature as well but who likes to write it even once

nilern09:04:07

You could write your own utility fn to generate that but really it should be built in to the fn schemas somehow

ikitommi09:04:33

maybe: [:cat Foo, Bar, [:& [:c Baz] [:d Other]]]?

nilern09:04:52

But it does not do normal varargs so :& could be confusing. :&n?