sets.filter?

G

Gerrit Holl

Hi,

would it be a good idea to add a .filter() method to a set object,
which behaves like the builtin filter() but resulting in a set?
I often see myself doing sets.Set(filter(f, someset))... Would this
be a good addition to sets.Set?

yours,
Gerrit.

--
2. If any one bring an accusation against a man, and the accused go to
the river and leap into the river, if he sink in the river his accuser
shall take possession of his house. But if the river prove that the
accused is not guilty, and he escape unhurt, then he who had brought the
accusation shall be put to death, while he who leaped into the river shall
take possession of the house that had belonged to his accuser.
-- 1780 BC, Hammurabi, Code of Law
 
J

Jeremy Fincher

Gerrit Holl said:
would it be a good idea to add a .filter() method to a set object,
which behaves like the builtin filter() but resulting in a set?
I often see myself doing sets.Set(filter(f, someset))... Would this
be a good addition to sets.Set?

Yes, it'd be a great idea. filter/map/reduce should've been methods
on sequences from the beginning.

Jeremy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top