-
Notifications
You must be signed in to change notification settings - Fork 435
Update applying-functions-to.asciidoc #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Example definition of map-kv via reduce-kv
Example use of map-kv
Added require to alias clojure.string
golf to conj
simplified example string parsing
threading
Great little example. Could you move the old original reduce-kv above your addition? The only other thing I need is a license assignment and we can merge this. |
Ok, I've never used github before, so I may need to play around a little. My licensing will be as in free beer, so you are free to modify anything as you see fit. I'll find the way to plug that in. Likewise I noted (and was trying to get a handle on) the fact that "merge" doesn't do the "bubble-max-key" or "clojure.set/difference" performance hacks. It's probably not germane to a simple example, but could be important for large maps. As as side note I've also been playing around with "sorted-map-by" which seems to give people trouble on the internet. The "compare-key-index" function is odd b/c it takes two keys not two pairs. Here's an example snippet demonstrating my understanding. I'll find some where to patch this stuff in. (defn make-keyword [s n](keyword %28str s n%29)) (defn pairs (defn key-index [k](-> k str %28subs 2%29 Long.)) (defn compare-key-index [k1 k2](compare %28key-index k1%29 %28key-index k2%29)) (defn sorted-pairs [& mps](reduce #%28into %1 %2%29 %28sorted-map-by compare-key-index%29 mps)) (sorted-pairs (take 2 (pairs)) (take 2 (pairs 1 2)))On Aug 1, 2013, at 6:03 PM, Ryan Neufeld notifications@github.com wrote:
|
You'll just need to include a commit in this pull request where you
This might be worthy of an AsciiDoc Sidebar block on large maps. It'd be best to work on that in a separate branch/pull-request though. |
I added the license agreement and reordered the reduce-kv addition. I'll put other suggestions in distinct patch branches. On Aug 2, 2013, at 9:01 AM, Ryan Neufeld notifications@github.com wrote:
|
Thanks |
Update applying-functions-to.asciidoc
Example definition of map-kv via reduce-kv