Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best way to make dynamic paths #68

Open
nidu opened this issue Sep 21, 2015 · 2 comments
Open

Best way to make dynamic paths #68

nidu opened this issue Sep 21, 2015 · 2 comments

Comments

@nidu
Copy link

nidu commented Sep 21, 2015

Hello,

Excuse me, but it's not clear to me how can i quickly make dynamic paths, could you please show some example?

For example i have resource lie {:a {:b {:c "Hello"} :d {:c "world"}}.
I'd like extract path for either b or d giving this key as an argument.
It would be nice to do something like (t :en :a variable :c) instead of (keyword (str "a/" (name variable) "/c")).

Thanks in advance.

@ptaoussanis
Copy link
Member

Hi Nikolay,

As you're doing now is fine. Otherwise, if you prefer you can use:

(require '[taoensso.encore :as encore :refer [merge-keywords]])
(merge-keywords [:a :b :c :d]) ; => :a.b.c/d

Tower uses encore, so you'll already have this dependency loaded. Does that help?

@nidu
Copy link
Author

nidu commented Sep 23, 2015

Peter, thanks, that's just what i need! Probably it would be nice to mention this approach in readme since making dynamic paths is a common task (as for me) and encore is already shipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants