clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
kenny 2020-12-16T22:36:11.484400Z

Curious if there are any ideas around how spec2's select would allow for requiring deeply nested keys based on some dispatch function? e.g., (if the event is type "a" then a specific set of keys are required, if event type is "b" then ...)

dgb23 2020-12-16T23:47:49.485900Z

@kenny if I understand correctly select is there to be used in specific contexts. Not sure if that answers your question.

alexmiller 2020-12-17T14:46:11.495Z

Two things here - first selects do not currently have the ability to handle maps of colls of maps of ... , only nested maps. That is something we are thinking about though as it is very common. Second, there is not currently any way to indicate any sort of predicate or condition on the nested data like you're talking about but that is something we're thinking about. What you're asking for might be beyond where we end up though, not sure yet.

alexmiller 2020-12-17T14:46:44.495200Z

select is currently only about nested map structures (what keys are provided at each level)

1👍
kenny 2020-12-17T22:24:20.495500Z

> there is not currently any way to indicate any sort of predicate or condition on the nested data like you're talking about but that is something we're thinking about. This sounds exactly like what I'm after 🙂 This is such a big issue for us I may need to tackle it internally for now. Would love to know what those thoughts are. Though, I assume they are not public yet?

alexmiller 2020-12-17T22:59:18.495700Z

sorry, not working on this right now

1
kenny 2020-12-16T23:49:03.486Z

No. Essentially I'm curious what the story is wrt deeply nested multi-spec and select since that is a common use case.