1.4

Conventions Used in This Book

Most conventions used in the book should be self-explanatory. Listed below are some that might be a bit confusing.

Terminal

We will be using the term terminal throughout the book to mean a program that lets you type and execute textual commands. If you come from Unix background, this term should already be familiar to you. But, if you come from Windows background, you can mentally replace it with command prompt.

Note: Unix refers to a family of operating systems that includes macOS and Linux.

Commands

This book presents many commands that are run from the terminal. For simplicity, all command examples use the $ sign which is common in Unix-based systems. You can mentally replace it with > on Windows. Here is an example:

$ elm --version

However, when we’re inside elm repl, the > sign is shown on both Unix and Windows systems to indicate that the code is meant to be entered into an elm repl session. Here is an example:

> 1 + 2
3 : number

Vertical Pipes

When entering multi-line code, elm repl adds pipes (|) in-front of each line starting from the second line. You shouldn’t type these pipes literally. Here’s an example:

> if velocity > 11.186 then \
|   "Godspeed" \
| else if speed == 7.67 then \
|   "Stay in orbit" \
| else \
|   "Come back"
"Stay in orbit"

Two Vertical Dots

Many code examples in the book include two vertical dots to omit a big chunk of code not relevant to the topic being discussed. You shouldn’t type these dots literally. Here are some examples:

import Html exposing (text)
.
.

main =
    isEmpty list2
        |> toString
        |> text
{
    .
    .
    "source-directories": [
        ".",
        "elm-examples"
    ],
    .
    .
}

Three Horizontal Dots

Three horizontal dots are used to omit the body of a function. Again, you shouldn’t type them literally. Here is an example:

list2 =
    MyList.Node 9 MyList.Empty


main =
    ...

Two Horizontal Dots

When importing a module, the two horizontal dots (..) have special meaning in Elm. You should definitely type them literally. Here’s an example:

import Html exposing (..)

We will cover modules in detail in chapter 4.

Back to top
Close