Created
June 19, 2012 18:22
-
-
Save KirinDave/2955726 to your computer and use it in GitHub Desktop.
Pop quiz, spot the clojure bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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))) |
Author
KirinDave
commented
Jun 19, 2012
via email
Right. Dang lisp-1s!
…On Jun 19, 2012 12:00 PM, "Jeff Simpson" < ***@***.***> wrote:
Rename the "map" arg to "a" and change (postwalk walker map) to (postwalk
walker a)
?
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/2955726
Heh. I spotted that quickly, but had forgotten how to 'require', 'use'
whatever to verify :) Been a while since I last did Clojure and I could
never remember that shite anyhow...
…On 06/19/2012 01:04 PM, Dave Fayram wrote:
Right. Dang lisp-1s!
On Jun 19, 2012 12:00 PM, "Jeff Simpson" <
***@***.***>
wrote:
> Rename the "map" arg to "a" and change (postwalk walker map) to (postwalk
> walker a)
>
> ?
> ---
>
> Reply to this email directly or view it on GitHub:
> https://gist.github.com/2955726
> ---
>
> Reply to this email directly or view it on GitHub:
> https://gist.github.com/2955726
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment