On 7 April 2011 20:03, Joost <jo...@zeekat.nl> wrote: > Yup. I'm mostly in the same boat. That's why all the predicates I've > produced for now are in the pretzel.strings namespace. I expect to end > up with few non-string predicates, but those will have to go into > pretzel.numbers or whatever make sense.
What about predicates that operate on numbers encoded as strings? e.g. "1" or "4.2". > For your specific example of (integer-string? "foo"), that should > just return false. The idea - for strings - is that any kind of input > string can be supplied, and the function should just test whether it > conforms to some kind of formatting. The same logic should, I think, > apply to functions operating on numbers and other types such as files, > if there's a need for those kinds of predicates. I think we differ a little in our end goals, then. I'm less concerned about general use, and more concerned about generating good error messages for form-data validation. For instance, with normal predicates, one might get error messages like: {:score ["is not present" "is not an integer" "is not between 1 and 10"]} But in my view, it would be better to have a error message like: {:score ["is not present"]} Because if a value is blank, there's no point in telling the user it's also not an integer or between a certain range. Also, one might have integer fields that can be blank. So I think Valip needs its own predicate library, but I can probably factor out a lot of the general stuff to Pretzel (e.g. email-address? integer? etc.) - James -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en