Fork me on GitHub
#clojuredesign-podcast
<
2019-10-11
>
jumar18:10:17

I think Chris mentioned recently there's no short way how to get namespace of a keyword. Maybe I'm misinterpreting him but if not then there's the the namespace function:

(namespace :ahoj/key)
;;=> "ahoj"

neumann17:10:01

Sounds like I wasn't totally clear. I was trying to say, there isn't a short way to get a string for a keyword that includes the namespace.

neumann17:10:26

When I want :foo/bar to become "foo/bar".

neumann17:10:54

The best way I've found thus far is:

user=> (subs (str :foo/bar) 1)
"foo/bar"

neumann17:10:26

Because:

user=> (str :foo/bar)
":foo/bar"

jrwdunham12:10:27

(->> :foo/bar ((juxt namespace (constantly \/) name)) (apply str))

jrwdunham12:10:49

because baroque

neumann15:10:15

@UCSDH9JQ7 That's fun! And yes, baroque. 🙂

👍 4
spfeiffer19:10:32

BTW, Gene Kim (The Phoenix Project) recommends the podcast: https://itrevolution.com/love-letter-to-clojure-part-1/ (Near the end)

nate22:10:29

Oh wow, that's great!

nate22:10:59

Many many words, I'll have to read it this evening. Thanks for the tip @U067P1FT2

spfeiffer04:10:30

Its a great article, but longish, yes. Many resources given.

neumann17:10:14

@U067P1FT2 Thanks for the heads up! That's a great read!

genekim15:10:29

Thanks for the kind words, all! I can’t overstate how fantastic @U0510902N your work has been in helping me understand and better use Clojure — keep up all the amazing work!

neumann15:10:41

@U6VPZS1EK Thank you so much! Hearing that is huge for me!