Return is s1 \ s2
777773
public static <T> Set<T> difference(Collection<? extends T> s1, Collection<? extends T> s2) {
        Set<T> s3 = new HashSet<>(s1);
        s3.removeAll(s2);
        return s3;
    }
1210682
def lcp(s1, s2):
    '''
    '''
    i = 0
    for i, (c1, c2) in enumerate(zip(s1, s2)):
        if c1 != c2:
            return i
    return min(len(s1), len(s2))
1121567
def to_twos_comp(val, bits):
    """"""
    if not val.startswith('-'):
        return to_int(val)
    value = _invert(to_bin_str_from_int_string(bits, bin(to_int(val[1:]))))
    return int(value, 2) + 1
245146
def strand(s1, s2):
    
    return "".join(map(lambda x,y:chr(ord(x)&ord(y)), s1, s2))
831638
function stringRepeatRep(s, times) {
                var half,
                    val;

                if (times < 1) {
                    val = '';
                } else if (times % 2) {
                    val = stringRepeatRep(s, times - 1) + s;
                } else {
                    half = stringRepeatRep(s, times / 2);
                    val = half + half;
                }

                return val;
            }
818615
def _match(self, struct1, struct2, fu, s1_supercell=True, use_rms=False,
               break_on_match=False):
        
        ratio = fu if s1_supercell else 1/fu
        if len(struct1) * ratio >= len(struct2):
            return self._strict_match(
                struct1, struct2, fu, s1_supercell=s1_supercell,
                break_on_match=break_on_match, use_rms=use_rms)
        else:
            return self._strict_match(
                struct2, struct1, fu, s1_supercell=(not s1_supercell),
                break_on_match=break_on_match, use_rms=use_rms)
988650
def diffcolor(s1, s2):
    '''  '''
    string = ''
    for line in diff(s1, s2):
        if line[0] == '-':
            string += ' ' + TermColors.red(line[2:])
        elif line[0] == '+':
            string += ' ' + TermColors.green(line[2:])
        else:
            string += ' ' + line
    return string[1:]
574647
def match(self, s):
      
      self.matches = self.re.search(s)
      return self.matches
800080
def bin(self, s):
        
        return str(s) if s<=1 else bin(s>>1) + str(s&1)
1150462
def match(self, other):
        """"""

        if len(self) != len(other):
            raise ValueError()
        for s1, s2 in zip(self, other):
            i = s2.position - s1.position
            if i < 0:
                return False
            n = len(s1)
            while i+n > len(s2) and s1[n-1] == syntax.BLANK:
                n -= 1
            if s2.values[i:i+n] != s1.values[:n]:
                return False
        return True
257506
def content_item(path1, path2, path_sep='/'):
    
    p1_parts = path1.split(path_sep)
    p2_parts = path2.split(path_sep)
    # special case when path1 is root
    if path1 == path_sep and len(p2_parts) >= 2:
        return p2_parts[1]
    if len(p2_parts) <= len(p1_parts):
        return ''
    for i, item in enumerate(p1_parts):
        if item != p2_parts[i]:
            return ''
    return p2_parts[i+1]
1002337
def _break(s, find):
    """"""
    i = s.find(find)
    return s[:i], s[i:]
407286
def defverb(self, s1, p1, s2, p2, s3, p3):
        
        self.checkpat(s1)
        self.checkpat(s2)
        self.checkpat(s3)
        self.checkpatplural(p1)
        self.checkpatplural(p2)
        self.checkpatplural(p3)
        self.pl_v_user_defined.extend((s1, p1, s2, p2, s3, p3))
        return 1
465637
def restore(s, t):
    
    t = (c for c in t)
    return ''.join(next(t) if not is_blacksquare(c) else c for c in s)
1277304
public static boolean simpleNameEquals(String s1, String s2) {
		if (isNullOrEmpty(s1)) {
			return isNullOrEmpty(s2);
		}
		return s1.equals(s2);
	}
322607
function(s1, s2, v, d) { 
				var s = {}, val, p;
				for (p in s2) {
					if (p !== "cssText") if (p !== "length") if (isNaN(p)) if (s1[p] != (val = s2[p])) if (val !== _transformProp) if (typeof(val) === "number" || typeof(val) === "string") {
						s[p] = ((val === "" || val === "auto") && typeof(s1[p]) === "string" && s1[p].replace(_NaNExp, "") !== "") ? 0 : val; //if the ending value is defaulting ("" or "auto"), we check the starting value and if it can be parsed into a number (a string which could have a suffix too, like 700px), then we swap in 0 for "" or "auto" so that things actually tween.
						if (d) {
							d.props.push(p);
						}
					}
				}
				if (v) {
					for (p in v) { //copy properties (except className)
						if (p !== "className") {
							s[p] = v[p];
						}
					}
				}
				return s;
			}
1127895
function(o, s) {
    s = s.replace(/\[(\w+)\]/g, '.$1');
    s = s.replace(/^\./, '');
    var a = s.split('.');
    for (var i = 0, n = a.length; i < n; ++i) {
        var k = a[i];
        if (k in o) {
            o = o[k];
        } else {
            return;
        }
    }
    return o;
}