braveandtrue

https://www.braveclojure.com/
nonrecursive 2016-05-31T00:58:58.000064Z

@zackbleach: the “your email address doesn’t look like an email address” validation actually doesn’t mark the email invalid if it’s empty

nonrecursive 2016-05-31T01:00:53.000066Z

this might make more sense if you consider just the (empty? %) part of #(or (empty? %) other-stuff)

nonrecursive 2016-05-31T01:01:43.000067Z

it’s more like it’s saying, “don’t check the email address with re-seq if the email address is empty"

nonrecursive 2016-05-31T01:03:40.000070Z

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’"

nonrecursive 2016-05-31T01:04:07.000072Z

pretty much the wordiest way I could express it

zackbleach 2016-05-31T01:04:40.000073Z

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"

nonrecursive 2016-05-31T01:04:59.000074Z

the checks are actually all run independently of each other

nonrecursive 2016-05-31T01:05:32.000075Z

what I mean is, they are run in that order but the output of one check doesn’t feed into the input of another

nonrecursive 2016-05-31T01:06:16.000076Z

#(or (empty? %) (re-seq #"@" %)) works on (:email your-data)

nonrecursive 2016-05-31T01:08:02.000077Z

the (empty? %) part is checking whether (:email some-map) is empty

nonrecursive 2016-05-31T01:09:10.000078Z

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

zackbleach 2016-05-31T01:12:50.000079Z

aha, I see! I’d totally forgotten how or works

zackbleach 2016-05-31T01:17:06.000080Z

that’s clever 🙂

nonrecursive 2016-05-31T01:17:14.000081Z

😄

zackbleach 2016-05-31T01:17:26.000082Z

thanks for being patient with the explanation!

nonrecursive 2016-05-31T01:17:54.000083Z

np man hope you’re enjoying clojuring 🙂

zackbleach 2016-05-31T01:20:02.000084Z

I’m doing the exercises in the macros chapter, it’s super fun and a bit mind bending 🙂 Cheers for the awesome book!

2016-05-31T22:40:12.000085Z

hi again

2016-05-31T22:40:20.000086Z

someone pleeeease make me start clojuring

2016-05-31T22:46:47.000087Z

I guess if I'd stop doing mundane scripting tasks in Ruby and sh that might help