This is one of the beauties of Clojure’s spec. You can define a ‘type’ that is a string which length is a prime number and contains only Ascii characters but ‘x’. To put those invariants in code and not in your head is so liberating.
Don't know anything about clojure, but isnt this true with any language or library that implements schema validation? I'm thinking zod, for instance. Does clojure make it trivial?