Closed viebel closed 3 years ago
If you look far enough back in git for this project, I remember having them in here at one point. But I took them out for Simplicity sake, but I can break that down into some reasons:
So, it was a lot of complexity without a lot of value. It was also a little unsafe if you had a map with the same type for keys and values. Like a Map<String,String>, there was no visual indicator what were keys and what were values. The "tup()" shows the pairs unambiguously.
I understand that there are situations where what you are asking for is advantageous. It's not that hard to write your own functions:
public static Map<K,V> map(K k1, V v1) { return map(tup(k1, v1)); }
public static Map<K,V> map(K k1, V v1, K k2, V v2) { return map(tup(k1, v1), tup(k2, v2)); }
If you like brevity, you can even call them m() instead of map().
THat is why I'm closing this with a "wontfix."
Makes sense. Thank you for the clarification!
It would be great to have a way to create a map without wrapping the keys and values in a tuple, similar to Java
Map.of
, as @ericnormand suggested in Clojureverse.For example, instead of creating a nested map like this:
we would be able to create it like that (a bit less verbose):