Other Nim solutions.
import sets, unicode, sequtils, sugar
proc isIsogram*(str: string): bool =
var seen: HashSet[Rune] = initHashSet[Rune]()
for c in toLower(str).toRunes.filter(c => c.isAlpha):
if seen.containsOrIncl(c):
return false
return true
Other Elm solutions.
module Isogram exposing (isIsogram)
import Set
isIsogram : String -> Bool
isIsogram sentence =
let
letters =
sentence
|> String.toList
|> List.map Char.toLower
|> List.filter Char.isAlpha
in
List.length letters == Set.size (Set.fromList letters)
Other Roc solutions.
module [isIsogram]
isIsogram : Str -> Bool
isIsogram = \phrase ->
sanitized =
phrase
|> Str.toUtf8
|> List.map toLowerCase
|> List.keepIf isAlpha
List.len sanitized == Set.fromList sanitized |> Set.len
isAlpha = \char ->
lower = toLowerCase char
lower >= 'a' && lower <= 'z'
toLowerCase = \char ->
when char is
_ if char >= 'A' && char <= 'Z' -> char + 32
_ -> char