@zackbleach: the “your email address doesn’t look like an email address” validation actually doesn’t mark the email invalid if it’s empty
this might make more sense if you consider just the (empty? %)
part of #(or (empty? %) other-stuff)
it’s more like it’s saying, “don’t check the email address with re-seq
if the email address is empty"
it’s like “the email is valid with regard to ‘Please enter an email address’ validation if the email address is not empty. The email address is valid with regard to ‘Your email address doesn’t look like an email address’ if either a) the email address is empty or b) the email address conforms to that regex’"
pretty much the wordiest way I could express it
got it, I’m assuming that "Your email address doesn't look like an email address” will always be checked after "Please enter an email address"
the checks are actually all run independently of each other
what I mean is, they are run in that order but the output of one check doesn’t feed into the input of another
#(or (empty? %) (re-seq #"@" %))
works on (:email your-data)
the (empty? %)
part is checking whether (:email some-map)
is empty
it does that so you don’t get the “your email address doesn’t look…” validation message in addition to “please enter an email address”; if you haven’t entered an email address it’s not really helpful to also say that what you entered doesn’t look like an emaill address
aha, I see! I’d totally forgotten how or
works
that’s clever 🙂
😄
thanks for being patient with the explanation!
np man hope you’re enjoying clojuring 🙂
I’m doing the exercises in the macros chapter, it’s super fun and a bit mind bending 🙂 Cheers for the awesome book!
hi again
someone pleeeease make me start clojuring
I guess if I'd stop doing mundane scripting tasks in Ruby and sh that might help