This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-24
Channels
- # beginners (19)
- # boot (118)
- # capetown (4)
- # cider (37)
- # cljs-dev (69)
- # cljsjs (23)
- # clojure (212)
- # clojure-austin (10)
- # clojure-india (3)
- # clojure-italy (2)
- # clojure-mke (1)
- # clojure-nl (1)
- # clojure-russia (5)
- # clojure-spec (52)
- # clojure-uk (86)
- # clojurescript (31)
- # core-async (9)
- # cursive (123)
- # datomic (91)
- # emacs (22)
- # events (3)
- # hoplon (68)
- # klipse (4)
- # lambdaisland (10)
- # leiningen (2)
- # off-topic (14)
- # om (14)
- # onyx (44)
- # perun (14)
- # proton (20)
- # re-frame (15)
- # reagent (10)
- # ring-swagger (9)
- # specter (18)
- # untangled (3)
- # vim (26)
- # yada (4)
Hey, I'm looking for a way to replace a single nested value {:one #{:two}} with a splattered list of values {:one #{1 2 3 4}} using transform
Not sure if thats possible
Hey James, I need the to be a result of a function call (transformation) and not a static value like in setval
So In my case I'm transforming the keys into a list of vectors for example (tranform [:one :two] (fn [_] [[1 2] [3 4]]) {:one #{:two}}) I would like to get {:one #{[1 2] [3 4]}}
And not {:one #{[[1 2] [3 4]]}}
Its looks like partial flatten but I didn't manage to come without any working example
@narkisr I think you're looking for this: (transform [:one (subset #{:two})] (fn [_] #{[1 2] [3 4]}) {:one #{two}})
@narkisr Do you actually want the inner data structure to be a set? Because you’re trying to access it like a hashmap (with a keyword), and talking about “transforming keys".
The actual code contains a hash which values are days like :sunday which I want so substitute for all the Sundays within a month (so you get multiple values out from a single value)
A set matches this use since the values are always unique
Thanks Natan ill give it a go
for example {:foo #{:sunday}} => {:foo #{[1 1] [8 1] [15 1] [22 1] [29 1]}
all the Sundays in Jan 2017