Isogram

Isogram

Easy

Instructions

Determine if a word or phrase is an isogram.

An isogram (also known as a "non-pattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times.

Examples of isograms:

  • lumberjacks
  • background
  • downstream
  • six-year-old

The word isograms, however, is not an isogram, because the s repeats.

This exercise works with textual data. For historical reasons, Haskell's String type is synonymous with [Char], a list of characters. For more efficient handling of textual data, the Text type can be used.

As an optional extension to this exercise, you can

  • Read about string types in Haskell.

  • Add - text to your list of dependencies in package.yaml.

  • Import Data.Text in the following way:

      import qualified Data.Text as T
      import           Data.Text (Text)
    
  • You can now write e.g. isIsogram :: Text -> Bool and refer to Data.Text combinators as e.g. T.toLower.

  • Look up the documentation for Data.Text.

This part is entirely optional.


Source

WikipediaThe link opens in a new window or tab
Edit via GitHub The link opens in a new window or tab
Haskell Exercism

Ready to start Isogram?

Sign up to Exercism to learn and master Haskell with 105 exercises, and real human mentoring, all for free.