Fork me on GitHub
#clojuredesign-podcast
<
2019-10-14
>
borkdude14:10:19

@jumar I think he meant getting only the key-vals from a map with a certain namespace, if I recall correctly

jumar15:10:33

Yep, I thought there were actually two different things he mentioned. I guess that's because they prefer flattened maps instead of nested where you can easily just pick the subset represented by a single key

neumann17:10:45

Yes. Both problems. 1. Round-tripping namespaced keys through strings (because we have to go through JSON a lot) 2. Picking out all the key-value pairs that share a common namespace. Like a "select-keys" but for all keys matching a namespace.

borkdude14:10:40

at the same time I wondered why one would do that. it's not something I've probably done a lot

nate17:10:57

yes, that is correct

nate17:10:41

it might be useful to have a function for extracting all the keys with a given namespace, but I also haven't needed that very much

nate17:10:14

it might be nice for printing out a map if the keys were sorted by namespace

neumann17:10:56

Just to put an example out there....

{:league/id "TLA"
   :division/id :north-west
   :team/id 87
   :player/id 42
   :player/name "shooter"
   :player/role :dps}

neumann17:10:06

We end up with lots of data like that.

neumann17:10:24

And then we have stages in our pipeline that might enrich that with more dimensions.

neumann17:10:15

Eg., we may mix in something like the team's name

:team/name "The Mighty Dragons"

neumann17:10:53

So that "record" describes a bunch of dimensions that are applicable to that player.

neumann17:10:57

I'd love a function that allows me to pull out all the player/... key-value pairs.