Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

map over a hash-map, needs to return a hash-map

Tags:

clojure

What the map function will be accepting will be a 'mapping' function and a hash-map. The mapping function will be accepting values of type MapEntry. That is because the collection (hash-map) coming in looks like this: {k v k v k v}, and a MapEntry is this: k v.

I cannot seem to get a {k v k v k v} to be returned. I can easily get ([k v] [k v] [k v]).

like image 666
Chris Murphy Avatar asked Nov 30 '25 03:11

Chris Murphy


1 Answers

I thought of this when just finished typing the question. All you need to do is (into {} ([k v] [k v] [k v])). That will give {k v k v k v}.

like image 105
Chris Murphy Avatar answered Dec 02 '25 03:12

Chris Murphy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!