Skip to content

Instantly share code, notes, and snippets.

@KirinDave
Created June 19, 2012 18:22
Show Gist options
  • Save KirinDave/2955726 to your computer and use it in GitHub Desktop.
Save KirinDave/2955726 to your computer and use it in GitHub Desktop.
Pop quiz, spot the clojure bug
(defn normalize-json-args [map]
(letfn [(keyify [s] (keyword (string/replace s "_" "-")))
(cleaner [[k v]] (if (string? k) [(keyify k) v] [k v]))
(walker [x] (if (map? x) (into {} (map cleaner x)) x))]
(postwalk walker map)))
@fooblahblah
Copy link

Rename the "map" arg to "a" and change (postwalk walker map) to (postwalk walker a)

?

@KirinDave
Copy link
Author

KirinDave commented Jun 19, 2012 via email

@fooblahblah
Copy link

fooblahblah commented Jun 19, 2012 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment