From faa4caa3ef643cb23434e88df97d6e4ed7970640 Mon Sep 17 00:00:00 2001 From: SimaDovakin Date: Wed, 7 Aug 2024 17:24:58 +0300 Subject: [PATCH] kindergarten-garden-exercise: Added new exercise. --- config.json | 8 ++ .../kindergarten-garden/.docs/instructions.md | 56 +++++++++ .../kindergarten-garden/.docs/introduction.md | 6 + .../kindergarten-garden/.meta/config.json | 19 +++ .../examples/kindergartenGarden.example.u | 45 +++++++ .../.meta/testAnnotation.json | 70 +++++++++++ .../kindergarten-garden/.meta/testLoader.md | 9 ++ .../kindergarten-garden/.meta/tests.toml | 61 ++++++++++ .../kindergartenGarden.test.u | 112 ++++++++++++++++++ .../kindergarten-garden/kindergartenGarden.u | 20 ++++ 10 files changed, 406 insertions(+) create mode 100644 exercises/practice/kindergarten-garden/.docs/instructions.md create mode 100644 exercises/practice/kindergarten-garden/.docs/introduction.md create mode 100644 exercises/practice/kindergarten-garden/.meta/config.json create mode 100644 exercises/practice/kindergarten-garden/.meta/examples/kindergartenGarden.example.u create mode 100644 exercises/practice/kindergarten-garden/.meta/testAnnotation.json create mode 100644 exercises/practice/kindergarten-garden/.meta/testLoader.md create mode 100644 exercises/practice/kindergarten-garden/.meta/tests.toml create mode 100644 exercises/practice/kindergarten-garden/kindergartenGarden.test.u create mode 100644 exercises/practice/kindergarten-garden/kindergartenGarden.u diff --git a/config.json b/config.json index d8624db..81aa84d 100644 --- a/config.json +++ b/config.json @@ -454,6 +454,14 @@ "practices": [], "prerequisites": [], "difficulty": 2 + }, + { + "slug": "kindergarten-garden", + "name": "Kindergarten Garden", + "uuid": "2623646b-91a2-485e-a9e5-e4b5f9194f28", + "practices": [], + "prerequisites": [], + "difficulty": 3 } ] }, diff --git a/exercises/practice/kindergarten-garden/.docs/instructions.md b/exercises/practice/kindergarten-garden/.docs/instructions.md new file mode 100644 index 0000000..6fe11a5 --- /dev/null +++ b/exercises/practice/kindergarten-garden/.docs/instructions.md @@ -0,0 +1,56 @@ +# Instructions + +Your task is to, given a diagram, determine which plants each child in the kindergarten class is responsible for. + +There are 12 children in the class: + +- Alice, Bob, Charlie, David, Eve, Fred, Ginny, Harriet, Ileana, Joseph, Kincaid, and Larry. + +Four different types of seeds are planted: + +| Plant | Diagram encoding | +| ------ | ---------------- | +| Grass | G | +| Clover | C | +| Radish | R | +| Violet | V | + +Each child gets four cups, two on each row: + +```text +[window][window][window] +........................ # each dot represents a cup +........................ +``` + +Their teacher assigns cups to the children alphabetically by their names, which means that Alice comes first and Larry comes last. + +Here is an example diagram representing Alice's plants: + +```text +[window][window][window] +VR...................... +RG...................... +``` + +In the first row, nearest the windows, she has a violet and a radish. +In the second row she has a radish and some grass. + +Your program will be given the plants from left-to-right starting with the row nearest the windows. +From this, it should be able to determine which plants belong to each student. + +For example, if it's told that the garden looks like so: + +```text +[window][window][window] +VRCGVVRVCGGCCGVRGCVCGCGV +VRCCCGCRRGVCGCRVVCVGCGCV +``` + +Then if asked for Alice's plants, it should provide: + +- Violets, radishes, violets, radishes + +While asking for Bob's plants would yield: + +- Clover, grass, clover, clover diff --git a/exercises/practice/kindergarten-garden/.docs/introduction.md b/exercises/practice/kindergarten-garden/.docs/introduction.md new file mode 100644 index 0000000..5ad97d2 --- /dev/null +++ b/exercises/practice/kindergarten-garden/.docs/introduction.md @@ -0,0 +1,6 @@ +# Introduction + +The kindergarten class is learning about growing plants. +The teacher thought it would be a good idea to give the class seeds to plant and grow in the dirt. +To this end, the children have put little cups along the window sills and planted one type of plant in each cup. +The children got to pick their favorites from four available types of seeds: grass, clover, radishes, and violets. diff --git a/exercises/practice/kindergarten-garden/.meta/config.json b/exercises/practice/kindergarten-garden/.meta/config.json new file mode 100644 index 0000000..c78f3a6 --- /dev/null +++ b/exercises/practice/kindergarten-garden/.meta/config.json @@ -0,0 +1,19 @@ +{ + "authors": [ + "SimaDovakin" + ], + "files": { + "solution": [ + "kindergartenGarden.u" + ], + "test": [ + "kindergartenGarden.test.u" + ], + "example": [ + ".meta/examples/kindergartenGarden.example.u" + ] + }, + "blurb": "Given a diagram, determine which plants each child in the kindergarten class is responsible for.", + "source": "Exercise by the JumpstartLab team for students at The Turing School of Software and Design.", + "source_url": "https://turing.edu" +} diff --git a/exercises/practice/kindergarten-garden/.meta/examples/kindergartenGarden.example.u b/exercises/practice/kindergarten-garden/.meta/examples/kindergartenGarden.example.u new file mode 100644 index 0000000..ab7d033 --- /dev/null +++ b/exercises/practice/kindergarten-garden/.meta/examples/kindergartenGarden.example.u @@ -0,0 +1,45 @@ +unique type kindergartenGarden.Plant + = Clover + | Grass + | Radishes + | Violets + +unique type kindergartenGarden.Garden + = Garden (Map Text [kindergartenGarden.Plant]) + +{{ + Accepts a list of students' names and raw garden diagram and returns Garden type. +}} +kindergartenGarden.garden : [Text] -> Text -> Garden +kindergartenGarden.garden students plants = + rows = lines plants + (firstRow, lastRow) = (head rows, last rows) + processedPlants = + processRows (getOrElse "" firstRow) (getOrElse "" lastRow) + Garden (zip students processedPlants |> fromList) + +{{ + Accepts student's name and Garden and returns list of plants. +}} +kindergartenGarden.lookupPlants : Text -> Garden -> [Plant] +kindergartenGarden.lookupPlants student garden = + (Garden cups) = garden + cups + |> Map.get student + |> Optional.getOrElse [] + +kindergartenGarden.toPlant : Char -> Plant +kindergartenGarden.toPlant = cases + ?C -> Clover + ?G -> Grass + ?R -> Radishes + ?V -> Violets + _ -> Grass + +kindergartenGarden.processRows : Text -> Text -> [[Plant]] +kindergartenGarden.processRows = cases + "", "" -> [] + row1, row2 -> match (toCharList row1, toCharList row2) with + ([x, y] ++ xs, [n, m] ++ ns) -> + (map toPlant [x, y, n, m]) +: processRows (fromCharList xs) (fromCharList ns) + _ -> [] diff --git a/exercises/practice/kindergarten-garden/.meta/testAnnotation.json b/exercises/practice/kindergarten-garden/.meta/testAnnotation.json new file mode 100644 index 0000000..453fcc4 --- /dev/null +++ b/exercises/practice/kindergarten-garden/.meta/testAnnotation.json @@ -0,0 +1,70 @@ +[ + { + "name": "kindergartenGarden.lookupPlants.tests.ex1", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"RC\\nGG\"\n expect ([Radishes, Clover, Grass, Grass] === kindergartenGarden.lookupPlants \"Alice\" garden)\n |> Test.label \"partial garden - garden with single student\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex2", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VC\\nRC\"\n expect ([Violets, Clover, Radishes, Clover] === kindergartenGarden.lookupPlants \"Alice\" garden)\n |> Test.label \"partial garden - different garden with single student\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex3", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VVCG\\nVVRC\"\n expect ([Clover, Grass, Radishes, Clover] === kindergartenGarden.lookupPlants \"Bob\" garden)\n |> Test.label \"partial garden - garden with two students\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex4", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VVCCGG\\nVVCCGG\"\n expect ([Clover, Clover, Clover, Clover] === kindergartenGarden.lookupPlants \"Bob\" garden)\n |> Test.label \"partial garden - multiple students for the same garden with three students - second student's garden\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex5", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VVCCGG\\nVVCCGG\"\n expect ([Grass, Grass, Grass, Grass] === kindergartenGarden.lookupPlants \"Charlie\" garden)\n |> Test.label \"partial garden - multiple students for the same garden with three students - third student's garden\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex6", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VRCGVVRVCGGCCGVRGCVCGCGV\\nVRCCCGCRRGVCGCRVVCVGCGCV\"\n expect ([Violets, Radishes, Violets, Radishes] === kindergartenGarden.lookupPlants \"Alice\" garden)\n |> Test.label \"full garden - for Alice, first student's garden\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex7", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VRCGVVRVCGGCCGVRGCVCGCGV\\nVRCCCGCRRGVCGCRVVCVGCGCV\"\n expect ([Clover, Grass, Clover, Clover] === kindergartenGarden.lookupPlants \"Bob\" garden)\n |> Test.label \"full garden - for Bob, second student's garden\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex8", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VRCGVVRVCGGCCGVRGCVCGCGV\\nVRCCCGCRRGVCGCRVVCVGCGCV\"\n expect ([Violets, Violets, Clover, Grass] === kindergartenGarden.lookupPlants \"Charlie\" garden)\n |> Test.label \"full garden - for Charlie\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex9", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VRCGVVRVCGGCCGVRGCVCGCGV\\nVRCCCGCRRGVCGCRVVCVGCGCV\"\n expect ([Radishes, Violets, Clover, Radishes] === kindergartenGarden.lookupPlants \"David\" garden)\n |> Test.label \"full garden - for David\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex10", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VRCGVVRVCGGCCGVRGCVCGCGV\\nVRCCCGCRRGVCGCRVVCVGCGCV\"\n expect ([Clover, Grass, Radishes, Grass] === kindergartenGarden.lookupPlants \"Eve\" garden)\n |> Test.label \"full garden - for Eve\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex11", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VRCGVVRVCGGCCGVRGCVCGCGV\\nVRCCCGCRRGVCGCRVVCVGCGCV\"\n expect ([Grass, Clover, Violets, Clover] === kindergartenGarden.lookupPlants \"Fred\" garden)\n |> Test.label \"full garden - for Fred\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex12", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VRCGVVRVCGGCCGVRGCVCGCGV\\nVRCCCGCRRGVCGCRVVCVGCGCV\"\n expect ([Clover, Grass, Grass, Clover] === kindergartenGarden.lookupPlants \"Ginny\" garden)\n |> Test.label \"full garden - for Ginny\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex13", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VRCGVVRVCGGCCGVRGCVCGCGV\\nVRCCCGCRRGVCGCRVVCVGCGCV\"\n expect ([Violets, Radishes, Radishes, Violets] === kindergartenGarden.lookupPlants \"Harriet\" garden)\n |> Test.label \"full garden - for Harriet\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex14", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VRCGVVRVCGGCCGVRGCVCGCGV\\nVRCCCGCRRGVCGCRVVCVGCGCV\"\n expect ([Grass, Clover, Violets, Clover] === kindergartenGarden.lookupPlants \"Ileana\" garden)\n |> Test.label \"full garden - for Ileana\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex15", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VRCGVVRVCGGCCGVRGCVCGCGV\\nVRCCCGCRRGVCGCRVVCVGCGCV\"\n expect ([Violets, Clover, Violets, Grass] === kindergartenGarden.lookupPlants \"Joseph\" garden)\n |> Test.label \"full garden - for Joseph\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex16", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VRCGVVRVCGGCCGVRGCVCGCGV\\nVRCCCGCRRGVCGCRVVCVGCGCV\"\n expect ([Grass, Clover, Clover, Grass] === kindergartenGarden.lookupPlants \"Kincaid\" garden)\n |> Test.label \"full garden - for Kincaid, second to last student's garden\"" + }, + { + "name": "kindergartenGarden.lookupPlants.tests.ex17", + "test_code": "garden = kindergartenGarden.tests.defaultGarden \"VRCGVVRVCGGCCGVRGCVCGCGV\\nVRCCCGCRRGVCGCRVVCVGCGCV\"\n expect ([Grass, Violets, Clover, Violets] === kindergartenGarden.lookupPlants \"Larry\" garden)\n |> Test.label \"full garden - for Larry, last student's garden\"" + } +] \ No newline at end of file diff --git a/exercises/practice/kindergarten-garden/.meta/testLoader.md b/exercises/practice/kindergarten-garden/.meta/testLoader.md new file mode 100644 index 0000000..fdc195a --- /dev/null +++ b/exercises/practice/kindergarten-garden/.meta/testLoader.md @@ -0,0 +1,9 @@ +# Testing transcript for kindergarten-garden exercise + +```ucm +.> load ./kindergartenGarden.u +.> add +.> load ./kindergartenGarden.test.u +.> add +.> move.term kindergartenGarden.tests tests +``` diff --git a/exercises/practice/kindergarten-garden/.meta/tests.toml b/exercises/practice/kindergarten-garden/.meta/tests.toml new file mode 100644 index 0000000..0cdd9ad --- /dev/null +++ b/exercises/practice/kindergarten-garden/.meta/tests.toml @@ -0,0 +1,61 @@ +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. + +[1fc316ed-17ab-4fba-88ef-3ae78296b692] +description = "partial garden -> garden with single student" + +[acd19dc1-2200-4317-bc2a-08f021276b40] +description = "partial garden -> different garden with single student" + +[c376fcc8-349c-446c-94b0-903947315757] +description = "partial garden -> garden with two students" + +[2d620f45-9617-4924-9d27-751c80d17db9] +description = "partial garden -> multiple students for the same garden with three students -> second student's garden" + +[57712331-4896-4364-89f8-576421d69c44] +description = "partial garden -> multiple students for the same garden with three students -> third student's garden" + +[149b4290-58e1-40f2-8ae4-8b87c46e765b] +description = "full garden -> for Alice, first student's garden" + +[ba25dbbc-10bd-4a37-b18e-f89ecd098a5e] +description = "full garden -> for Bob, second student's garden" + +[566b621b-f18e-4c5f-873e-be30544b838c] +description = "full garden -> for Charlie" + +[3ad3df57-dd98-46fc-9269-1877abf612aa] +description = "full garden -> for David" + +[0f0a55d1-9710-46ed-a0eb-399ba8c72db2] +description = "full garden -> for Eve" + +[a7e80c90-b140-4ea1-aee3-f4625365c9a4] +description = "full garden -> for Fred" + +[9d94b273-2933-471b-86e8-dba68694c615] +description = "full garden -> for Ginny" + +[f55bc6c2-ade8-4844-87c4-87196f1b7258] +description = "full garden -> for Harriet" + +[759070a3-1bb1-4dd4-be2c-7cce1d7679ae] +description = "full garden -> for Ileana" + +[78578123-2755-4d4a-9c7d-e985b8dda1c6] +description = "full garden -> for Joseph" + +[6bb66df7-f433-41ab-aec2-3ead6e99f65b] +description = "full garden -> for Kincaid, second to last student's garden" + +[d7edec11-6488-418a-94e6-ed509e0fa7eb] +description = "full garden -> for Larry, last student's garden" diff --git a/exercises/practice/kindergarten-garden/kindergartenGarden.test.u b/exercises/practice/kindergarten-garden/kindergartenGarden.test.u new file mode 100644 index 0000000..884065a --- /dev/null +++ b/exercises/practice/kindergarten-garden/kindergartenGarden.test.u @@ -0,0 +1,112 @@ +kindergartenGarden.tests.defaultGarden : Text -> Garden +kindergartenGarden.tests.defaultGarden = + defaultStudents = [ + "Alice", "Bob", "Charlie", "David", "Eve", "Fred", + "Ginny", "Harriet", "Ileana", "Joseph", "Kincaid", "Larry" + ] + kindergartenGarden.garden defaultStudents + +kindergartenGarden.lookupPlants.tests.ex1 = + garden = kindergartenGarden.tests.defaultGarden "RC\nGG" + expect ([Radishes, Clover, Grass, Grass] === kindergartenGarden.lookupPlants "Alice" garden) + |> Test.label "partial garden - garden with single student" + +kindergartenGarden.lookupPlants.tests.ex2 = + garden = kindergartenGarden.tests.defaultGarden "VC\nRC" + expect ([Violets, Clover, Radishes, Clover] === kindergartenGarden.lookupPlants "Alice" garden) + |> Test.label "partial garden - different garden with single student" + +kindergartenGarden.lookupPlants.tests.ex3 = + garden = kindergartenGarden.tests.defaultGarden "VVCG\nVVRC" + expect ([Clover, Grass, Radishes, Clover] === kindergartenGarden.lookupPlants "Bob" garden) + |> Test.label "partial garden - garden with two students" + +kindergartenGarden.lookupPlants.tests.ex4 = + garden = kindergartenGarden.tests.defaultGarden "VVCCGG\nVVCCGG" + expect ([Clover, Clover, Clover, Clover] === kindergartenGarden.lookupPlants "Bob" garden) + |> Test.label "partial garden - multiple students for the same garden with three students - second student's garden" + +kindergartenGarden.lookupPlants.tests.ex5 = + garden = kindergartenGarden.tests.defaultGarden "VVCCGG\nVVCCGG" + expect ([Grass, Grass, Grass, Grass] === kindergartenGarden.lookupPlants "Charlie" garden) + |> Test.label "partial garden - multiple students for the same garden with three students - third student's garden" + +kindergartenGarden.lookupPlants.tests.ex6 = + garden = kindergartenGarden.tests.defaultGarden "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV" + expect ([Violets, Radishes, Violets, Radishes] === kindergartenGarden.lookupPlants "Alice" garden) + |> Test.label "full garden - for Alice, first student's garden" + +kindergartenGarden.lookupPlants.tests.ex7 = + garden = kindergartenGarden.tests.defaultGarden "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV" + expect ([Clover, Grass, Clover, Clover] === kindergartenGarden.lookupPlants "Bob" garden) + |> Test.label "full garden - for Bob, second student's garden" + +kindergartenGarden.lookupPlants.tests.ex8 = + garden = kindergartenGarden.tests.defaultGarden "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV" + expect ([Violets, Violets, Clover, Grass] === kindergartenGarden.lookupPlants "Charlie" garden) + |> Test.label "full garden - for Charlie" + +kindergartenGarden.lookupPlants.tests.ex9 = + garden = kindergartenGarden.tests.defaultGarden "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV" + expect ([Radishes, Violets, Clover, Radishes] === kindergartenGarden.lookupPlants "David" garden) + |> Test.label "full garden - for David" + +kindergartenGarden.lookupPlants.tests.ex10 = + garden = kindergartenGarden.tests.defaultGarden "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV" + expect ([Clover, Grass, Radishes, Grass] === kindergartenGarden.lookupPlants "Eve" garden) + |> Test.label "full garden - for Eve" + +kindergartenGarden.lookupPlants.tests.ex11 = + garden = kindergartenGarden.tests.defaultGarden "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV" + expect ([Grass, Clover, Violets, Clover] === kindergartenGarden.lookupPlants "Fred" garden) + |> Test.label "full garden - for Fred" + +kindergartenGarden.lookupPlants.tests.ex12 = + garden = kindergartenGarden.tests.defaultGarden "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV" + expect ([Clover, Grass, Grass, Clover] === kindergartenGarden.lookupPlants "Ginny" garden) + |> Test.label "full garden - for Ginny" + +kindergartenGarden.lookupPlants.tests.ex13 = + garden = kindergartenGarden.tests.defaultGarden "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV" + expect ([Violets, Radishes, Radishes, Violets] === kindergartenGarden.lookupPlants "Harriet" garden) + |> Test.label "full garden - for Harriet" + +kindergartenGarden.lookupPlants.tests.ex14 = + garden = kindergartenGarden.tests.defaultGarden "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV" + expect ([Grass, Clover, Violets, Clover] === kindergartenGarden.lookupPlants "Ileana" garden) + |> Test.label "full garden - for Ileana" + +kindergartenGarden.lookupPlants.tests.ex15 = + garden = kindergartenGarden.tests.defaultGarden "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV" + expect ([Violets, Clover, Violets, Grass] === kindergartenGarden.lookupPlants "Joseph" garden) + |> Test.label "full garden - for Joseph" + +kindergartenGarden.lookupPlants.tests.ex16 = + garden = kindergartenGarden.tests.defaultGarden "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV" + expect ([Grass, Clover, Clover, Grass] === kindergartenGarden.lookupPlants "Kincaid" garden) + |> Test.label "full garden - for Kincaid, second to last student's garden" + +kindergartenGarden.lookupPlants.tests.ex17 = + garden = kindergartenGarden.tests.defaultGarden "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV" + expect ([Grass, Violets, Clover, Violets] === kindergartenGarden.lookupPlants "Larry" garden) + |> Test.label "full garden - for Larry, last student's garden" + +test> kindergartenGarden.tests = runAll [ + kindergartenGarden.lookupPlants.tests.ex1, + kindergartenGarden.lookupPlants.tests.ex2, + kindergartenGarden.lookupPlants.tests.ex3, + kindergartenGarden.lookupPlants.tests.ex4, + kindergartenGarden.lookupPlants.tests.ex5, + kindergartenGarden.lookupPlants.tests.ex6, + kindergartenGarden.lookupPlants.tests.ex7, + kindergartenGarden.lookupPlants.tests.ex8, + kindergartenGarden.lookupPlants.tests.ex9, + kindergartenGarden.lookupPlants.tests.ex10, + kindergartenGarden.lookupPlants.tests.ex11, + kindergartenGarden.lookupPlants.tests.ex12, + kindergartenGarden.lookupPlants.tests.ex13, + kindergartenGarden.lookupPlants.tests.ex14, + kindergartenGarden.lookupPlants.tests.ex15, + kindergartenGarden.lookupPlants.tests.ex16, + kindergartenGarden.lookupPlants.tests.ex17 +] diff --git a/exercises/practice/kindergarten-garden/kindergartenGarden.u b/exercises/practice/kindergarten-garden/kindergartenGarden.u new file mode 100644 index 0000000..6fdb71e --- /dev/null +++ b/exercises/practice/kindergarten-garden/kindergartenGarden.u @@ -0,0 +1,20 @@ +unique type kindergartenGarden.Plant + = Clover + | Grass + | Radishes + | Violets + +unique type kindergartenGarden.Garden + = todo "implement Garden type" + +{{ + Accepts a list of students' names and raw garden diagram and returns Garden type. +}} +kindergartenGarden.garden : [Text] -> Text -> Garden +kindergartenGarden.garden = todo "implement garden" + +{{ + Accepts student's name and Garden and returns list of plants. +}} +kindergartenGarden.lookupPlants : Text -> Garden -> [Plant] +kindergartenGarden.lookupPlants = todo "implement lookupPlants"