In JavaScript, there would be a slight performance hit if you used reduce to perform a map operation because of returning an array each time. However, immutable data structures in other languages (like Clojure's vector) would not really see a performance hit because of how they are stored. You've given me an idea on a follow up post to discuss immutability and lazy vs. eager evaluation. Thanks for the feedback!
In JavaScript, there would be a slight performance hit if you used
reduce
to perform amap
operation because of returning an array each time. However, immutable data structures in other languages (like Clojure'svector
) would not really see a performance hit because of how they are stored. You've given me an idea on a follow up post to discuss immutability and lazy vs. eager evaluation. Thanks for the feedback!Thank you!