0

when seq is called on a map, you get a list of pairs -

(seq {:a 4 :b 5}) 
;; => ([:a 4] [:b 5])

but when apply hashmap is called on the list, it does not give back the hashmap but uses the first pair as the key to the second

is there a built in function that returns a map when given a sequence of pairs?

1
  • (hash-map :a 4 :b 5) ;;=> {:a 4, :b 5} Commented Mar 4, 2013 at 18:35

1 Answer 1

3

You can use into:

(into {} (seq {:a 4 :b 5}))
;; => {:a 4 :b 5}
Sign up to request clarification or add additional context in comments.

1 Comment

thanks! its knowing these little things that make all the difference

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.