Tracks on Tracks on Tracks
Tracks on Tracks on Tracks

Tracks on Tracks on Tracks

Learning Exercise

While completing Tracks on Tracks on Tracks, you'll learn 1 concept


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 six tasks, which will all involve dealing with lists.

1. Create a new list

To keep track of the languages you want to learn, you'll need to create a new list. Define the newList constant that contains a new, empty list.

    --> []

2. Define an existing list

Currently, you have a piece of paper listing the languages you want to learn: Elm, Clojure and Haskell. Define the existingList constant to represent this list.

    --> [ "Elm", "Clojure", "Haskell" ]

3. Add a new language to a list

As you explore Exercism and find more interesting languages, you want to add them to your list. Implement the addLanguage function to add a new language to the beginning of your list.

addLanguage "TypeScript" [ "JavaScript", "CoffeeScript" ]
    --> [ "TypeScript", "JavaScript", "CoffeeScript" ]

4. Count the languages in the list

Counting the languages manually is inconvenient. Implement the countLanguages function to count the number of languages on your list.

countLanguages [ "C#", "Racket", "Rust", "Ruby" ]
    --> 4

5. Reverse the list

At some point, you realize that your list is actually ordered backwards! Implement the reverseList function to reverse your list.

reverseList [ "Prolog", "C", "Idris", "Assembly" ]
    --> [ "Assembly", "Idris", "C", "Prolog" ]

6. Check if list is exciting

While you love all languages, Elm has a special place in your heart. As such, you're really excited about a list of languages if:

  • The first item on the list is Elm.
  • Or the second item on the list is Elm and the list contains three or less languages.

Implement the excitingList function to check if a list of languages is exciting:

excitingList [ "Nim", "Elm" ]
    --> True
Last updated 5 December 2021
Edit via GitHub The link opens in a new window or tab
Elm Exercism

Ready to start Tracks on Tracks on Tracks?

Sign up to Exercism to learn and master Elm with 8 concepts, 55 exercises, and real human mentoring, all for free.