From 2ec2372e30131ed1f795ca08e459f9e263636321 Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sat, 4 Oct 2025 13:47:52 +0200 Subject: [PATCH 1/6] Add line-up exercise --- exercises/line-up/canonical-data.json | 161 ++++++++++++++++++++++++++ exercises/line-up/instructions.md | 19 +++ exercises/line-up/introduction.md | 6 + exercises/line-up/metadata.toml | 4 + 4 files changed, 190 insertions(+) create mode 100644 exercises/line-up/canonical-data.json create mode 100644 exercises/line-up/instructions.md create mode 100644 exercises/line-up/introduction.md create mode 100644 exercises/line-up/metadata.toml diff --git a/exercises/line-up/canonical-data.json b/exercises/line-up/canonical-data.json new file mode 100644 index 000000000..f5306e9ae --- /dev/null +++ b/exercises/line-up/canonical-data.json @@ -0,0 +1,161 @@ +{ + "exercise": "line-up", + "comments": [ + "Names are chosen without Unicode characters to keep the exercise simple. ", + "", + "The tests are ordered starting with the most common case and coming to ", + "more special cases later on. " + ], + "cases": [ + { + "uuid": "7760d1b8-4864-4db4-953b-0fa7c047dbc0", + "description": "format smallest non-exceptional ordinal numeral 4", + "property": "format", + "input": { + "name": "Gianna", + "number": 4 + }, + "expected": "Gianna, you are the 4th customer we serve today. Thank you!" + }, + { + "uuid": "e8b7c715-6baa-4f7b-8fb3-2fa48044ab7a", + "description": "format greatest single digit non-exceptional ordinal numeral 9", + "property": "format", + "input": { + "name": "Maarten", + "number": 9 + }, + "expected": "Maarten, you are the 9th customer we serve today. Thank you!" + }, + { + "uuid": "8267072d-be1f-4f70-b34a-76b7557a47b9", + "description": "format exceptional ordinal numeral 1", + "property": "format", + "input": { + "name": "Mary", + "number": 1 + }, + "expected": "Mary, you are the 1st customer we serve today. Thank you!" + }, + { + "uuid": "4d8753cb-0364-4b29-84b8-4374a4fa2e3f", + "description": "format exceptional ordinal numeral 2", + "property": "format", + "input": { + "name": "Haruto", + "number": 2 + }, + "expected": "Haruto, you are the 2nd customer we serve today. Thank you!" + }, + { + "uuid": "8d44c223-3a7e-4f48-a0ca-78e67bf98aa7", + "description": "format exceptional ordinal numeral 3", + "property": "format", + "input": { + "name": "Henriette", + "number": 3 + }, + "expected": "Henriette, you are the 3rd customer we serve today. Thank you!" + }, + { + "uuid": "6c4f6c88-b306-4f40-bc78-97cdd583c21a", + "description": "format smallest two digit non-exceptional ordinal numeral 10", + "property": "format", + "input": { + "name": "Alvarez", + "number": 10 + }, + "expected": "Alvarez, you are the 10th customer we serve today. Thank you!" + }, + { + "uuid": "e257a43f-d2b1-457a-97df-25f0923fc62a", + "description": "format non-exceptional ordinal numeral 11", + "property": "format", + "input": { + "name": "Jacqueline", + "number": 11 + }, + "expected": "Jacqueline, you are the 11th customer we serve today. Thank you!" + }, + { + "uuid": "bb1db695-4d64-457f-81b8-4f5a2107e3f4", + "description": "format non-exceptional ordinal numeral 12", + "property": "format", + "input": { + "name": "Juan", + "number": 12 + }, + "expected": "Juan, you are the 12th customer we serve today. Thank you!" + }, + { + "uuid": "60a3187c-9403-4835-97de-4f10ebfd63e2", + "description": "format non-exceptional ordinal numeral 13", + "property": "format", + "input": { + "name": "Patricia", + "number": 13 + }, + "expected": "Patricia, you are the 13th customer we serve today. Thank you!" + }, + { + "uuid": "2bdcebc5-c029-4874-b6cc-e9bec80d603a", + "description": "format exceptional ordinal numeral 21", + "property": "format", + "input": { + "name": "Washi", + "number": 21 + }, + "expected": "Washi, you are the 21st customer we serve today. Thank you!" + }, + { + "uuid": "74ee2317-0295-49d2-baf0-d56bcefa14e3", + "description": "format exceptional ordinal numeral 62", + "property": "format", + "input": { + "name": "Nayra", + "number": 62 + }, + "expected": "Nayra, you are the 62nd customer we serve today. Thank you!" + }, + { + "uuid": "b37c332d-7f68-40e3-8503-e43cbd67a0c4", + "description": "format exceptional ordinal numeral 100", + "property": "format", + "input": { + "name": "John", + "number": 100 + }, + "expected": "John, you are the 100th customer we serve today. Thank you!" + }, + { + "uuid": "0375f250-ce92-4195-9555-00e28ccc4d99", + "description": "format exceptional ordinal numeral 101", + "property": "format", + "input": { + "name": "Zeinab", + "number": 101 + }, + "expected": "Zeinab, you are the 101st customer we serve today. Thank you!" + }, + { + "uuid": "0d8a4974-9a8a-45a4-aca7-a9fb473c9836", + "description": "format non-exceptional ordinal numeral 112", + "property": "format", + "input": { + "name": "Knud", + "number": 112 + }, + "expected": "Knud, you are the 112th customer we serve today. Thank you!" + }, + { + "uuid": "06b62efe-199e-4ce7-970d-4bf73945713f", + "description": "format exceptional ordinal numeral 123", + "property": "format", + "input": { + "name": "Yma", + "number": 123 + }, + "expected": "Yma, you are the 123rd customer we serve today. Thank you!" + } + ] +} diff --git a/exercises/line-up/instructions.md b/exercises/line-up/instructions.md new file mode 100644 index 000000000..76a175c73 --- /dev/null +++ b/exercises/line-up/instructions.md @@ -0,0 +1,19 @@ +# Instructions + +Given a name and a number, your task is to produce a sentence with an [ordinal numeral][ordinal-numeral] to print onto the ticket. +Yaʻqūb expects to use numbers from 1 up to 999. + +Rules: + +- Numbers ending in 1 (except for 11) → `st` +- Numbers ending in 2 (except for 12) → `nd` +- Numbers ending in 3 (except for 13) → `rd` +- All other numbers not ending in 1, 2, or 3 → `th` + +Examples: + +- `'Mary', 1` → `'Mary, you are the 1st customer we serve today. Thank you!'` +- `'John', 12` → `'John, you are the 12th customer we serve today. Thank you!'` +- `'Dahir', 162` → `'Dahir, you are the 162nd customer we serve today. Thank you!'` + +[ordinal-numeral]: https://en.wikipedia.org/wiki/Ordinal_numeral diff --git a/exercises/line-up/introduction.md b/exercises/line-up/introduction.md new file mode 100644 index 000000000..c1c6d1d25 --- /dev/null +++ b/exercises/line-up/introduction.md @@ -0,0 +1,6 @@ +# Introduction + +Your friend Yaʻqūb works the counter at a deli in town, slicing, weighing, and wrapping orders for a line of hungry customers that gets longer every day. +He sees that waiting customers start to loose track of who is next, so he wants to have numbered tickets for them to pick when they arrive. + +He is a nice person, and so he does not want to have only a number on the ticket. They shall get a proper English sentence with their name and number in it. diff --git a/exercises/line-up/metadata.toml b/exercises/line-up/metadata.toml new file mode 100644 index 000000000..0c83f7a5d --- /dev/null +++ b/exercises/line-up/metadata.toml @@ -0,0 +1,4 @@ +title = "Line up" +blurb = "Help lining up customers at Yaʻqūb's Deli." +source = "Based on previous work from Exercism contributors codedge and neenjaw" +source_url = "https://en.wikipedia.org/wiki/Ordinal_numeral" From 77f404d2f31d0de60ab28b93556310810a020749 Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sat, 4 Oct 2025 14:08:45 +0200 Subject: [PATCH 2/6] Fix rules --- exercises/line-up/instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/line-up/instructions.md b/exercises/line-up/instructions.md index 76a175c73..2334784b9 100644 --- a/exercises/line-up/instructions.md +++ b/exercises/line-up/instructions.md @@ -8,7 +8,7 @@ Rules: - Numbers ending in 1 (except for 11) → `st` - Numbers ending in 2 (except for 12) → `nd` - Numbers ending in 3 (except for 13) → `rd` -- All other numbers not ending in 1, 2, or 3 → `th` +- All other numbers → `th` Examples: From cf45aeaaaaa422c0123df86a94e8fc6dc4df0498 Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sun, 5 Oct 2025 09:18:55 +0200 Subject: [PATCH 3/6] Improvements according to reviews --- exercises/line-up/instructions.md | 16 ++++++++-------- exercises/line-up/introduction.md | 5 +++-- exercises/line-up/metadata.toml | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/exercises/line-up/instructions.md b/exercises/line-up/instructions.md index 2334784b9..fb41d4cb7 100644 --- a/exercises/line-up/instructions.md +++ b/exercises/line-up/instructions.md @@ -1,19 +1,19 @@ # Instructions -Given a name and a number, your task is to produce a sentence with an [ordinal numeral][ordinal-numeral] to print onto the ticket. +Given a name and a number, your task is to produce a sentence using that name and that number as an [ordinal numeral][ordinal-numeral]. Yaʻqūb expects to use numbers from 1 up to 999. Rules: -- Numbers ending in 1 (except for 11) → `st` -- Numbers ending in 2 (except for 12) → `nd` -- Numbers ending in 3 (except for 13) → `rd` -- All other numbers → `th` +- Numbers ending in 1 (except for 11) → `"st"` +- Numbers ending in 2 (except for 12) → `"nd"` +- Numbers ending in 3 (except for 13) → `"rd"` +- All other numbers → `"th"` Examples: -- `'Mary', 1` → `'Mary, you are the 1st customer we serve today. Thank you!'` -- `'John', 12` → `'John, you are the 12th customer we serve today. Thank you!'` -- `'Dahir', 162` → `'Dahir, you are the 162nd customer we serve today. Thank you!'` +- `"Mary", 1` → `"Mary, you are the 1st customer we serve today. Thank you!"` +- `"John", 12` → `"John, you are the 12th customer we serve today. Thank you!"` +- `"Dahir", 162` → `"Dahir, you are the 162nd customer we serve today. Thank you!"` [ordinal-numeral]: https://en.wikipedia.org/wiki/Ordinal_numeral diff --git a/exercises/line-up/introduction.md b/exercises/line-up/introduction.md index c1c6d1d25..ea07268ae 100644 --- a/exercises/line-up/introduction.md +++ b/exercises/line-up/introduction.md @@ -1,6 +1,7 @@ # Introduction Your friend Yaʻqūb works the counter at a deli in town, slicing, weighing, and wrapping orders for a line of hungry customers that gets longer every day. -He sees that waiting customers start to loose track of who is next, so he wants to have numbered tickets for them to pick when they arrive. +Waiting customers are starting to lose track of who is next, so he wants numbered tickets they can use to track the order in which they arrive. -He is a nice person, and so he does not want to have only a number on the ticket. They shall get a proper English sentence with their name and number in it. +To make the customers feel special, he does not want the ticket to have only a number on it. +They shall get a proper English sentence with their name and number on it. diff --git a/exercises/line-up/metadata.toml b/exercises/line-up/metadata.toml index 0c83f7a5d..b4a2c1d62 100644 --- a/exercises/line-up/metadata.toml +++ b/exercises/line-up/metadata.toml @@ -1,4 +1,4 @@ title = "Line up" blurb = "Help lining up customers at Yaʻqūb's Deli." -source = "Based on previous work from Exercism contributors codedge and neenjaw" -source_url = "https://en.wikipedia.org/wiki/Ordinal_numeral" +source = "mk-mxp, based on previous work from Exercism contributors codedge and neenjaw" +source_url = "https://forum.exercism.org/t/new-exercise-ordinal-numbers/19147" From e9a163b311945f9164bc1b980c26b43131a9da68 Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sun, 5 Oct 2025 17:34:42 +0200 Subject: [PATCH 4/6] Don't pad comment strings with spaces --- exercises/line-up/canonical-data.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/line-up/canonical-data.json b/exercises/line-up/canonical-data.json index f5306e9ae..f5f2e159a 100644 --- a/exercises/line-up/canonical-data.json +++ b/exercises/line-up/canonical-data.json @@ -1,10 +1,10 @@ { "exercise": "line-up", "comments": [ - "Names are chosen without Unicode characters to keep the exercise simple. ", + "Names are chosen without Unicode characters to keep the exercise simple.", "", - "The tests are ordered starting with the most common case and coming to ", - "more special cases later on. " + "The tests are ordered starting with the most common case and coming to", + "more special cases later on." ], "cases": [ { From 3c072317456f653fa2eefe4c16f26194703aaa5f Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sun, 5 Oct 2025 17:54:28 +0200 Subject: [PATCH 5/6] Add all single digit cases --- exercises/line-up/canonical-data.json | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/exercises/line-up/canonical-data.json b/exercises/line-up/canonical-data.json index f5f2e159a..cf16baf69 100644 --- a/exercises/line-up/canonical-data.json +++ b/exercises/line-up/canonical-data.json @@ -27,6 +27,46 @@ }, "expected": "Maarten, you are the 9th customer we serve today. Thank you!" }, + { + "uuid": "f370aae9-7ae7-4247-90ce-e8ff8c6934df", + "description": "format non-exceptional ordinal numeral 5", + "property": "format", + "input": { + "name": "Petronila", + "number": 5 + }, + "expected": "Petronila, you are the 5th customer we serve today. Thank you!" + }, + { + "uuid": "37f10dea-42a2-49de-bb92-0b690b677908", + "description": "format non-exceptional ordinal numeral 6", + "property": "format", + "input": { + "name": "Attakullakulla", + "number": 6 + }, + "expected": "Attakullakulla, you are the 6th customer we serve today. Thank you!" + }, + { + "uuid": "d8dfb9a2-3a1f-4fee-9dae-01af3600054e", + "description": "format non-exceptional ordinal numeral 7", + "property": "format", + "input": { + "name": "Kate", + "number": 7 + }, + "expected": "Kate, you are the 7th customer we serve today. Thank you!" + }, + { + "uuid": "505ec372-1803-42b1-9377-6934890fd055", + "description": "format non-exceptional ordinal numeral 8", + "property": "format", + "input": { + "name": "Maximiliano", + "number": 8 + }, + "expected": "Maximiliano, you are the 8th customer we serve today. Thank you!" + }, { "uuid": "8267072d-be1f-4f70-b34a-76b7557a47b9", "description": "format exceptional ordinal numeral 1", From 446be4bde8cc35598f2847bf2d8eb43786bd8bc0 Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sun, 5 Oct 2025 17:56:11 +0200 Subject: [PATCH 6/6] Re-word test ordering comment --- exercises/line-up/canonical-data.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/line-up/canonical-data.json b/exercises/line-up/canonical-data.json index cf16baf69..6f17c4703 100644 --- a/exercises/line-up/canonical-data.json +++ b/exercises/line-up/canonical-data.json @@ -3,8 +3,8 @@ "comments": [ "Names are chosen without Unicode characters to keep the exercise simple.", "", - "The tests are ordered starting with the most common case and coming to", - "more special cases later on." + "The tests are ordered starting with small regular cases and coming to", + "bigger and irregular cases later on." ], "cases": [ {