This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-28
Channels
I’m trying to use regex ops and running into some problems. I have two data structures naturally represented by a regex, the main one is of the shape: a*c
, in my map data structure in order to get the item at that location, the get-in
path is something like (ab)*c
— it seems that the problem is that nested regex operators “merge”; so now for a fn that takes a*c
and returns (ab)*c
, I can’t specify its :args
as (s/cat :a ::a)
— does that make sense?
Looks like that’s intentional; found it in the guide 🙂 > When regex ops are combined, they describe a single sequence. If you need to spec a nested sequential collection, you must use an explicit call to spec to start a new nested regex context. For example to describe a sequence like [:names ["a" "b"] :nums [1 2 3]], you need nested regular expressions to describe the inner sequential data:
That's intended
potetm: you can use s/and
@gfredericks perfect; just figured that out 🙂