3 ms·
You could always look at ClojureScript. I know I am. Array.flat() => flatten Array.flatMap() => mapcat String.trimLeft() => triml, trimr Symbols are g
by filoeleven 7y ago
You could always look at ClojureScript. I know I am.
Array.flat() => flatten
Array.flatMap() => mapcat
String.trimLeft() => triml, trimr
Symbols are great but they’re much more useful when you can write them as (optionally namespaced) literals, which are much faster to work with:
(= :my-key :your-key) ;; false
(= :my-key :my-key) ;; true
Object.entries() and Object.fromEntries() are both covered by (into). You can use (map) and other collection-oriented functions directly with a hashmap, it will be converted to a vector of [k v] pairs for you. (into {} your-vector) will turn it back into a new hashmap.
And...all of these things were already in clojurescript when it was launched back in 2013! Plus efficient immutability by default, it’ll run on IE6, and the syntax is now way more uniform than JS. I’m itching to use it professionally.