Subject: map and join or inject?
From: "ako..." <akonsu gmail.com>
Date: Sat, 26 Aug 2006 15:15:03 +0900
hello,
given an array of strings A, i need to map a given function F to each
element of A and concatenate the results.
which way is more memory efficient:
1. A.inject("") { |t,x| t + F(x) }
2. (A.map { |x| F(x) }).join
thanks
konstantin