In this exercise you'll be writing code to keep track of a list of programming languages you want to learn on Exercism.
You have nine tasks, which will all involve dealing with lists.
To keep track of the languages you want to learn, you'll need to create a new list.
Implement the static Languages.NewList()
method that returns a new, empty list.
Languages.NewList()
// => empty list
Currently, you have a piece of paper listing the languages you want to learn: C#, Clojure and Elm.
Please implement the static Languages.GetExistingLanguages()
method to return the list.
Languages.GetExistingLanguages();
// => {"C#", "Clojure", "Elm"}
As you explore Exercism and find more interesting languages, you want to add them to your list.
Implement the static Languages.AddLanguage()
function to add a new language to the end of your list.
Languages.AddLanguage(Languages.GetExistingLanguages(), "VBA");
// => {"C#", "Clojure", "Elm", "VBA"}
Counting the languages one-by-one is inconvenient.
Implement the static Languages.CountLanguages()
method to count the number of languages on your list.
Languages.CountLanguages(Languages.GetExistingLanguages())
// => 3
Implement the static Languages.HasLanguage()
method to check if a language is present.
Languages.HasLanguage(Languages.GetExistingLanguages(), "Elm")
// => true
At some point, you realize that your list is actually ordered backwards!
Implement the static Languages.ReverseList()
method to reverse your list.
Languages.ReverseList(Languages.GetExistingLanguages())
// => {"Elm", "Clojure", "C#"}
While you love all languages, C# has a special place in your heart. As such, you're really excited about a list of languages if:
- The first on the list is C#.
- The second item on the list is C# and the list contain either two or three languages.
Implement the static Languages.ContainsStar()
method to check if a list of languages is exciting:
Languages.ContainsStar(Languages.GetExistingLanguages())
// => true
Please implement the static Languages.RemoveLangage()
method to remove a specified language from the list.
Languages.RemoveLanguage(Languages.GetExistingLanguages(), "Clojure")
// => { "C#", "Elm" }
Please implement the static Languages.EnsureUnique()
method to check if any of the languages is repeated in the list.
The list of languages (i.e. the parameter) is guaranteed not to be empty when this method is called and it doesn't matter if the list is modified.
Languages.EnsureUnique(Languages.GetExistingLanguages())
// => true