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

Content added Content deleted
(→‎Python :: Functional: Updated alternative to sort+group :: folding a string down to a dictionary with reduce.)
(→‎{{header|Haskell}}: Edit to preamble of alternative draft (fold string to Map))
Line 509: Line 509:
"1234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ" (36) -> '0' (0x30) at 9, 24</pre>
"1234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ" (36) -> '0' (0x30) at 9, 24</pre>



Or perhaps, as an alternative to grouping and sorting:
Or, as an alternative to grouping and sorting – folding a string down to a Map of indices:
<lang haskell>import qualified Safe as S
<lang haskell>import qualified Safe as S
import qualified Data.Map.Strict as M
import qualified Data.Map.Strict as M