Fork me on GitHub
#code-reviews
<
2015-06-19
>
sveri20:06:12

@gary: For me this is more about having 3 regex vs one regex and readability of the regexes in question. Regarding that, I'd prefer te first one as I find it always hard to parse regex generally.

gary20:06:51

that's true, if I were to come back to this in a week I'd probably be squinting really hard to parse it in my head

ghadi20:06:46

don't use last, it is O(n)

ghadi20:06:04

peek is O(1) on a vector

ghadi20:06:32

totally a generalization ^, only applies if you know the code is hot

arrdem20:06:14

gary: IMO the latter is nicer

gary20:06:31

@arrdem: I also like it but I am biased because I spent all that time writing the long regex string

arrdem20:06:27

@gary: my reasoning is that it's easier to write a single regexp that matches the entire interesting language and then select the interesting subterms than to write N regexps that match only the interesting substrings.

arrdem20:06:04

In the one case you write a single grammar

arrdem20:06:13

in the other you write three smaller grammars

arrdem20:06:34

which in my mind is just more potential failure points

donaldball20:06:19

Any particular reason you don't parse the URI and query-string using dedicated objects/fns?

donaldball20:06:03

java.net.URI. and ring.util.codec/decode-form

gary21:06:08

because I'm translating poorly written java into naively written clojure

gary21:06:15

also, I'm not parsing in a web server or anything like that

gary21:06:32

I'm getting a big blob of text and having to parse through it to get the urls