Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3] Update Practice Exercises to latest spec #133

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions concepts/arrays/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

An [`array`][arrays] in F# is a mutable collection of zero or more values with a fixed length. This means that once an array has been created, its size cannot change, but its values can. The values in an array must all have the same type. [Arrays can be defined as follows][creating-arrays]:

```fsharp
Expand Down
2 changes: 2 additions & 0 deletions concepts/arrays/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

An `array` in F# is a mutable collection of zero or more values with a fixed length. This means that once an array has been created, its size cannot change, but its values can. The values in an array must all have the same type. Arrays can be defined as follows:

```fsharp
Expand Down
2 changes: 2 additions & 0 deletions concepts/basics/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

In F#, everything that has a type and can be defined is known as a _value_. That includes booleans, integers and lists, but also functions. Integer values are defined as one or more (consecutive) digits and support the [default mathematical operators][operators].

Assigning a value to a name is referred to as a _binding_. [Bindings][bindings] are immutable, which makes them similar to constants in other languages. Bindings are defined using the `let` keyword.
Expand Down
2 changes: 2 additions & 0 deletions concepts/basics/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

In F#, assigning a value to a name is referred to as a _binding_. Bindings are immutable, which makes them similar to constants in other languages. As F# is a statically-typed language, each binding has a type at compile-time.

Bindings are defined using the `let` keyword. Specifying a binding's type is optional for most bindings, as F#'s _type inference_ can usually infer the type based on their value. A binding looks like this:
Expand Down
2 changes: 2 additions & 0 deletions concepts/booleans/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

Booleans in F# are represented by the `bool` type, which values can be either `true` or `false`.

F# supports three [boolean operators][operators]: `not` (NOT), `&&` (AND), and `||` (OR). The `&&` and `||` operators use _short-circuit evaluation_, which means that the right-hand side of the operator is only evaluated when needed.
Expand Down
2 changes: 2 additions & 0 deletions concepts/booleans/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

Booleans in F# are represented by the `bool` type, which values can be either `true` or `false`.

F# supports three boolean operators: `not` (NOT), `&&` (AND), and `||` (OR).
2 changes: 2 additions & 0 deletions concepts/classes/about.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# About

TODO: add information on classes concept
2 changes: 2 additions & 0 deletions concepts/classes/introduction.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Introduction

TODO: add introduction for classes concept
2 changes: 2 additions & 0 deletions concepts/conditionals/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

Conditionally executing code can be done using [`if/elif/else` expressions][conditional-expression]. The condition(s) used in an `if/elif/else` expression must be of type `bool`. F# has no concept of _truthy_ values.

```fsharp
Expand Down
2 changes: 2 additions & 0 deletions concepts/conditionals/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

In this exercise you must conditionally execute logic. The most common way to do this in F# is by using an `if/elif/else` statement:

```fsharp
Expand Down
2 changes: 2 additions & 0 deletions concepts/datetimes/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

A `DateTime` in F# is an immutable object that contains both date _and_ time information. The date and time information can be accessed through its built-in [properties][properties].

Manipulating a `DateTime` can be done by calling one of its [methods][methods]. As `DateTime` values can never change after having been defined, all methods that appear to modify a `DateTime` will actually return a new `DateTime`.
Expand Down
2 changes: 2 additions & 0 deletions concepts/datetimes/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

A `DateTime` in F# is an immutable object that contains both date _and_ time information. `DateTime` instances are manipulated by calling their methods. Once a `DateTime` has been constructed, its value can never change. Any methods/functions that appear to modify a `DateTime` will actually return a new `DateTime`.

The textual representation of dates and times is dependent on the _culture_. Consider a `DateTime` with its date set to March 28 2019 and its time set to 14:30:59. Converting this `DateTime` to a `string` when using the `en-US` culture (American English) returns `"3/28/19 2:30:59 PM"`. When using the `fr-BE` culture (Belgian French), the same code returns a different value: `"28/03/19 14:30:59"`.
Expand Down
2 changes: 2 additions & 0 deletions concepts/discriminated-unions/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

The [discriminated union][define] type represents a fixed number of named cases. Each value of a discriminated union corresponds to exactly one of the named cases. This type of data type is known as a _sum type_.

Each case of a discriminated union can optionally have data associated with it, and different cases can have different types of data. If none of the cases have data associated with them, the discriminated union is similar to what other languages usually refer to as an _enumeration_ (or _enum_).
Expand Down
2 changes: 2 additions & 0 deletions concepts/discriminated-unions/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

The discriminated union type represents a fixed number of named cases. Each value of a discriminated union corresponds to exactly one of the named cases.

A discriminated union is defined using the `type` keyword, with cases separated by pipe (`|`) characters:
Expand Down
2 changes: 2 additions & 0 deletions concepts/floating-point-numbers/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

A floating-point number is a number with zero or more digits behind the decimal separator. Examples are `-2.4`, `0.1`, `3.14`, `16.984025` and `1024.0`.

F# has three floating-point types:
Expand Down
2 changes: 2 additions & 0 deletions concepts/floating-point-numbers/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

A floating-point number is a number with zero or more digits behind the decimal separator. Examples are `-2.4`, `0.1`, `3.14`, `16.984025` and `1024.0`.

F# has three floating-point types:
Expand Down
2 changes: 2 additions & 0 deletions concepts/higher-order-functions/about.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# About

TODO: add information on higher-order-functions concept
2 changes: 2 additions & 0 deletions concepts/higher-order-functions/introduction.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Introduction

TODO: add introduction for higher-order-functions concept
2 changes: 2 additions & 0 deletions concepts/lists/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

A [`list`][lists] in F# is an immutable collection of zero or more values. The values in a list must all have the same type. As lists are immutable, once a list has been constructed, its value can never change. F# list have a _head_ (the first element) and a _tail_ (everything after the first element). The tail of a list is itself a list.

Lists can be defined as follows:
Expand Down
2 changes: 2 additions & 0 deletions concepts/lists/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

A `list` in F# is an immutable collection of zero or more values. The values in a list must all have the same type. As lists are immutable, once a list has been constructed, its value can never change. Any functions/operators that appear to modify a list (such as adding an element), will actually return a new list.

Lists can be defined as follows:
Expand Down
2 changes: 2 additions & 0 deletions concepts/numbers/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

One of the key aspects of working with numbers in F# is the distinction between integers (numbers with no digits after the decimal separator) and floating-point numbers (numbers with zero or more digits after the decimal separator).

The two most commonly used numeric types in F# are `int` (a 32-bit integer) and `float` (a 64-bit floating-point number).
Expand Down
2 changes: 2 additions & 0 deletions concepts/numbers/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

There are two different types of numbers in F#:

- Integers: numbers with no digits behind the decimal separator (whole numbers). Examples are `-6`, `0`, `1`, `25`, `976` and `500000`.
Expand Down
2 changes: 2 additions & 0 deletions concepts/pattern-matching/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

An `if/elif/else` expression can be used to conditionally execute logic. F# also has another, more powerful way to conditionally execute logic: [pattern matching][pattern-matching]. With pattern matching, a value can be tested against one or more _patterns_. An example of such a pattern is the [_constant pattern_][constant-pattern], which matches a value against a constant (e.g. `1` or `"hello"`).

In F#, pattern matching is done through the `match` keyword:
Expand Down
2 changes: 2 additions & 0 deletions concepts/pattern-matching/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

An `if/elif/else` expression can be used to conditionally execute logic. F# also has another, more powerful way to conditionally execute logic: pattern matching. With pattern matching, a value can be tested against one or more _patterns_. An example of such a pattern is the _constant pattern_, which matches a value against a constant (e.g. `1` or `"hello"`).

In F#, pattern matching is done through the `match` keyword:
Expand Down
2 changes: 2 additions & 0 deletions concepts/records/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

A [record][records] is a collection of fields (which can be of different types) that belong together. To [define a record][define] the `type` keyword is used. A record's fields are defined between `{` and `}` characters, and each field has a name _and_ a type.

```fsharp
Expand Down
2 changes: 2 additions & 0 deletions concepts/records/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

A record is a collection of fields (which can be of different types) that belong together. To define a record the `type` keyword is used. A record's fields are defined between `{` and `}` characters, and each field has a name _and_ a type. To create a record, specify the names of the fields and assign a value to them between `{` and `}` characters. All fields must be assigned a value when creating a record. A record instance's field values can be accessed using dot-notation.

When defining/create a record, each field must either be on a separate line or separated by semicolons (`;`) when on a single line.
Expand Down
2 changes: 2 additions & 0 deletions concepts/recursion/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

The ability for something to be defined in terms of itself is called recursion. In F#, recursion is most commonly found in [recursive functions][recursive-functions], which are functions that call themselves.

A recursive function needs to have at least one _base case_ and at least one _recursive case_. A _base case_ returns a value without calling the function again. A _recursive case_ calls the function again, modifying the input so that it will at some point match the base case.
Expand Down
2 changes: 2 additions & 0 deletions concepts/recursion/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

The ability for something to be defined in terms of itself is called recursion. In F#, recursion is most commonly found in recursive functions, which are functions that call themselves.

A recursive function needs to have at least one _base case_ and at least one _recursive case_. A _base case_ returns a value without calling the function again. A _recursive case_ calls the function again, modifying the input so that it will at some point match the base case.
Expand Down
2 changes: 2 additions & 0 deletions concepts/strings/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

F# strings are immutable objects representing text as a sequence of Unicode characters (letters, digits, punctuation, etc.). Double quotes are used to define a `string` instance:

```fsharp
Expand Down
2 changes: 2 additions & 0 deletions concepts/strings/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

A `string` in F# is an object that represents immutable text as a sequence of Unicode characters (letters, digits, punctuation, etc.) and is defined as follows:

```fsharp
Expand Down
Loading