This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-28
Channels
- # aws (1)
- # aws-lambda (1)
- # beginners (19)
- # boot (7)
- # cider (9)
- # cljs-dev (311)
- # cljsjs (34)
- # cljsrn (8)
- # clojars (7)
- # clojure (41)
- # clojure-argentina (3)
- # clojure-russia (15)
- # clojure-spec (15)
- # clojure-uk (11)
- # clojurescript (83)
- # datomic (45)
- # emacs (7)
- # hoplon (13)
- # klipse (2)
- # lein-figwheel (1)
- # luminus (3)
- # om-next (1)
- # parinfer (5)
- # perun (1)
- # planck (1)
- # reagent (5)
- # spacemacs (2)
- # untangled (1)
- # yada (1)
Ok I've got another fairly dumb question. I have this structure (hashmap?)
{:user {:username "TypicalBot Beta", :id "212016587358601216", :discriminator "5353", :bot true, :avatar "429b59c5cda82f9088e3c076b131913a"}, :roles [], :mute false, :joined_at "2017-01-28T02:56:20.799796+00:00", :guild_id "271063738164051980", :deaf false}
I'm attempting to get the username, and ID, from it (separately)
(get member :user :username)
only outputs the whole user
structure. (get-in member :user :username)
gives me an illegal argment exception "Don't now how to create ISeq from keyword"what am I missing here 😞
Ah so reverse then
the "other" way
I thought get-in was supposed to do that though
Yep, You want to find the :username out of the result structure of the :user function..
Returns the value in a nested associative structure, where ks is a sequence of keys. Returns nil if the key is not present, or the not-found value if supplied.
The wording. I gotta get used to the wording. sequence of keys. (get-in member [:user :username])
of course
I knew it was a derp
Thank you!
@eslachance (get member :user :username)
This doesn’t work for you is because if you look at the docs of get
it looks like this (get map key not-found)
So basically you are implying get me the :user
key from member and if it is not found then return the keyword :username
Also get-in
doesn’t work for you because get-in
takes a vector as the third argument. But I guess you got that figured
Hi, can you read/set ring sessions in this: https://github.com/yogthos/Selmer/issues/73#issuecomment-72556438 ?