From e114ca9fe0a6d046674848483d9ad22b77086cc4 Mon Sep 17 00:00:00 2001 From: depial <91621102+depial@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:48:47 -0400 Subject: [PATCH] updates to config.json and other files --- config.json | 2 +- exercises/concept/cater-waiter/.docs/hints.md | 61 +++++++++++++++++++ .../concept/cater-waiter/.meta/config.json | 5 +- .../concept/cater-waiter/.meta/exemplar.jl | 2 +- .../cater-waiter/{cater-waiter.jl => sets.jl} | 0 5 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 exercises/concept/cater-waiter/.docs/hints.md rename exercises/concept/cater-waiter/{cater-waiter.jl => sets.jl} (100%) diff --git a/config.json b/config.json index ac57c273..a4ae0b28 100644 --- a/config.json +++ b/config.json @@ -59,7 +59,7 @@ "status": "wip" }, { - "slug": "cater-waiter", + "slug": "sets", "name": "cater-waiter", "uuid": "40c83f3e-cf87-4f00-9205-8c002b419a8d", "concepts": [ diff --git a/exercises/concept/cater-waiter/.docs/hints.md b/exercises/concept/cater-waiter/.docs/hints.md new file mode 100644 index 00000000..598ca36a --- /dev/null +++ b/exercises/concept/cater-waiter/.docs/hints.md @@ -0,0 +1,61 @@ +# Hints + +## General + +- [Sets][sets] are mutable, unordered collections with no duplicate elements. +- Sets can contain any data type. +- Sets are [iterable][iterable]. +- Sets are most often used to quickly dedupe other collections or for membership testing. +- Sets also support mathematical operations like `union`, `intersection`, `difference`, and `symmetric difference` + +## 1. Clean up Dish Ingredients + +- The `set()` constructor can take any [iterable][iterable] as an argument. Vectors are iterable. +- Remember: Tuples can be formed using `(, )`. + +## 2. Cocktails and Mocktails + +- A `Set` is _disjoint_ from another set if the two sets share no elements. +- The `Set()` constructor can take any [iterable][iterable] as an argument. Vectors are iterable. +- Strings can be concatenated with the `*` sign and interpolation can be done via `$()`. + +## 3. Categorize Dishes + +- Using loops to iterate through the available meal categories might be useful here. +- If all the elements of `` are contained within ``, then ``. +- The method equivalent of `⊆` is `issubset(, )` +- Tuples can contain any data type, including other tuples. Tuples can be formed using `(, )`. +- Elements within Tuples can be accessed from the left using a 1-based index number, or from the right using an `end`-based index number (e.g. `[end]`). +- The `Set()` constructor can take any [iterable][iterable] as an argument. Vectors are iterable. +- Strings can be concatenated with the `*` sign and interpolation can be done via `$()`. + +## 4. Label Allergens and Restricted Foods + +- A set _intersection_ are the elements shared between `` and ``. +- The set method equivalent of `∩` is `intersect(, )` or `∩(, )`. +- Elements within Tuples can be accessed from the left using a 1-based index number, or from the right using an `end`-based index number (e.g. `[end]`). +- The `Set()` constructor can take any [iterable][iterable] as an argument. Vectors are iterable. +- Tuples can be formed using `(, )`. + +## 5. Compile a "Master List" of Ingredients + +- A set _union_ is where elements of ` and `` are combined into a single `set` +- The set method equivalent of `∪` is `union(, )` or `∪(, )` +- Using loops to iterate through the various dishes might be useful here. + +## 6. Pull out Appetizers for Passing on Trays + +- A set _difference_ is where the elements of `` are removed from ``, e.g. `setdiff(, )`. +- The `Set()` constructor can take any [iterable][iterable] as an argument. Vectors are iterable. +- The Vector constructor can take any [iterable][iterable] as an argument. Sets are iterable. + +## 7. Find Ingredients Used in Only One Recipe + +- A set _symmetric difference_ is where elements appear in `` or ``, but not **_both_** sets. +- A set _symmetric difference_ is the same as subtracting the `set` _intersection_ from the `set` _union_, e.g. `setdiff(, )` +- A _symmetric difference_ of more than two `Sets` will include elements that are repeated more than two times across the input `Sets`. To remove these cross-set repeated elements, the _intersections_ between set pairs needs to be subtracted from the symmetric difference. +- Using looops to iterate through the various dishes might be useful here. + + +[iterable]: https://docs.julialang.org/en/v1/base/collections/#Iterable-Collections +[sets]: https://docs.julialang.org/en/v1/base/collections/#Base.Set diff --git a/exercises/concept/cater-waiter/.meta/config.json b/exercises/concept/cater-waiter/.meta/config.json index 5ee0a5b3..6c9c2f23 100644 --- a/exercises/concept/cater-waiter/.meta/config.json +++ b/exercises/concept/cater-waiter/.meta/config.json @@ -4,7 +4,7 @@ ], "files": { "solution": [ - "cater-waiter.jl" + "sets.jl" ], "test": [ "runtests.jl" @@ -13,5 +13,6 @@ ".meta/exemplar.jl" ] }, - "blurb": "A Set in Julia is an unordered collection of unique entries, with fast algorithms for contains, union, intersection and difference operations." + "icon": "meetup", + "blurb": "Learn about sets by managing the menus and ingredients for your catering company's event." } diff --git a/exercises/concept/cater-waiter/.meta/exemplar.jl b/exercises/concept/cater-waiter/.meta/exemplar.jl index dc483e2d..d91bbef2 100644 --- a/exercises/concept/cater-waiter/.meta/exemplar.jl +++ b/exercises/concept/cater-waiter/.meta/exemplar.jl @@ -1,6 +1,6 @@ """Functions for compiling dishes and ingredients for a catering company.""" -include(joinpath(dirname(@__DIR__), "sets_categories_data.jl")) +include("sets_categories_data.jl") """Remove duplicates from `dish_ingredients`. diff --git a/exercises/concept/cater-waiter/cater-waiter.jl b/exercises/concept/cater-waiter/sets.jl similarity index 100% rename from exercises/concept/cater-waiter/cater-waiter.jl rename to exercises/concept/cater-waiter/sets.jl