James Gray
11/12/2007 8:56:00 PM
On Nov 12, 2007, at 2:40 PM, furtive.clown@gmail.com wrote:
> So, to throw this out again --- there should also be Object#as which
> returns the block result (I like the name 'as' but I am not
> particularly attached to it). I can personally attest to its
> usefulness, and I can show reams of examples in addition to the above
> one I gave.
I guess I want to see some more examples, because I'm seriously
doubting the usefulness. The example you showed so far was using it
to create this:
platform_audio_files = audio_stems.map { |f|
f + "." + audio_ext[platform]
}.as { |t|
t + audio_basenames
}.map { |f|
File.join(audio_dir, f)
}
instead of:
platform_audio_files = (audio_stems.map { |f|
f + "." + audio_ext[platform]
} + audio_basenames).map { |f|
File.join(audio_dir, f)
}
I don't really understand what the problem is with the second version
that's shorter and easier for me to understand. If it's the need to
introduce some parentheses into the call chain, we can fix that:
platform_audio_files = audio_stems.map { |f|
f + "." + audio_ext[platform]
}.concat(audio_basenames).map { |f|
File.join(audio_dir, f)
}
So yes, please send more examples as I remain unconvinced.
James Edward Gray II