clojuredesign-podcast

Discussions around the Functional Design in Clojure podcast - https://clojuredesign.club/
borkdude 2019-10-14T14:09:19.004200Z

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

borkdude 2019-10-14T14:09:40.004600Z

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

jumar 2019-10-14T15:23:33.004700Z

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

nate 2019-10-14T17:44:57.005400Z

yes, that is correct

nate 2019-10-14T17:45:41.006100Z

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

nate 2019-10-14T17:46:14.006900Z

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

neumann 2019-10-14T17:51:56.008300Z

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}

neumann 2019-10-14T17:52:06.008600Z

We end up with lots of data like that.

neumann 2019-10-14T17:52:24.009100Z

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

neumann 2019-10-14T17:53:15.009500Z

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

:team/name "The Mighty Dragons"

neumann 2019-10-14T17:53:53.010300Z

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

neumann 2019-10-14T17:55:45.010500Z

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.

neumann 2019-10-14T17:57:57.011600Z

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