Skip to content

Commit

Permalink
Update instructions.md
Browse files Browse the repository at this point in the history
The instructions don't quite follow the same format as other exercises: `file_name.function_name` vs `function_name`.

Passing the tests of exercise 3 requires that an empty list returns false, which is non-obvious (no birds record ~ [0]?)

Maybe change the test, or change the docs to reflect this
  • Loading branch information
probablyjg authored and lpil committed Jul 12, 2024
1 parent 97f7504 commit 8c24ee3
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions exercises/concept/bird-count/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,50 @@ You have chosen to store the data as a list of integers. The first number in the

## 1. Check how many birds visited today

Implement the `bird_count.today` function. It should take a list of daily bird counts and return today's count. If the list is empty, it should return `0`.
Implement the `today` function. It should take a list of daily bird counts and return today's count. If the list is empty, it should return `0`.

```gleam
bird_count.today([2, 5, 1])
today([2, 5, 1])
// -> 2
```

## 2. Increment today's count

Implement the `bird_count.increment_day_count` function. It should take a list of daily bird counts and increment the today's count by 1. If the list is empty, return `[1]`.
Implement the `increment_day_count` function. It should take a list of daily bird counts and increment the today's count by 1. If the list is empty, return `[1]`.

```gleam
bird_count.increment_day_count([4, 0, 2])
increment_day_count([4, 0, 2])
// -> [5, 0, 2]
```

## 3. Check if there was a day with no visiting birds

Implement the `bird_count.has_day_without_birds` function. It should take a list of daily bird counts. It should return `True` if there was at least one day when no birds visited the garden, and `False` otherwise.
Implement the `has_day_without_birds` function. It should take a list of daily bird counts. It should return `True` if there was at least one day when no birds visited the garden, and `False` otherwise. If the list is empty - this counts as no birds being recorded _yet_; return `False`.

```gleam
bird_count.has_day_without_birds([2, 0, 4])
has_day_without_birds([2, 0, 4])
// -> True
bird_count.has_day_without_birds([3, 8, 1, 5])
has_day_without_birds([3, 8, 1, 5])
// -> False
```

## 4. Calculate the total number of visiting birds

Implement the `bird_count.total` function. It should take a list of daily bird counts and return the total number that visited your garden since you started collecting the data.
Implement the `total` function. It should take a list of daily bird counts and return the total number that visited your garden since you started collecting the data.

```gleam
bird_count.total([4, 0, 9, 0, 5])
total([4, 0, 9, 0, 5])
// -> 18
```

## 5. Calculate the number of busy days

Some days are busier than others. A busy day is one where five or more birds have visited your garden.

Implement the `bird_count.busy_days` function. It should take a list of daily bird counts and return the number of busy days.
Implement the `busy_days` function. It should take a list of daily bird counts and return the number of busy days.

```gleam
bird_count.busy_days([4, 5, 0, 0, 6])
busy_days([4, 5, 0, 0, 6])
// -> 2
```

0 comments on commit 8c24ee3

Please sign in to comment.