Details
-
Type:
Enhancement
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
It is useful, to be able to constrain a match on a map value to limit the set of keys present in the value, without enforcing that the keys are all present in the value.
The current :only option, enforces a strict matching of keys.
{{(let [x {:a 1} (match [x] [({:a _ :b _} :only [:a :b])])}} => doesn't match
This came up trying to write a precondition on the argument of a function, which allowed optional keys, but wanted to restrict the overall set of keys.
This is a variant of
MATCH-70. You can not specify that some keys must be present by specifying the key and the specifying that the value of the key is a wildcard.MATCH-70. You can not specify that some keys must be present by specifying the key and the specifying that the value of the key is a wildcard.