Determine if a string has all unique characters: Difference between revisions

m
Line 999:
(i, c), rest = xs[0], xs[1:]
return maybe(go(rest))(
compose(Just, swap, first(cons(i)))
)(find(compose(eq(c), snd))(rest))
else:
Line 1,014:
return repr(s) + ' (' + str(len(s)) + ')'
 
def showDuplicate(ixccix):
ixc, cix = ixccix
return repr(c) + (
' (' + hex(ord(c)) + ') at ' + repr(ix)
Line 1,131:
'''Second member of a pair.'''
return tpl[1]
 
 
# swap :: (a, b) -> (b, a)
def swap(tpl):
'''The swapped components of a pair.'''
return (tpl[1], tpl[0])
 
 
9,659

edits