code-reviews

gary 2015-06-19T20:16:18.000319Z

destructuring code review: https://gist.github.com/gdeer81/6848b0a8cd5505804063

sveri 2015-06-19T20:23:12.000321Z

@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.

gary 2015-06-19T20:24:51.000322Z

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

ghadi 2015-06-19T20:36:46.000323Z

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

ghadi 2015-06-19T20:37:04.000324Z

peek is O(1) on a vector

ghadi 2015-06-19T20:38:32.000326Z

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

arrdem 2015-06-19T20:39:14.000327Z

gary: IMO the latter is nicer

gary 2015-06-19T20:44:31.000328Z

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

arrdem 2015-06-19T20:45:27.000329Z

@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.

arrdem 2015-06-19T20:46:04.000331Z

In the one case you write a single grammar

arrdem 2015-06-19T20:46:13.000332Z

in the other you write three smaller grammars

arrdem 2015-06-19T20:46:34.000333Z

which in my mind is just more potential failure points

donaldball 2015-06-19T20:54:19.000334Z

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

donaldball 2015-06-19T20:55:03.000335Z

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

gary 2015-06-19T21:07:08.000336Z

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

gary 2015-06-19T21:22:15.000337Z

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

gary 2015-06-19T21:22:32.000338Z

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