Created
January 25, 2013 00:55
-
-
Save fogus/4630548 to your computer and use it in GitHub Desktop.
Two patterns that I run into that I can't put a name to.
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
| (set | |
| (mapcat #(... | |
| ... | |
| ;; AND | |
| (into {} | |
| (map #(vector ... |
@ericnormand Too bad we're not at the function level; the machine could find equivalents for us :-)
@stuartsierra points out that what I called mapsoc already exists. It's called zipmap.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know you're not looking for ways to extract a function out of it, but it helps me to do that to figure out the name.
I do the second one all the time. Maybe it should be called
mapsoc? (As inmapandassoc)The first one is a little more rare for me, probably because I am trying to use
formore than map. I usually end up with this similar construction:Perhaps it should be something like
Union(as in, big U notation to mean union of many sets). But I don't like capitals, so we should sayunion-of: