On Wed, Jan 12, 2011 at 1:03 AM, David J. Hamilton <groups / hjdivad.com> wrote: > Whether this is an inelegance is a matter of taste. ¨Âåòóïîáììæéîä ãïäå ôèáô > does more than it needs to a little confusing, or at least inelegant. indeed > As a matter of performance, it may not matter much in this case, but in general > it is good to know the semantics of break for cases where the transformation > itself is expensive, or if the Enumerable is very large (say, infinite). not sure if this heps the op, but i had something like this in my little lib. the find just uses each w a break, but the break does not return anything (bad experience getting caught w a nasty bug hidden on a break). anyway, it uses lambdas to specify what you want to find/select, and then remap. like so, paths.find_and_remap ->(path){File.exists?(path)}, ->(path){File.join(path,filename)} #=> ["/usr", "/usr/jruby"] (0..10).find_and_remap ->(x){x>5}, ->(x){x*x} #=> [6, 36] (0..10).select_and_remap ->(x){x<5}, ->(x){x*x} #=> [0, 1, 4, 9, 16] the mapping params are optional though. note, i seldom use these because my simple brain prefers to separate the mapping from the selecting.. my main use for them was for debugging/tracing purposes, eg, when the proc finds something, i then let it do some other complex things to verify... best regards -botp