Hey there! I was taking a look at the libraries implementation and have a 
few suggestions/questions.

Most importantly, what is going on 
here: 
https://github.com/wtetzner/exploding-fish/blob/master/src/org/bovinegenius/exploding_fish/query_string.clj

It looks like you have written a little mini-library for creating and 
working with association lists. Why on earth would you use association 
lists instead of mas? The seq representation of a map is basically the same.

user=> (seq {"foo" "bar"})
(["foo" "bar"])
user=> (into {} (seq {"foo" "bar"}))
{"foo" "bar"}

As you can see, you can go to and from easily. I bet that entire file could 
be written in a few lines if you just used maps.

Second thing is your (ns ..) declarations.

(ns org.bovinegenius.exploding-fish
  (:use (org.bovinegenius.exploding-fish query-string parser constructor))
  (:require (org.bovinegenius.exploding-fish [path :as path]))
  (:import (java.net URI URL URLDecoder URLEncoder)))

A couple of things here:

- People usually use vectors instead of prefix lists: (:use 
[org.bovinegenius...]

- Don't import a bunch of things on the same line. Instead of (:use 
[org.bovinegenius.exploding-fish query-string parser]), do
  (:use [org.bovinegenius.exploding-fish.query-string :only [..]]
          [org.bovinegenius.exploding-fish.parser :only [..]])

- Based off of the last suggestion, never use :use without using :only. 
Only pull in the vars you need. Pulling in everything makes it 
  impossible to easily track where things come from and impossible to read 
your code. Use either :require or :use with :only.

- This one is entirely personal and totally subjective, but man, I hate 
copyright headers in files. Putting it in the README should
   suffice, right? I don't like having to scroll down to get to code. I 
imagine this entirely personal opinion, but I wanted to complain
   about it regardless. :)

-Anthony

On Sunday, May 6, 2012 3:10:52 PM UTC-5, Walter Tetzner wrote:
>
> I've written a URI library for Clojure, whose functions work on a 
> custom Uri type, java.net.URI, java.net.URL, and java.lang.String. 
> It's intended to make working with URIs less painful. It makes it easy 
> to get at the pieces of a URI, as well as doing functional updates. In 
> particular, it makes it easy to deal with query string parameters. 
>
> The source and some documentation (in the README) can be found at 
> https://github.com/wtetzner/exploding-fish. 
>
> Example usage: 
>
> Access URI pieces: 
> user> (scheme "http://www.example.com/";) 
> "http" 
> user> (scheme (URI. "http://www.example.com/";)) 
> "http" 
> user> (fragment (URL. "http://www.example.com/#fragment";)) 
> "fragment" 
> user> (fragment (uri "http://www.example.com/#fragment";)) 
> "fragment" 
>
> Uri objects behave like maps, but ensure that the values remain 
> consistent: 
> user> (:host (uri "http://www.example.com/";)) 
> "www.example.com" 
> user> (assoc (uri "http://www.example.com/";) :port 8080) 
> #<Uri http://www.example.com:8080/> 
>
> Make functional updates: 
> user> (fragment (uri "http://www.example.com/#fragment";) nil) 
> #<Uri http://www.example.com/> 
> user> (host "http://www.example.com/#fragment"; "www.bovinegenius.org") 
> "http://www.bovinegenius.org/#fragment"; 
> user> (fragment (URI. "http://www.example.com/#fragment";) "it-works- 
> on- 
> java-uris") 
> #<URI http://www.example.com/#it-works-on-java-uris> 
>
> Working with query string parameters: 
> user> (params "http://www.test.net/some/path?x=y&a=w&d%20x=m 
> %3df&a=x&m=2 <http://www.test.net/some/path?x=y&a=w&d%20x=m%3df&a=x&m=2>" 
> "a") 
> ["w" "x"] 
> user> (param "http://www.test.net/some/path?x=y&a=w&d%20x=m 
> %3df&a=x&m=2 <http://www.test.net/some/path?x=y&a=w&d%20x=m%3df&a=x&m=2>" 
> "d x") 
> "m=f" 
> user> (param "http://www.test.net/some/path?x=y&a=w&d%20x=m 
> %3df&a=x&m=2 <http://www.test.net/some/path?x=y&a=w&d%20x=m%3df&a=x&m=2>" 
> "d x" "new-value") 
> "http://www.test.net/some/path?x=y&a=w&d+x=new-value&a=x&m=2"; 
> user> (query-map "http://www.test.net/some/path?x=y&a=w&d%20x=m 
> %3df&a=x&m=2 <http://www.test.net/some/path?x=y&a=w&d%20x=m%3df&a=x&m=2>") 
>
> {"x" "y", "a" "x", "d x" "m=f", "m" "2"}

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

Reply via email to