Skip to content

Instantly share code, notes, and snippets.

@prajwalit
Created August 29, 2011 16:44
Show Gist options
  • Save prajwalit/1178799 to your computer and use it in GitHub Desktop.
Save prajwalit/1178799 to your computer and use it in GitHub Desktop.
Convert map to querystring
(defn map->querystring [params]
(str
"?"
(reduce
#(str % "&" %2)
(map
#(str (first %) "=" (second %))
params))))
(map->querystring {"foo" 1 "bar" 2 "baz" "test"})
;; ?foo=1&bar=2&baz=test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment