2

I have 2 list let say list of user (list-usr) and (usr-index), i want to create hash-map from these list much like

(def list-usr [196 186 244])
(def idx-usr  [0 1 2])

how can i form (hash-map {196 0 186 1 244 2}) from 2 list ?

2
  • looks like you need zipmap Commented May 23, 2015 at 10:34
  • :v omg thanks, i thought any "zip" keyword is missing from clojure documentation Commented May 23, 2015 at 10:54

1 Answer 1

5

ByanJati

The function for taking two vectors and interleaving to create hash map is zipmap.

It should provide what you want, keep in mind that you will be using integers as the keys:

(zipmap list-usr idx-usr)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.