Skip to content

Commit 19ed444

Browse files
authored
housekeeping: sync docs and tests (#348)
1 parent 73c0ea9 commit 19ed444

File tree

6 files changed

+58
-15
lines changed

6 files changed

+58
-15
lines changed

exercises/practice/custom-set/.meta/tests.toml

+3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ description = "Difference (or Complement) of a set is a set of all elements that
114114
[c5ac673e-d707-4db5-8d69-7082c3a5437e]
115115
description = "Difference (or Complement) of a set is a set of all elements that are only in the first set -> difference of two non-empty sets is a set of elements that are only in the first set"
116116

117+
[20d0a38f-7bb7-4c4a-ac15-90c7392ecf2b]
118+
description = "Difference (or Complement) of a set is a set of all elements that are only in the first set -> difference removes all duplicates in the first set"
119+
117120
[c45aed16-5494-455a-9033-5d4c93589dc6]
118121
description = "Union returns a set of all elements in either set -> union of empty sets is an empty set"
119122

exercises/practice/custom-set/custom-set.test

+8
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,14 @@ test set-8.4 "difference of two non-empty sets is a set of elements that are onl
293293
$s3 toList
294294
} -returnCodes ok -match unorderedLists -result {1 3}
295295

296+
skip set-8.5
297+
test set-8.5 "difference removes all duplicates in the first set" -body {
298+
set s1 [Set new {1 1}]
299+
set s2 [Set new {1}]
300+
set s3 [$s1 difference $s2]
301+
$s3 toList
302+
} -returnCodes ok -match unorderedLists -result {}
303+
296304
# Union returns a set of all elements in either set
297305
skip set-9.1
298306
test set-9.1 "union of empty sets is an empty set" -body {
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Instructions
22

33
Given a string containing brackets `[]`, braces `{}`, parentheses `()`, or any combination thereof, verify that any and all pairs are matched and nested correctly.
4-
The string may also contain other characters, which for the purposes of this exercise should be ignored.
4+
Any other characters should be ignored.
5+
For example, `"{what is (42)}?"` is balanced and `"[text}"` is not.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Introduction
2+
3+
You're given the opportunity to write software for the Bracketeer™, an ancient but powerful mainframe.
4+
The software that runs on it is written in a proprietary language.
5+
Much of its syntax is familiar, but you notice _lots_ of brackets, braces and parentheses.
6+
Despite the Bracketeer™ being powerful, it lacks flexibility.
7+
If the source code has any unbalanced brackets, braces or parentheses, the Bracketeer™ crashes and must be rebooted.
8+
To avoid such a scenario, you start writing code that can verify that brackets, braces, and parentheses are balanced before attempting to run it on the Bracketeer™.
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
# Instructions
22

3-
Given an age in seconds, calculate how old someone would be on:
3+
Given an age in seconds, calculate how old someone would be on a planet in our Solar System.
44

5-
- Mercury: orbital period 0.2408467 Earth years
6-
- Venus: orbital period 0.61519726 Earth years
7-
- Earth: orbital period 1.0 Earth years, 365.25 Earth days, or 31557600 seconds
8-
- Mars: orbital period 1.8808158 Earth years
9-
- Jupiter: orbital period 11.862615 Earth years
10-
- Saturn: orbital period 29.447498 Earth years
11-
- Uranus: orbital period 84.016846 Earth years
12-
- Neptune: orbital period 164.79132 Earth years
5+
One Earth year equals 365.25 Earth days, or 31,557,600 seconds.
6+
If you were told someone was 1,000,000,000 seconds old, their age would be 31.69 Earth-years.
137

14-
So if you were told someone were 1,000,000,000 seconds old, you should
15-
be able to say that they're 31.69 Earth-years old.
8+
For the other planets, you have to account for their orbital period in Earth Years:
169

17-
If you're wondering why Pluto didn't make the cut, go watch [this YouTube video][pluto-video].
10+
| Planet | Orbital period in Earth Years |
11+
| ------- | ----------------------------- |
12+
| Mercury | 0.2408467 |
13+
| Venus | 0.61519726 |
14+
| Earth | 1.0 |
15+
| Mars | 1.8808158 |
16+
| Jupiter | 11.862615 |
17+
| Saturn | 29.447498 |
18+
| Uranus | 84.016846 |
19+
| Neptune | 164.79132 |
1820

19-
Note: The actual length of one complete orbit of the Earth around the sun is closer to 365.256 days (1 sidereal year).
21+
~~~~exercism/note
22+
The actual length of one complete orbit of the Earth around the sun is closer to 365.256 days (1 sidereal year).
2023
The Gregorian calendar has, on average, 365.2425 days.
2124
While not entirely accurate, 365.25 is the value used in this exercise.
2225
See [Year on Wikipedia][year] for more ways to measure a year.
2326
24-
[pluto-video]: https://www.youtube.com/watch?v=Z_2gbGXzFbs
2527
[year]: https://en.wikipedia.org/wiki/Year#Summary
28+
~~~~
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Introduction
2+
3+
The year is 2525 and you've just embarked on a journey to visit all planets in the Solar System (Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus and Neptune).
4+
The first stop is Mercury, where customs require you to fill out a form (bureaucracy is apparently _not_ Earth-specific).
5+
As you hand over the form to the customs officer, they scrutinize it and frown.
6+
"Do you _really_ expect me to believe you're just 50 years old?
7+
You must be closer to 200 years old!"
8+
9+
Amused, you wait for the customs officer to start laughing, but they appear to be dead serious.
10+
You realize that you've entered your age in _Earth years_, but the officer expected it in _Mercury years_!
11+
As Mercury's orbital period around the sun is significantly shorter than Earth, you're actually a lot older in Mercury years.
12+
After some quick calculations, you're able to provide your age in Mercury Years.
13+
The customs officer smiles, satisfied, and waves you through.
14+
You make a mental note to pre-calculate your planet-specific age _before_ future customs checks, to avoid such mix-ups.
15+
16+
~~~~exercism/note
17+
If you're wondering why Pluto didn't make the cut, go watch [this YouTube video][pluto-video].
18+
19+
[pluto-video]: https://www.youtube.com/watch?v=Z_2gbGXzFbs
20+
~~~~

0 commit comments

Comments
 (0)