Skip to content

Commit

Permalink
add exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegillet committed Mar 8, 2025
1 parent 1276226 commit 1c7ca73
Show file tree
Hide file tree
Showing 9 changed files with 758 additions and 0 deletions.
14 changes: 14 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,20 @@
"lists"
],
"difficulty": 3
},
{
"slug": "swift-scheduling",
"name": "Swift Scheduling",
"uuid": "d0438147-3983-47bf-a4db-27fb0f5ae90e",
"practices": [],
"prerequisites": [
"strings",
"records",
"custom-types",
"pattern-matching",
"comparison"
],
"difficulty": 7
}
],
"foregone": [
Expand Down
43 changes: 43 additions & 0 deletions exercises/practice/swift-scheduling/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Instructions

Your task is to convert delivery date descriptions to _actual_ delivery dates, based on when the meeting started.

There are two types of delivery date descriptions:

1. Fixed: a predefined set of words.
2. Variable: words that have a variable component, but follow a predefined set of patterns.

## Fixed delivery date descriptions

There are three fixed delivery date descriptions:

- `"NOW"`
- `"ASAP"` (As Soon As Possible)
- `"EOW"` (End Of Week)

The following table shows how to translate them:

| Description | Meeting start | Delivery date |
| ----------- | ----------------------------- | ----------------------------------- |
| `"NOW"` | - | Two hours after the meeting started |
| `"ASAP"` | Before 13:00 | Today at 17:00 |
| `"ASAP"` | After or at 13:00 | Tomorrow at 13:00 |
| `"EOW"` | Monday, Tuesday, or Wednesday | Friday at 17:00 |
| `"EOW"` | Thursday or Friday | Sunday at 20:00 |

## Variable delivery date descriptions

There are two variable delivery date description patterns:

- `"<N>M"` (N-th month)
- `"Q<N>"` (N-th quarter)

| Description | Meeting start | Delivery date |
| ----------- | -------------------------- | ----------------------------------------------------------- |
| `"<N>M"` | Before N-th month | At 8:00 on the _first_ workday¹ of this year's N-th month |
| `"<N>M"` | After or in N-th month | At 8:00 on the _first_ workday¹ of next year's N-th month |
| `"Q<N>"` | Before or in N-th quarter² | At 8:00 on the _last_ workday¹ of this year's N-th quarter² |
| `"Q<N>"` | After N-th quarter² | At 8:00 on the _last_ workday¹ of next year's N-th quarter² |

¹ A workday is a Monday, Tuesday, Wednesday, Thursday, or Friday.
² A year has four quarters, each with three months: January/February/March, April/May/June, July/August/September, and October/November/December.
6 changes: 6 additions & 0 deletions exercises/practice/swift-scheduling/.docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Introduction

This week, it is your turn to take notes in the department's planning meeting.
In this meeting, your boss will set delivery dates for all open work items.
Annoyingly, instead of specifying the _actual_ delivery dates, your boss will only _describe them_ in an abbreviated format.
As many of your colleagues won't be familiar with this corporate lingo, you'll need to convert these delivery date descriptions to actual delivery dates.
19 changes: 19 additions & 0 deletions exercises/practice/swift-scheduling/.meta/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"authors": [
"jiegillet"
],
"files": {
"solution": [
"src/SwiftScheduling.elm"
],
"test": [
"tests/Tests.elm"
],
"example": [
".meta/src/SwiftScheduling.example.elm"
]
},
"blurb": "Convert delivery date descriptions to actual delivery dates.",
"source": "Erik Schierboom",
"source_url": "https://github.com/exercism/problem-specifications/pull/2536"
}
Loading

0 comments on commit 1c7ca73

Please sign in to comment.