Basic set operations?

# Hemanth H.M (11 years ago)

Would it be useful to implement basic set operations as below?

  • merge
  • subset?
  • superset?
  • union
  • intersection
  • complements
  • difference
  • cartesian
  • copy

So on?

# Barronville, Jonathan (11 years ago)

Yes ... +++1.

# Calvin Metcalf (11 years ago)

If you would like to help write a library for them

calvinmetcalf/set.up

Another idea would be a generic collections API for maps, sets, arrays, and other types of collections down the line like queues, trees, tries, etc

# Hemanth H.M (11 years ago)

Yup, a generic collection API.

# Calvin Metcalf (11 years ago)

Many of the Set specific methods would also be useful if they worked on the keys of Maps.

# Erik Arvidsson (11 years ago)

Most of these could just be methods of iterators and then they could be used for different data structures seemlessly.

# Tab Atkins Jr. (11 years ago)

In other words, just look at what Python did, and only change things when you're sure there was a mistake; Python got a lot of this correct from the start, and the legacy cruft is pretty minimal.

# Hemanth H.M (11 years ago)

Holy goodness www.collectionsjs.com