From: Timothy Hunter Date: 2006-11-26T08:53:00+09:00 Subject: Re: ruby and list comprehension Brad Tilley wrote: > In Python, I can do this to arrays: > > added = [x for x in new_data if x not in old_data] > removed = [x for x in old_data if x not in new_data] > same = [x for x in new_data if x in old_data] > > I believe this is known as list comprehension in Python. How is this done in > Ruby? > > Thanks, > Brad > > This question comes up from time to time. You can search the archives of comp.lang.ruby on Google Groups for "list comprehension" to find the previous threads on this topic. http://groups.google.com/group/comp.lang.ruby/search?group=comp.lang.ruby&q=list+comprehension&qt_g=1&searchnow=Search+this+group