inspired by http://docs.python.org/2/library/sets.html
197777
function set() {
    function Set() {}
    var ret = new Set();
    var arg, i, len;

    for(i = 0, len = arguments.length; i < len; i++) {
        arg = arguments[i];

        if(arg.constructor.name == 'Set') Object.keys(arg).filter(
            not(prop.bind(undefined, ret))
        ).forEach(addElem.bind(undefined, ret));
        else if(!(arg in ret)) addElem(ret, arg);
    }

    return Object.preventExtensions(ret);
}
60676
function createSet(values) {
    var set = new Set();
    Lazy(values || []).flatten().each(function(e) {
      set.add(e);
    });
    return set;
  }
455980
def visit_Set(self, node):
        
        self.generic_visit(node)
        if node.elts:
            for elt in node.elts:
                self.combine(node, elt, unary_op=self.builder.SetType)
        else:
            self.result[node] = self.builder.NamedType(
                "pythonic::types::empty_set")
522117
function(setA, setB, property1, property2){
	// p for param
	// v for value
	var numProps = numericProperties(setA, setB, property1, property2);
	var sAv1 = numProps.sAv1,
		sAv2 = numProps.sAv2,
		sBv1 = numProps.sBv1,
		sBv2 = numProps.sBv2,
		count = sAv2 - sAv1 + 1;

	var after = {
		difference: [sBv2+1, sAv2],
		intersection: [sAv1,sBv2],
		union: [sBv1, sAv2],
		count: count,
		meta: "after"
	};
	var before = {
		difference: [sAv1, sBv1-1],
		intersection: [sBv1,sAv2],
		union: [sAv1, sBv2],
		count: count,
		meta: "before"
	};

	// if the sets are equal
	if(sAv1 === sBv1 && sAv2 === sBv2) {
		return {
			intersection: [sAv1,sAv2],
			union: [sAv1,sAv2],
			count: count,
			meta: "equal"
		};
	}
	// A starts at B but A ends later
	else if( sAv1 === sBv1 && sBv2 < sAv2 ) {
		return after;
	}
	// A end at B but A starts earlier
	else if( sAv2 === sBv2 && sBv1 > sAv1 ) {
		return before;
	}
	// B contains A
	else if( within(sAv1, [sBv1, sBv2]) && within(sAv2, [sBv1, sBv2]) ) {
		return {
			intersection: [sAv1,sAv2],
			union: [sBv1, sBv2],
			count: count,
			meta: "subset"
		};
	}
	// A contains B
	else if( within(sBv1, [sAv1, sAv2]) && within(sBv2, [sAv1, sAv2]) ) {
		return {
			intersection: [sBv1,sBv2],
			// there is a difference in what A has
			difference: [null, null],
			union: [sAv1, sAv2],
			count: count,
			meta: "superset"
		};
	}
	// setA starts earlier and overlaps setB
	else if(sAv1 < sBv1 && within(sAv2, [sBv1, sBv2]) ) {
		return before;
	}
	// setB starts earlier and overlaps setA
	else if(sBv1 < sAv1 && within(sBv2, [sAv1, sAv2]) ) {
		return after;
	}
	// side by side ... nothing intersection
	else if(sAv2 === sBv1-1) {
		return {
			difference: [sAv1,sAv2],
			union: [sAv1, sBv2],
			count: count,
			meta: "disjoint-before"
		};
	}

	else if(sBv2 === sAv1 - 1) {
		return {
			difference: [sAv1,sAv2],
			union: [sBv1, sAv2],
			count: count,
			meta: "disjoint-after"
		};
	}
	if(!isNaN(count)) {
		return {
			count: count,
			meta: "disjoint"
		};
	}

}
432262
function setCardCodes(set) {
  const codeSet = new Set()
  for (const v of set) codeSet.add(cardCode(v))
  return codeSet
}
146732
def setter(self, fset):
        
        self.fset = fset
        self.pipe_write = PipeWriteType.PIPE_READ_WRITE
        return self
60288
def to_set(self):
        '''
        '''
        if self.closed():
            raise ValueError("Attempt to call to_set() on a closed Queryable.")

        if isinstance(self._iterable, set):
            return self._iterable
        s = set()
        for item in self:
            if item in s:
                raise ValueError("Duplicate item value {0} in sequence "
                    "during to_set()".format(repr(item)))
            s.add(item)
        # Ideally we would close here
        #self.close()
        return s
24813
def _find_set_members(set):
    '''
    
    '''

    cmd = '{0} list {1}'.format(_ipset_cmd(), set)
    out = __salt__['cmd.run_all'](cmd, python_shell=False)

    if out['retcode'] > 0:
        # Set doesn't exist return false
        return False

    _tmp = out['stdout'].split('\n')
    members = []
    startMembers = False
    for i in _tmp:
        if startMembers:
            members.append(i)
        if 'Members:' in i:
            startMembers = True
    return members
444679
def create(self, set):
        
        target_url = self.client.get_url('SET', 'POST', 'create')
        r = self.client.request('POST', target_url, json=set._serialize())
        return set._deserialize(r.json(), self)
1108173
def index_sets(self, as_set=False):
        """"""
        indexes = frozenset if as_set else tuple
        return [indexes(b.iter_set()) for b in self]
285456
def powerset(iterable):
    ""
    s = list(set(iterable))
    combs = chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
    res = set(frozenset(x) for x in combs)
    # res = map(frozenset, combs)
    return res
859866
def combine_sets(*sets):
    
    combined = set()
    for s in sets:
        combined.update(s)
    return combined
97190
def parse_set(string):
    """"""
    string = string.strip()
    if string:
        return set(string.split(","))
    else:
        return set()
22865
def ranges_to_set(lst):
    
    return set(itertools.chain(*(range(x[0], x[1]+1) for x in lst)))
73503
def get_kwargs_set(args, exp_elem2dflt):
    """"""
    arg_set = set()  # For arguments that are True or False (present in set if True)
    # Add user items if True
    for key, val in args.items():
        if exp_elem2dflt is not None and key in exp_elem2dflt and val:
            arg_set.add(key)
    # Add defaults if needed
    for key, dfltval in exp_elem2dflt.items():
        if dfltval and key not in arg_set:
            arg_set.add(key)
    return arg_set
659806
function handleSet(setFnName) {
  return function() {
    var args = Array.prototype.slice.call(arguments);
    return match(args, function(when) {
      when([
          function(sym) {
            return sym.value === setFnName;
          },
          match.var("key", match.any),
          match.var("arrayname", match.any),
          match.var("valexpr", match.any)
        ],
        function(vars) {
          return (function(key, arrayname, valexpr) {
            return sl.generated([
              this.x(arrayname), "[", this.x(key), "] = ", this.x(valexpr)
            ]);
          }).call(this, vars["key"], vars["arrayname"], vars["valexpr"]);
        }, this);
      when([
          function(sym) {
            return sym.value === setFnName;
          },
          match.var("varexpr", match.any),
          match.var("valexpr", match.any)
        ],
        function(vars) {
          return (function(varexpr, valexpr) {
            return sl.generated([
              this.x(varexpr), " = ", this.x(valexpr)
            ]);
          }).call(this, vars["varexpr"], vars["valexpr"]);
        }, this);
      when([
          match.var("any", match.lsdefault)
        ],
        function(vars) {
          return (function(any) {
            return this.error('invalid arguments for ' + setFnName);
          }).call(this, vars["any"]);
        }, this);
    }, this)
  };
}
1172963
def sets(opts = {}, &block)
      arry = client.list_sets.full.to_a
      return arry unless block_given?
      arry.map(&block)
    end