🎉 Exercism Research is now launched. Help Exercism, help science and have some fun at research.exercism.io 🎉
Avatar of meatbot

meatbot's solution

to Isogram in the Erlang Track

Published at Apr 06 2021 · 0 comments
Test suite

Determine if a word or phrase is an isogram.

An isogram (also known as a "nonpattern 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.

Running tests

In order to run the tests, issue the following command from the exercise directory:

For running the tests provided, rebar3 is used as it is the official build and dependency management tool for erlang now. Please refer to the tracks installation instructions on how to do that.

In order to run the tests, you can issue the following command from the exercise directory.

$ rebar3 eunit


For detailed information about the Erlang track, please refer to the help page on the Exercism site. This covers the basic information on setting up the development environment expected by the exercises.


Wikipedia https://en.wikipedia.org/wiki/Isogram

Submitting Incomplete Solutions

It's possible to submit an incomplete solution so you can see how others have completed the exercise.


%% Generated with 'testgen v0.2.0'
%% Revision 1 of the exercises generator was used
%% https://github.com/exercism/problem-specifications/raw/42dd0cea20498fd544b152c4e2c0a419bb7e266a/exercises/isogram/canonical-data.json
%% This file is automatically generated from the exercises canonical data.



'1_empty_string_test_'() ->
    {"empty string", ?_assert(isogram:is_isogram([]))}.

'2_isogram_with_only_lower_case_characters_test_'() ->
    {"isogram with only lower case characters",

'3_word_with_one_duplicated_character_test_'() ->
    {"word with one duplicated character",

'4_word_with_one_duplicated_character_from_the_end_of_the_alphabet_test_'() ->
    {"word with one duplicated character from "
     "the end of the alphabet",

'5_longest_reported_english_isogram_test_'() ->
    {"longest reported english isogram",

'6_word_with_duplicated_character_in_mixed_case_test_'() ->
    {"word with duplicated character in mixed "

'7_word_with_duplicated_character_in_mixed_case_lowercase_first_test_'() ->
    {"word with duplicated character in mixed "
     "case, lowercase first",

'8_hypothetical_isogrammic_word_with_hyphen_test_'() ->
    {"hypothetical isogrammic word with hyphen",

'9_hypothetical_word_with_duplicated_character_following_hyphen_test_'() ->
    {"hypothetical word with duplicated character "
     "following hyphen",

'10_isogram_with_duplicated_hyphen_test_'() ->
    {"isogram with duplicated hyphen",

'11_made_up_name_that_is_an_isogram_test_'() ->
    {"made-up name that is an isogram",
     ?_assert(isogram:is_isogram("Emily Jung Schwartzkopf"))}.

'12_duplicated_character_in_the_middle_test_'() ->
    {"duplicated character in the middle",

'13_same_first_and_last_characters_test_'() ->
    {"same first and last characters",


is_isogram(Phrase) -> is_isogram(string:lowercase([Phrase]), []).

is_isogram([], _) -> true;
is_isogram([$- | T], Acc) -> is_isogram(T, Acc);
is_isogram([$  | T], Acc) -> is_isogram(T, Acc);
is_isogram([H | T], Acc) ->
  case lists:member(H, Acc) of
    true -> false;
    false -> is_isogram(T, [H | Acc])

Community comments

Find this solution interesting? Ask the author a question to learn more.

What can you learn from this solution?

A huge amount can be learned from reading other people’s code. This is why we wanted to give exercism users the option of making their solutions public.

Here are some questions to help you reflect on this solution and learn the most from it.

  • What compromises have been made?
  • Are there new concepts here that you could read more about to improve your understanding?