diff --git a/README.md b/README.md index f5e4a70d..0745e6fc 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Exercism exercises in Pyret. If you're solving Exercism exercises offline, you'll need a recent copy of [pyret-npm](https://www.npmjs.com/package/pyret-npm) (0.0.27+). Currently, pyret-npm works on Linux and MacOS platforms although Windows users can run it via the [WSL](https://learn.microsoft.com/en-us/windows/wsl/). However, you can also use [Pyret's online IDE](https://code.pyret.org/). -In that case, you'll need to switch from the IDE's default `essentials2021` namespace to the older `essentials2020` supported by pyret-npm. +In that case, you'll need to switch from the IDE's default `essentials2021` namespace to the older `starter2024` supported by pyret-npm. ## Support @@ -28,52 +28,22 @@ This command will iterate over all exercises and check to see if their exemplar/ Please see [Exercism's contributing guide](https://exercism.org/docs/building). -At the moment, there's not a generator for Pyret exercises. - -Here's the basic template for an `exercise-slug-test`.arr. -Each `check` block corresponds to a single test case, and the string label is reported to the student. -Each `check` block is wrapped inside a no-parameter function which is then stored inside the `run` field of a `test` value of the `TestRun` datatype. -This `test` value also contains an `active` field which indicates whether a test should be run (`true`) or not (`false`). -All `test` values go inside a list that Pyret iterates over at runtime, executing the functions within each `test` value marked as active. - -A contributor is responsible for copying this template, adding the appropriate functions and `check` blocks, and populating the list at the bottom. +Here's the basic template for an `-test.arr`. +Each `check` block corresponds to a single test case, and its label is reported to the student. ```pyret -use context essentials2020 - -include file("exercise-slug.arr") +use context starter2024 -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +include file(".arr") -fun foo-returns-1(): - check "foo returns 1": - foo() is 1 - end +check "foo returns 1": + foo() is 1 end -fun bar-returns-2(): - check "bar returns 2": - bar() is 2 - end +check "bar returns 2": + bar() is 2 end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(foo-returns-1, true), - test(bar-returns-2, false), -].each(lam(t): when t.active: t.run() end end) ``` ## Track linting diff --git a/bin/verify-exercises b/bin/verify-exercises index 66e56c22..27cbaf00 100755 --- a/bin/verify-exercises +++ b/bin/verify-exercises @@ -41,12 +41,10 @@ for practice_exercise_dir in ./exercises/practice/*/; do test_file="$practice_exercise_dir/$exercise"-test.arr - sed -i.bak 's/test(\([^)]*\), false/test(\1, true/' $test_file redirect_file="$practice_exercise_dir/$exercise".out npx pyret -q $test_file &> $redirect_file test_output=$(cat $redirect_file) rm $redirect_file - mv "${test_file}.bak" "$test_file" test_success=$(echo "${test_output}" | grep -c -E 'Looks shipshape') if [[ $test_success -le 0 ]]; then diff --git a/docs/TESTS.md b/docs/TESTS.md index a4d8dd45..c2b14cbe 100644 --- a/docs/TESTS.md +++ b/docs/TESTS.md @@ -1,52 +1,20 @@ # Testing on the Pyret track -## Testing using the web editor +## Getting Started -To run tests, click the "Run Tests" button and all the tests will be run. +After you successfully download an exercise, there will be several files inside, but the most two important are your solution and test files. +In the following example, we've downloaded the Leap exercise. -## Testing locally - -Before working locally, see the [installation docs][installation] to set up Pyret. - -Each exercise has multiple tests. -When you first download the exercise, only one test will be enabled. -The recommended workflow is to run the test (which should initially fail) and then make changes to your code until that test passes. -Then, enable the next test in the test file (see below for details) and repeat this process(modify the code, run tests, and move on) until all the tests pass. -Some students preemptively enable all the tests before working on the code; this can be overwhelming with how many tests are failing and make it harder to solve the exercise. - -### Running tests - -Each exercise will have a solution file and a test file. -For instance, the Hello World exercise has both a `hello-world.arr` file and a `hello-world-test.arr` file. -Your code will go into `hello-world.arr`. -To run tests, execute the `pyret` command with the test file as an argument. -For instance, running `pyret hello-world-test.arr` in the `hello-world` directory will run the currently enabled Hello World tests. - -### Enabling tests - -Every test file has one or more tests, each test wrapped in its own function. -At the bottom, there is a list of `TestRun` values representing the tests to be run. -Each test in the list contains two values: the test function to run and an `active` value which controls whether the test will be executed. -For instance, the `etl-test.arr` file contains four tests, with the first active and the rest inactive. - -```pyret -data TestRun: test(run, active) end - -[list: - test(single-letter, true), - test(single-score-multiple-letters, false), - test(multiple-scores-multiple-letters, false), - test(multiple-scores-different-numbers-of-letters, false) -].each(lam(t): when t.active: t.run() end end) +```bash +leap/ +├── leap.arr # Solution file - your code goes here +├── leap-test.arr # Test cases for the exercise ``` -To enable additional tests, change the `active` value from `false` to `true`, and then rerun the test file with the `pyret` command. - -~~~~exercism/note -If whle working offline you forget to enable all the tests, Pyret may report that all the (active) tests are passing locally. -When you submit your code, the website may report some tests are not passing (as it may be running additional tests which did not run locally). -~~~~ +To run the tests, either use `exercism test` if you've downloaded the official Exercism CLI or run `pyret leap-test.arr`. +Pyret will run the test suite which consists of a series of labeled `check` blocks that test your solution file against specific inputs and expected results. +A critical part of this process is explicitly exporting portions of your code so the test suite can see it. ## provide @@ -91,10 +59,7 @@ end All exercise stubs will have either `provide` or `provide-types` statements set up for your use. -[installation]: https://exercism.org/docs/tracks/pyret/installation [provide-statement]: https://pyret.org/docs/latest/Provide_Statements.html [shadowing]: https://pyret.org/docs/latest/Bindings.html#%28part._s~3ashadowing%29 [data-definition]: https://pyret.org/docs/latest/s_declarations.html#%28elem._%28bnf-prod._%28.Pyret._data-decl%29%29%29 [provide-types-statement]: https://pyret.org/docs/latest/Provide_Statements.html - - diff --git a/exercises/practice/acronym/.meta/example.arr b/exercises/practice/acronym/.meta/example.arr index d66054d0..3a802cd2 100644 --- a/exercises/practice/acronym/.meta/example.arr +++ b/exercises/practice/acronym/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: abbreviate end diff --git a/exercises/practice/acronym/acronym-test.arr b/exercises/practice/acronym/acronym-test.arr index de862676..7b838f12 100644 --- a/exercises/practice/acronym/acronym-test.arr +++ b/exercises/practice/acronym/acronym-test.arr @@ -1,83 +1,39 @@ -use context essentials2020 +use context starter2024 include file("acronym.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun basic(): - check "basic": - abbreviate("Portable Network Graphics") is "PNG" - end +check "basic": + abbreviate("Portable Network Graphics") is "PNG" end -fun lowercase-words(): - check "lowercase words": - abbreviate("Ruby on Rails") is "ROR" - end +check "lowercase words": + abbreviate("Ruby on Rails") is "ROR" end -fun punctuation(): - check "punctuation": - abbreviate("First In, First Out") is "FIFO" - end +check "punctuation": + abbreviate("First In, First Out") is "FIFO" end -fun all-caps-word(): - check "all caps word": - abbreviate("GNU Image Manipulation Program") is "GIMP" - end +check "all caps word": + abbreviate("GNU Image Manipulation Program") is "GIMP" end -fun punctuation-without-whitespace(): - check "punctuation without whitespace": - abbreviate("Complementary metal-oxide semiconductor") is "CMOS" - end +check "punctuation without whitespace": + abbreviate("Complementary metal-oxide semiconductor") is "CMOS" end -fun very-long-abbreviation(): - check "very long abbreviation": - abbreviate("Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me") is "ROTFLSHTMDCOALM" - end +check "very long abbreviation": + abbreviate("Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me") is "ROTFLSHTMDCOALM" end -fun consecutive-delimiters(): - check "consecutive delimiters": - abbreviate("Something - I made up from thin air") is "SIMUFTA" - end +check "consecutive delimiters": + abbreviate("Something - I made up from thin air") is "SIMUFTA" end -fun apostrophes(): - check "apostrophes": - abbreviate("Halley's Comet") is "HC" - end +check "apostrophes": + abbreviate("Halley's Comet") is "HC" end -fun underscore-emphasis(): - check "underscore emphasis": - abbreviate("The Road _Not_ Taken") is "TRNT" - end +check "underscore emphasis": + abbreviate("The Road _Not_ Taken") is "TRNT" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(basic, true), - test(lowercase-words, false), - test(punctuation, false), - test(all-caps-word, false), - test(punctuation-without-whitespace, false), - test(very-long-abbreviation, false), - test(consecutive-delimiters, false), - test(apostrophes, false), - test(underscore-emphasis, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/acronym/acronym.arr b/exercises/practice/acronym/acronym.arr index 68186ce6..23f79d9c 100644 --- a/exercises/practice/acronym/acronym.arr +++ b/exercises/practice/acronym/acronym.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: abbreviate end diff --git a/exercises/practice/allergies/.meta/example.arr b/exercises/practice/allergies/.meta/example.arr index 7ce3f13c..0ac1f598 100644 --- a/exercises/practice/allergies/.meta/example.arr +++ b/exercises/practice/allergies/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * @@ -37,4 +37,4 @@ data Allergies: filtered(ALLERGENS, self.score) end -end \ No newline at end of file +end diff --git a/exercises/practice/allergies/allergies-test.arr b/exercises/practice/allergies/allergies-test.arr index 93ed2c23..322c1fa3 100644 --- a/exercises/practice/allergies/allergies-test.arr +++ b/exercises/practice/allergies/allergies-test.arr @@ -1,458 +1,291 @@ -use context essentials2020 +use context starter2024 include file("allergies.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - # Eggs -fun eggs-allergy-not-allergic-to-anything(): - check "Eggs allergy - not allergic to anything": - allergens = allergies(0) - allergens.allergicTo("eggs") is false - end +check "Eggs allergy - not allergic to anything": + allergens = allergies(0) + allergens.allergicTo("eggs") is false end -fun eggs-allergy-allergic-only-to-eggs(): - check "Eggs allergy - allergic only to eggs": - allergens = allergies(1) - allergens.allergicTo("eggs") is true - end +check "Eggs allergy - allergic only to eggs": + allergens = allergies(1) + allergens.allergicTo("eggs") is true end -fun eggs-allergy-allergic-to-eggs-and-something-else(): - check "Eggs allergy - allergic to eggs and something else": - allergens = allergies(3) - allergens.allergicTo("eggs") is true - end +check "Eggs allergy - allergic to eggs and something else": + allergens = allergies(3) + allergens.allergicTo("eggs") is true end -fun eggs-allergy-allergic-to-something-but-not-eggs(): - check "Eggs allergy - allergic to something, but not eggs": - allergens = allergies(2) - allergens.allergicTo("eggs") is false - end +check "Eggs allergy - allergic to something, but not eggs": + allergens = allergies(2) + allergens.allergicTo("eggs") is false end -fun eggs-allergy-allergic-to-everything(): - check "Eggs allergy - allergic to everything": - allergens = allergies(255) - allergens.allergicTo("eggs") is true - end +check "Eggs allergy - allergic to everything": + allergens = allergies(255) + allergens.allergicTo("eggs") is true end # Peanuts -fun peanuts-allergy-not-allergic-to-anything(): - check "peanuts allergy - not allergic to anything": - allergens = allergies(0) - allergens.allergicTo("peanuts") is false - end +check "peanuts allergy - not allergic to anything": + allergens = allergies(0) + allergens.allergicTo("peanuts") is false end -fun peanuts-allergy-allergic-only-to-peanuts(): - check "peanuts allergy - allergic only to peanuts": - allergens = allergies(2) - allergens.allergicTo("peanuts") is true - end +check "peanuts allergy - allergic only to peanuts": + allergens = allergies(2) + allergens.allergicTo("peanuts") is true end -fun peanuts-allergy-allergic-to-peanuts-and-something-else(): - check "peanuts allergy - allergic to peanuts and something else": - allergens = allergies(7) - allergens.allergicTo("peanuts") is true - end +check "peanuts allergy - allergic to peanuts and something else": + allergens = allergies(7) + allergens.allergicTo("peanuts") is true end -fun peanuts-allergy-allergic-to-something-but-not-peanuts(): - check "peanuts allergy - allergic to something, but not peanuts": - allergens = allergies(5) - allergens.allergicTo("peanuts") is false - end +check "peanuts allergy - allergic to something, but not peanuts": + allergens = allergies(5) + allergens.allergicTo("peanuts") is false end -fun peanuts-allergy-allergic-to-everything(): - check "peanuts allergy - allergic to everything": - allergens = allergies(255) - allergens.allergicTo("peanuts") is true - end +check "peanuts allergy - allergic to everything": + allergens = allergies(255) + allergens.allergicTo("peanuts") is true end # Shellfish -fun shellfish-allergy-not-allergic-to-anything(): - check "shellfish allergy - not allergic to anything": - allergens = allergies(0) - allergens.allergicTo("shellfish") is false - end +check "shellfish allergy - not allergic to anything": + allergens = allergies(0) + allergens.allergicTo("shellfish") is false end -fun shellfish-allergy-allergic-only-to-shellfish(): - check "shellfish allergy - allergic only to shellfish": - allergens = allergies(4) - allergens.allergicTo("shellfish") is true - end +check "shellfish allergy - allergic only to shellfish": + allergens = allergies(4) + allergens.allergicTo("shellfish") is true end -fun shellfish-allergy-allergic-to-shellfish-and-something-else(): - check "shellfish allergy - allergic to shellfish and something else": - allergens = allergies(14) - allergens.allergicTo("shellfish") is true - end +check "shellfish allergy - allergic to shellfish and something else": + allergens = allergies(14) + allergens.allergicTo("shellfish") is true end -fun shellfish-allergy-allergic-to-something-but-not-shellfish(): - check "shellfish allergy - allergic to something, but not shellfish": - allergens = allergies(10) - allergens.allergicTo("shellfish") is false - end +check "shellfish allergy - allergic to something, but not shellfish": + allergens = allergies(10) + allergens.allergicTo("shellfish") is false end -fun shellfish-allergy-allergic-to-everything(): - check "shellfish allergy - allergic to everything": - allergens = allergies(255) - allergens.allergicTo("shellfish") is true - end +check "shellfish allergy - allergic to everything": + allergens = allergies(255) + allergens.allergicTo("shellfish") is true end # Strawberries -fun strawberries-allergy-not-allergic-to-anything(): - check "strawberries allergy - not allergic to anything": - allergens = allergies(0) - allergens.allergicTo("strawberries") is false - end +check "strawberries allergy - not allergic to anything": + allergens = allergies(0) + allergens.allergicTo("strawberries") is false end -fun strawberries-allergy-allergic-only-to-strawberries(): - check "strawberries allergy - allergic only to strawberries": - allergens = allergies(8) - allergens.allergicTo("strawberries") is true - end +check "strawberries allergy - allergic only to strawberries": + allergens = allergies(8) + allergens.allergicTo("strawberries") is true end -fun strawberries-allergy-allergic-to-strawberries-and-something-else(): - check "strawberries allergy - allergic to strawberries and something else": - allergens = allergies(28) - allergens.allergicTo("strawberries") is true - end +check "strawberries allergy - allergic to strawberries and something else": + allergens = allergies(28) + allergens.allergicTo("strawberries") is true end -fun strawberries-allergy-allergic-to-something-but-not-strawberries(): - check "strawberries allergy - allergic to something, but not strawberries": - allergens = allergies(20) - allergens.allergicTo("strawberries") is false - end +check "strawberries allergy - allergic to something, but not strawberries": + allergens = allergies(20) + allergens.allergicTo("strawberries") is false end -fun strawberries-allergy-allergic-to-everything(): - check "strawberries allergy - allergic to everything": - allergens = allergies(255) - allergens.allergicTo("strawberries") is true - end +check "strawberries allergy - allergic to everything": + allergens = allergies(255) + allergens.allergicTo("strawberries") is true end # Tomatoes -fun tomatoes-allergy-not-allergic-to-anything(): - check "tomatoes allergy - not allergic to anything": - allergens = allergies(0) - allergens.allergicTo("tomatoes") is false - end +check "tomatoes allergy - not allergic to anything": + allergens = allergies(0) + allergens.allergicTo("tomatoes") is false end -fun tomatoes-allergy-allergic-only-to-tomatoes(): - check "tomatoes allergy - allergic only to tomatoes": - allergens = allergies(16) - allergens.allergicTo("tomatoes") is true - end +check "tomatoes allergy - allergic only to tomatoes": + allergens = allergies(16) + allergens.allergicTo("tomatoes") is true end -fun tomatoes-allergy-allergic-to-tomatoes-and-something-else(): - check "tomatoes allergy - allergic to tomatoes and something else": - allergens = allergies(56) - allergens.allergicTo("tomatoes") is true - end +check "tomatoes allergy - allergic to tomatoes and something else": + allergens = allergies(56) + allergens.allergicTo("tomatoes") is true end -fun tomatoes-allergy-allergic-to-something-but-not-tomatoes(): - check "tomatoes allergy - allergic to something, but not tomatoes": - allergens = allergies(40) - allergens.allergicTo("tomatoes") is false - end +check "tomatoes allergy - allergic to something, but not tomatoes": + allergens = allergies(40) + allergens.allergicTo("tomatoes") is false end -fun tomatoes-allergy-allergic-to-everything(): - check "tomatoes allergy - allergic to everything": - allergens = allergies(255) - allergens.allergicTo("tomatoes") is true - end +check "tomatoes allergy - allergic to everything": + allergens = allergies(255) + allergens.allergicTo("tomatoes") is true end # Chocolate -fun chocolate-allergy-not-allergic-to-anything(): - check "chocolate allergy - not allergic to anything": - allergens = allergies(0) - allergens.allergicTo("chocolate") is false - end +check "chocolate allergy - not allergic to anything": + allergens = allergies(0) + allergens.allergicTo("chocolate") is false end -fun chocolate-allergy-allergic-only-to-chocolate(): - check "chocolate allergy - allergic only to chocolate": - allergens = allergies(32) - allergens.allergicTo("chocolate") is true - end +check "chocolate allergy - allergic only to chocolate": + allergens = allergies(32) + allergens.allergicTo("chocolate") is true end -fun chocolate-allergy-allergic-to-chocolate-and-something-else(): - check "chocolate allergy - allergic to chocolate and something else": - allergens = allergies(112) - allergens.allergicTo("chocolate") is true - end +check "chocolate allergy - allergic to chocolate and something else": + allergens = allergies(112) + allergens.allergicTo("chocolate") is true end -fun chocolate-allergy-allergic-to-something-but-not-chocolate(): - check "chocolate allergy - allergic to something, but not chocolate": - allergens = allergies(80) - allergens.allergicTo("chocolate") is false - end +check "chocolate allergy - allergic to something, but not chocolate": + allergens = allergies(80) + allergens.allergicTo("chocolate") is false end -fun chocolate-allergy-allergic-to-everything(): - check "chocolate allergy - allergic to everything": - allergens = allergies(255) - allergens.allergicTo("chocolate") is true - end +check "chocolate allergy - allergic to everything": + allergens = allergies(255) + allergens.allergicTo("chocolate") is true end # Pollen -fun pollen-allergy-not-allergic-to-anything(): - check "pollen allergy - not allergic to anything": - allergens = allergies(0) - allergens.allergicTo("pollen") is false - end +check "pollen allergy - not allergic to anything": + allergens = allergies(0) + allergens.allergicTo("pollen") is false end -fun pollen-allergy-allergic-only-to-pollen(): - check "pollen allergy - allergic only to pollen": - allergens = allergies(64) - allergens.allergicTo("pollen") is true - end +check "pollen allergy - allergic only to pollen": + allergens = allergies(64) + allergens.allergicTo("pollen") is true end -fun pollen-allergy-allergic-to-pollen-and-something-else(): - check "pollen allergy - allergic to pollen and something else": - allergens = allergies(224) - allergens.allergicTo("pollen") is true - end +check "pollen allergy - allergic to pollen and something else": + allergens = allergies(224) + allergens.allergicTo("pollen") is true end -fun pollen-allergy-allergic-to-something-but-not-pollen(): - check "pollen allergy - allergic to something, but not pollen": - allergens = allergies(160) - allergens.allergicTo("pollen") is false - end +check "pollen allergy - allergic to something, but not pollen": + allergens = allergies(160) + allergens.allergicTo("pollen") is false end -fun pollen-allergy-allergic-to-everything(): - check "pollen allergy - allergic to everything": - allergens = allergies(255) - allergens.allergicTo("pollen") is true - end +check "pollen allergy - allergic to everything": + allergens = allergies(255) + allergens.allergicTo("pollen") is true end # Cats -fun cats-allergy-not-allergic-to-anything(): - check "cats allergy - not allergic to anything": - allergens = allergies(0) - allergens.allergicTo("cats") is false - end +check "cats allergy - not allergic to anything": + allergens = allergies(0) + allergens.allergicTo("cats") is false end -fun cats-allergy-allergic-only-to-cats(): - check "cats allergy - allergic only to cats": - allergens = allergies(128) - allergens.allergicTo("cats") is true - end +check "cats allergy - allergic only to cats": + allergens = allergies(128) + allergens.allergicTo("cats") is true end -fun cats-allergy-allergic-to-cats-and-something-else(): - check "cats allergy - allergic to cats and something else": - allergens = allergies(192) - allergens.allergicTo("cats") is true - end +check "cats allergy - allergic to cats and something else": + allergens = allergies(192) + allergens.allergicTo("cats") is true end -fun cats-allergy-allergic-to-something-but-not-cats(): - check "cats allergy - allergic to something, but not cats": - allergens = allergies(64) - allergens.allergicTo("cats") is false - end +check "cats allergy - allergic to something, but not cats": + allergens = allergies(64) + allergens.allergicTo("cats") is false end -fun cats-allergy-allergic-to-everything(): - check "cats allergy - allergic to everything": - allergens = allergies(255) - allergens.allergicTo("cats") is true - end +check "cats allergy - allergic to everything": + allergens = allergies(255) + allergens.allergicTo("cats") is true end # List -fun list-when-no-allergies(): - check "list when no allergies": - allergens = allergies(0) - allergens.list() is [list: ] - end -end - -fun list-when-just-eggs(): - check "list when just eggs": - allergens = allergies(1) - allergens.list() is [list: "eggs"] - end -end - -fun list-when-just-peanuts(): - check "list when just peanuts": - allergens = allergies(2) - allergens.list() is [list: "peanuts"] - end -end - -fun list-when-just-strawberries(): - check "list when just strawberries": - allergens = allergies(8) - allergens.list() is [list: "strawberries"] - end -end - -fun list-when-eggs-and-peanuts(): - check "list when eggs and peanuts": - allergens = allergies(3) - allergens.list() is [list: "eggs", "peanuts"] - end -end - -fun list-when-more-than-eggs-but-not-peanuts(): - check "list when more than eggs but not peanuts": - allergens = allergies(5) - allergens.list() is [list: "eggs", "shellfish"] - end -end - -fun list-when-lots-of-stuff(): - check "list when lots of stuff": - allergens = allergies(248) - allergens.list() is [list: - "strawberries", - "tomatoes", - "chocolate", - "pollen", - "cats"] - end -end - -fun list-when-everything(): - check "list when everything": - allergens = allergies(255) - allergens.list() is [list: - "eggs", - "peanuts", - "shellfish", - "strawberries", - "tomatoes", - "chocolate", - "pollen", - "cats"] - end -end - -fun list-when-no-allergen-score-parts(): - check "list when no allergen score parts": - allergens = allergies(509) - allergens.list() is [list: - "eggs", - "shellfish", - "strawberries", - "tomatoes", - "chocolate", - "pollen", - "cats"] - end -end - -fun list-when-no-allergen-score-parts-without-highest-valid-score(): - check "list when no allergen score parts without highest valid score": - allergens = allergies(257) - allergens.list() is [list: "eggs"] - end -end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(eggs-allergy-not-allergic-to-anything, true), - test(eggs-allergy-allergic-only-to-eggs, false), - test(eggs-allergy-allergic-to-eggs-and-something-else, false), - test(eggs-allergy-allergic-to-something-but-not-eggs, false), - test(eggs-allergy-allergic-to-everything, false), - test(peanuts-allergy-not-allergic-to-anything, false), - test(peanuts-allergy-allergic-only-to-peanuts, false), - test(peanuts-allergy-allergic-to-peanuts-and-something-else, false), - test(peanuts-allergy-allergic-to-something-but-not-peanuts, false), - test(peanuts-allergy-allergic-to-everything, false), - test(shellfish-allergy-not-allergic-to-anything, false), - test(shellfish-allergy-allergic-only-to-shellfish, false), - test(shellfish-allergy-allergic-to-shellfish-and-something-else, false), - test(shellfish-allergy-allergic-to-something-but-not-shellfish, false), - test(shellfish-allergy-allergic-to-everything, false), - test(strawberries-allergy-not-allergic-to-anything, false), - test(strawberries-allergy-allergic-only-to-strawberries, false), - test(strawberries-allergy-allergic-to-strawberries-and-something-else, false), - test(strawberries-allergy-allergic-to-something-but-not-strawberries, false), - test(strawberries-allergy-allergic-to-everything, false), - test(tomatoes-allergy-not-allergic-to-anything, false), - test(tomatoes-allergy-allergic-only-to-tomatoes, false), - test(tomatoes-allergy-allergic-to-tomatoes-and-something-else, false), - test(tomatoes-allergy-allergic-to-something-but-not-tomatoes, false), - test(tomatoes-allergy-allergic-to-everything, false), - test(chocolate-allergy-not-allergic-to-anything, false), - test(chocolate-allergy-allergic-only-to-chocolate, false), - test(chocolate-allergy-allergic-to-chocolate-and-something-else, false), - test(chocolate-allergy-allergic-to-something-but-not-chocolate, false), - test(chocolate-allergy-allergic-to-everything, false), - test(pollen-allergy-not-allergic-to-anything, false), - test(pollen-allergy-allergic-only-to-pollen, false), - test(pollen-allergy-allergic-to-pollen-and-something-else, false), - test(pollen-allergy-allergic-to-something-but-not-pollen, false), - test(pollen-allergy-allergic-to-everything, false), - test(cats-allergy-not-allergic-to-anything, false), - test(cats-allergy-allergic-only-to-cats, false), - test(cats-allergy-allergic-to-cats-and-something-else, false), - test(cats-allergy-allergic-to-something-but-not-cats, false), - test(cats-allergy-allergic-to-everything, false), - test(list-when-no-allergies, false), - test(list-when-just-eggs, false), - test(list-when-just-peanuts, false), - test(list-when-just-strawberries, false), - test(list-when-eggs-and-peanuts, false), - test(list-when-more-than-eggs-but-not-peanuts, false), - test(list-when-lots-of-stuff, false), - test(list-when-everything, false), - test(list-when-no-allergen-score-parts, false), - test(list-when-no-allergen-score-parts-without-highest-valid-score, false), -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file +check "list when no allergies": + allergens = allergies(0) + allergens.list() is [list: ] +end + +check "list when just eggs": + allergens = allergies(1) + allergens.list() is [list: "eggs"] +end + +check "list when just peanuts": + allergens = allergies(2) + allergens.list() is [list: "peanuts"] +end + +check "list when just strawberries": + allergens = allergies(8) + allergens.list() is [list: "strawberries"] +end + +check "list when eggs and peanuts": + allergens = allergies(3) + allergens.list() is [list: "eggs", "peanuts"] +end + +check "list when more than eggs but not peanuts": + allergens = allergies(5) + allergens.list() is [list: "eggs", "shellfish"] +end + +check "list when lots of stuff": + allergens = allergies(248) + allergens.list() is [list: + "strawberries", + "tomatoes", + "chocolate", + "pollen", + "cats"] +end + +check "list when everything": + allergens = allergies(255) + allergens.list() is [list: + "eggs", + "peanuts", + "shellfish", + "strawberries", + "tomatoes", + "chocolate", + "pollen", + "cats"] +end + +check "list when no allergen score parts": + allergens = allergies(509) + allergens.list() is [list: + "eggs", + "shellfish", + "strawberries", + "tomatoes", + "chocolate", + "pollen", + "cats"] +end + +check "list when no allergen score parts without highest valid score": + allergens = allergies(257) + allergens.list() is [list: "eggs"] +end diff --git a/exercises/practice/allergies/allergies.arr b/exercises/practice/allergies/allergies.arr index de8f3023..c3ce59a1 100644 --- a/exercises/practice/allergies/allergies.arr +++ b/exercises/practice/allergies/allergies.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * diff --git a/exercises/practice/anagram/.meta/example.arr b/exercises/practice/anagram/.meta/example.arr index f3e15638..0b55f80d 100644 --- a/exercises/practice/anagram/.meta/example.arr +++ b/exercises/practice/anagram/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: find-anagrams end @@ -18,4 +18,4 @@ fun find-anagrams(phrase, candidates): end candidates.foldl(detect-anagram, [list: ]).reverse() -end \ No newline at end of file +end diff --git a/exercises/practice/anagram/anagram-test.arr b/exercises/practice/anagram/anagram-test.arr index d1ffa834..f74f032f 100644 --- a/exercises/practice/anagram/anagram-test.arr +++ b/exercises/practice/anagram/anagram-test.arr @@ -1,180 +1,115 @@ -use context essentials2020 +use context starter2024 include file("anagram.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +check "no matches": + candidates = [list: "hello", "world", "zombies", "pants"] + expected = [list: ] -fun no-matches(): - check "no matches": - candidates = [list: "hello", "world", "zombies", "pants"] - expected = [list: ] - - find-anagrams("diaper", candidates) is expected - end + find-anagrams("diaper", candidates) is expected end -fun detect-two-anagrams(): - check "detects two anagrams": - candidates = [list: "lemons", "cherry", "melons"] - expected = [list: "lemons", "melons"] +check "detects two anagrams": + candidates = [list: "lemons", "cherry", "melons"] + expected = [list: "lemons", "melons"] - find-anagrams("solemn", candidates) is expected - end + find-anagrams("solemn", candidates) is expected end -fun no-detect-anagram-subsets(): - check "does not detect anagram subsets": - candidates = [list: "dog", "goody"] - expected = [list: ] +check "does not detect anagram subsets": + candidates = [list: "dog", "goody"] + expected = [list: ] - find-anagrams("good", candidates) is expected - end + find-anagrams("good", candidates) is expected end -fun detect-anagram(): - check "detects anagram": - candidates = [list: "enlists", "google", "inlets", "banana"] - expected = [list: "inlets"] +check "detects anagram": + candidates = [list: "enlists", "google", "inlets", "banana"] + expected = [list: "inlets"] - find-anagrams("listen", candidates) is expected - end + find-anagrams("listen", candidates) is expected end -fun detect-three-anagrams(): - check "detects three anagrams": - candidates = [list: "gallery", "ballerina", "regally", "clergy", "largely", "leading"] - expected = [list: "gallery", "regally", "largely"] +check "detects three anagrams": + candidates = [list: "gallery", "ballerina", "regally", "clergy", "largely", "leading"] + expected = [list: "gallery", "regally", "largely"] - find-anagrams("allergy", candidates) is expected - end + find-anagrams("allergy", candidates) is expected end -fun detect-multiple-anagrams-with-diff-case(): - check "detects multiple anagrams with different case": - candidates = [list: "Eons", "ONES"] - expected = [list: "Eons", "ONES"] +check "detects multiple anagrams with different case": + candidates = [list: "Eons", "ONES"] + expected = [list: "Eons", "ONES"] - find-anagrams("nose", candidates) is expected - end + find-anagrams("nose", candidates) is expected end -fun no-detect-identical-checksum(): - check "does not detect non-anagrams with identical checksum": - candidates = [list: "last"] - expected = [list: ] +check "does not detect non-anagrams with identical checksum": + candidates = [list: "last"] + expected = [list: ] - find-anagrams("mass", candidates) is expected - end + find-anagrams("mass", candidates) is expected end -fun detect-anagram-case-insensitively(): - check "detects anagrams case-insensitively": - candidates = [list: "cashregister", "Carthorse", "radishes"] - expected = [list: "Carthorse"] +check "detects anagrams case-insensitively": + candidates = [list: "cashregister", "Carthorse", "radishes"] + expected = [list: "Carthorse"] - find-anagrams("Orchestra", candidates) is expected - end + find-anagrams("Orchestra", candidates) is expected end -fun detect-anagram-case-insensitive-subject(): - check "detects anagrams using case-insensitive subject": - candidates = [list: "cashregister", "carthorse", "radishes"] - expected = [list: "carthorse"] +check "detects anagrams using case-insensitive subject": + candidates = [list: "cashregister", "carthorse", "radishes"] + expected = [list: "carthorse"] - find-anagrams("Orchestra", candidates) is expected - end + find-anagrams("Orchestra", candidates) is expected end -fun detect-anagram-case-insensitive-candidates(): - check "detects anagrams using case-insensitive possible matches": - candidates = [list: "cashregister", "Carthorse", "radishes"] - expected = [list: "Carthorse"] +check "detects anagrams using case-insensitive possible matches": + candidates = [list: "cashregister", "Carthorse", "radishes"] + expected = [list: "Carthorse"] - find-anagrams("orchestra", candidates) is expected - end + find-anagrams("orchestra", candidates) is expected end -fun no-detect-anagram-for-repeating-word(): - check "does not detect an anagram if the original word is repeated": - candidates = [list: "goGoGO"] - expected = [list: ] +check "does not detect an anagram if the original word is repeated": + candidates = [list: "goGoGO"] + expected = [list: ] - find-anagrams("go", candidates) is expected - end + find-anagrams("go", candidates) is expected end -fun anagrams-use-all-letters-once(): - check "anagrams must use all letters exactly once": - candidates = [list: "patter"] - expected = [list: ] +check "anagrams must use all letters exactly once": + candidates = [list: "patter"] + expected = [list: ] - find-anagrams("tapper", candidates) is expected - end + find-anagrams("tapper", candidates) is expected end -fun words-are-not-anagrams-of-themselves(): - check "words are not anagrams of themselves": - candidates = [list: "BANANA"] - expected = [list: ] +check "words are not anagrams of themselves": + candidates = [list: "BANANA"] + expected = [list: ] - find-anagrams("BANANA", candidates) is expected - end + find-anagrams("BANANA", candidates) is expected end -fun words-are-not-anagrams-of-themselves-even-if-case-partially-different(): - check "words are not anagrams of themselves even if letter case is partially different": - candidates = [list: "Banana"] - expected = [list: ] +check "words are not anagrams of themselves even if letter case is partially different": + candidates = [list: "Banana"] + expected = [list: ] - find-anagrams("BANANA", candidates) is expected - end + find-anagrams("BANANA", candidates) is expected end -fun words-are-not-anagrams-of-themselves-even-if-case-completely-different(): - check "words are not anagrams of themselves even if letter case is completely different": - candidates = [list: "banana"] - expected = [list: ] +check "words are not anagrams of themselves even if letter case is completely different": + candidates = [list: "banana"] + expected = [list: ] - find-anagrams("BANANA", candidates) is expected - end + find-anagrams("BANANA", candidates) is expected end -fun words-other-than-self-can-be-anagram(): - check "words other than themselves can be anagrams": - candidates = [list: "LISTEN", "Silent"] - expected = [list: "Silent"] +check "words other than themselves can be anagrams": + candidates = [list: "LISTEN", "Silent"] + expected = [list: "Silent"] - find-anagrams("LISTEN", candidates) is expected - end + find-anagrams("LISTEN", candidates) is expected end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(no-matches, true), - test(detect-two-anagrams, false), - test(no-detect-anagram-subsets, false), - test(detect-anagram, false), - test(detect-three-anagrams, false), - test(detect-multiple-anagrams-with-diff-case, false), - test(no-detect-identical-checksum, false), - test(detect-anagram-case-insensitively, false), - test(detect-anagram-case-insensitive-subject, false), - test(detect-anagram-case-insensitive-candidates, false), - test(no-detect-anagram-for-repeating-word, false), - test(anagrams-use-all-letters-once, false), - test(words-are-not-anagrams-of-themselves, false), - test(words-are-not-anagrams-of-themselves-even-if-case-partially-different, false), - test(words-are-not-anagrams-of-themselves-even-if-case-completely-different, false), - test(words-other-than-self-can-be-anagram, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/anagram/anagram.arr b/exercises/practice/anagram/anagram.arr index dcbf1adf..b5f4a804 100644 --- a/exercises/practice/anagram/anagram.arr +++ b/exercises/practice/anagram/anagram.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: find-anagrams end diff --git a/exercises/practice/armstrong-numbers/.meta/example.arr b/exercises/practice/armstrong-numbers/.meta/example.arr index 83f515b7..7b0935d0 100644 --- a/exercises/practice/armstrong-numbers/.meta/example.arr +++ b/exercises/practice/armstrong-numbers/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: is-armstrong-number end diff --git a/exercises/practice/armstrong-numbers/armstrong-numbers-test.arr b/exercises/practice/armstrong-numbers/armstrong-numbers-test.arr index 48678e09..9d4f85bc 100644 --- a/exercises/practice/armstrong-numbers/armstrong-numbers-test.arr +++ b/exercises/practice/armstrong-numbers/armstrong-numbers-test.arr @@ -1,97 +1,47 @@ -use context essentials2020 +use context starter2024 include file("armstrong-numbers.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun zero-is-armstrong(): - check "Zero is an Armstrong number": - is-armstrong-number(0) is true - end +check "Zero is an Armstrong number": + is-armstrong-number(0) is true end -fun single-digit-is-armstrong(): - check "Single-digit numbers are Armstrong numbers": - is-armstrong-number(5) is true - end +check "Single-digit numbers are Armstrong numbers": + is-armstrong-number(5) is true end -fun two-digit-is-not-armstrong(): - check "There are no two-digit Armstrong numbers": - is-armstrong-number(10) is false - end +check "There are no two-digit Armstrong numbers": + is-armstrong-number(10) is false end -fun three-digit-is-armstrong(): - check "Three-digit number that is an Armstrong number": - is-armstrong-number(153) is true - end +check "Three-digit number that is an Armstrong number": + is-armstrong-number(153) is true end -fun three-digit-is-not-armstrong(): - check "Three-digit number that is not an Armstrong number": - is-armstrong-number(100) is false - end +check "Three-digit number that is not an Armstrong number": + is-armstrong-number(100) is false end -fun four-digit-is-armstrong(): - check "Four-digit number that is an Armstrong number": - is-armstrong-number(9474) is true - end +check "Four-digit number that is an Armstrong number": + is-armstrong-number(9474) is true end -fun four-digit-is-not-armstrong(): - check "Four-digit number that is not an Armstrong number": - is-armstrong-number(9475) is false - end +check "Four-digit number that is not an Armstrong number": + is-armstrong-number(9475) is false end -fun seven-digit-is-armstrong(): - check "Seven-digit number that is an Armstrong number": - is-armstrong-number(9926315) is true - end +check "Seven-digit number that is an Armstrong number": + is-armstrong-number(9926315) is true end -fun seven-digit-is-not-armstrong(): - check "Seven-digit number that is not an Armstrong number": - is-armstrong-number(9926314) is false - end +check "Seven-digit number that is not an Armstrong number": + is-armstrong-number(9926314) is false end -fun number-with-seven-zeroes-is-not-armstrong(): - check "Armstrong number containing seven zeroes": - is-armstrong-number(186709961001538790100634132976990) is true - end +check "Armstrong number containing seven zeroes": + is-armstrong-number(186709961001538790100634132976990) is true end -fun largest-armstrong-number(): - check "The largest and last Armstrong number": - is-armstrong-number(115132219018763992565095597973971522401) is true - end +check "The largest and last Armstrong number": + is-armstrong-number(115132219018763992565095597973971522401) is true end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(zero-is-armstrong, true), - test(single-digit-is-armstrong, false), - test(two-digit-is-not-armstrong, false), - test(three-digit-is-armstrong, false), - test(three-digit-is-not-armstrong, false), - test(four-digit-is-armstrong, false), - test(four-digit-is-not-armstrong, false), - test(seven-digit-is-armstrong, false), - test(seven-digit-is-not-armstrong, false), - test(number-with-seven-zeroes-is-not-armstrong, false), - test(largest-armstrong-number, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/armstrong-numbers/armstrong-numbers.arr b/exercises/practice/armstrong-numbers/armstrong-numbers.arr index 585acca5..7d43711a 100644 --- a/exercises/practice/armstrong-numbers/armstrong-numbers.arr +++ b/exercises/practice/armstrong-numbers/armstrong-numbers.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: is-armstrong-number end diff --git a/exercises/practice/atbash-cipher/.meta/example.arr b/exercises/practice/atbash-cipher/.meta/example.arr index 280db19f..3dda3509 100644 --- a/exercises/practice/atbash-cipher/.meta/example.arr +++ b/exercises/practice/atbash-cipher/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: encode, decode end diff --git a/exercises/practice/atbash-cipher/atbash-cipher-test.arr b/exercises/practice/atbash-cipher/atbash-cipher-test.arr index e83d5c5a..7e0f593c 100644 --- a/exercises/practice/atbash-cipher/atbash-cipher-test.arr +++ b/exercises/practice/atbash-cipher/atbash-cipher-test.arr @@ -1,160 +1,101 @@ -use context essentials2020 +use context starter2024 include file("atbash-cipher.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +check "encode -> encode yes": + input = "yes" + expected = "bvh" -fun encode-yes(): - check "encode -> encode yes": - input = "yes" - expected = "bvh" - - encode(input) is expected - end + encode(input) is expected end -fun encode-no(): - check "encode -> encode no": - input = "no" - expected = "ml" - - encode(input) is expected - end +check "encode -> encode no": + input = "no" + expected = "ml" + + encode(input) is expected end -fun encode-OMG(): - check "encode -> encode OMG": - input = "OMG" - expected = "lnt" - - encode(input) is expected - end +check "encode -> encode OMG": + input = "OMG" + expected = "lnt" + + encode(input) is expected end -fun encode-spaces(): - check "encode -> encode spaces": - input = "O M G" - expected = "lnt" - - encode(input) is expected - end +check "encode -> encode spaces": + input = "O M G" + expected = "lnt" + + encode(input) is expected end -fun encode-mindblowingly(): - check "encode -> encode mindblowingly": - input = "mindblowingly" - expected = "nrmwy oldrm tob" - - encode(input) is expected - end +check "encode -> encode mindblowingly": + input = "mindblowingly" + expected = "nrmwy oldrm tob" + + encode(input) is expected end -fun encode-numbers(): - check "encode -> encode numbers": - input = "Testing,1 2 3, testing." - expected = "gvhgr mt123 gvhgr mt" - - encode(input) is expected - end +check "encode -> encode numbers": + input = "Testing,1 2 3, testing." + expected = "gvhgr mt123 gvhgr mt" + + encode(input) is expected end -fun encode-deep-thought(): - check "encode -> encode deep thought": - input = "Truth is fiction." - expected = "gifgs rhurx grlm" - - encode(input) is expected - end +check "encode -> encode deep thought": + input = "Truth is fiction." + expected = "gifgs rhurx grlm" + + encode(input) is expected end -fun encode-all-letters(): - check "encode -> encode all the letters": - input = "The quick brown fox jumps over the lazy dog." - expected = "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" - - encode(input) is expected - end +check "encode -> encode all the letters": + input = "The quick brown fox jumps over the lazy dog." + expected = "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" + + encode(input) is expected end -fun decode-exercism(): - check "decode -> decode exercism": - input = "vcvix rhn" - expected = "exercism" - - decode(input) is expected - end +check "decode -> decode exercism": + input = "vcvix rhn" + expected = "exercism" + + decode(input) is expected end -fun decode-sentence(): - check "decode -> decode a sentence": - input = "zmlyh gzxov rhlug vmzhg vkkrm thglm v" - expected = "anobstacleisoftenasteppingstone" - - decode(input) is expected - end +check "decode -> decode a sentence": + input = "zmlyh gzxov rhlug vmzhg vkkrm thglm v" + expected = "anobstacleisoftenasteppingstone" + + decode(input) is expected end -fun decode-numbers(): - check "decode -> decode numbers": - input = "gvhgr mt123 gvhgr mt" - expected = "testing123testing" - - decode(input) is expected - end +check "decode -> decode numbers": + input = "gvhgr mt123 gvhgr mt" + expected = "testing123testing" + + decode(input) is expected end -fun decode-all-letters(): - check "decode -> decode all the letters": - input = "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" - expected = "thequickbrownfoxjumpsoverthelazydog" - - decode(input) is expected - end +check "decode -> decode all the letters": + input = "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" + expected = "thequickbrownfoxjumpsoverthelazydog" + + decode(input) is expected end -fun decode-with-too-many-spaces(): - check "decode -> decode with too many spaces": - input = "vc vix r hn" - expected = "exercism" - - decode(input) is expected - end +check "decode -> decode with too many spaces": + input = "vc vix r hn" + expected = "exercism" + + decode(input) is expected end -fun decode-with-no-spaces(): - check "decode -> decode with no spaces": - input = "zmlyhgzxovrhlugvmzhgvkkrmthglmv" - expected = "anobstacleisoftenasteppingstone" - - decode(input) is expected - end +check "decode -> decode with no spaces": + input = "zmlyhgzxovrhlugvmzhgvkkrmthglmv" + expected = "anobstacleisoftenasteppingstone" + + decode(input) is expected end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(encode-yes, true), - test(encode-no, false), - test(encode-OMG, false), - test(encode-spaces, false), - test(encode-mindblowingly, false), - test(encode-numbers, false), - test(encode-deep-thought, false), - test(encode-all-letters, false), - test(decode-exercism, false), - test(decode-sentence, false), - test(decode-numbers, false), - test(decode-all-letters, false), - test(decode-with-too-many-spaces, false), - test(decode-with-no-spaces, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/atbash-cipher/atbash-cipher.arr b/exercises/practice/atbash-cipher/atbash-cipher.arr index 04d45574..9a8d2db6 100644 --- a/exercises/practice/atbash-cipher/atbash-cipher.arr +++ b/exercises/practice/atbash-cipher/atbash-cipher.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: encode, decode end diff --git a/exercises/practice/bank-account/.meta/example.arr b/exercises/practice/bank-account/.meta/example.arr index 80328e07..83915a5a 100644 --- a/exercises/practice/bank-account/.meta/example.arr +++ b/exercises/practice/bank-account/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * @@ -45,4 +45,4 @@ data Account: method open(self): raise("account already open") end -end \ No newline at end of file +end diff --git a/exercises/practice/bank-account/bank-account-test.arr b/exercises/practice/bank-account/bank-account-test.arr index 534fc2b0..77523925 100644 --- a/exercises/practice/bank-account/bank-account-test.arr +++ b/exercises/practice/bank-account/bank-account-test.arr @@ -1,139 +1,74 @@ -use context essentials2020 +use context starter2024 include file("bank-account.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun open-account-zero-balance(): - check "Newly opened account has zero balance": - account().open().get-balance() is 0 - end +check "Newly opened account has zero balance": + account().open().get-balance() is 0 end -fun single-deposit(): - check "Single deposit": - account().open().deposit(100).get-balance() is 100 - end +check "Single deposit": + account().open().deposit(100).get-balance() is 100 end -fun multiple-deposits(): - check "Multiple deposits": - account().open().deposit(100).deposit(50).get-balance() is 150 - end +check "Multiple deposits": + account().open().deposit(100).deposit(50).get-balance() is 150 end -fun withdraw-once(): - check "Withdraw once": - account().open().deposit(100).withdraw(75).get-balance() is 25 - end +check "Withdraw once": + account().open().deposit(100).withdraw(75).get-balance() is 25 end -fun withdraw-twice(): - check "Withdraw twice": - account().open().deposit(100).withdraw(80).withdraw(20).get-balance() is 0 - end +check "Withdraw twice": + account().open().deposit(100).withdraw(80).withdraw(20).get-balance() is 0 end -fun multiple-operations(): - check "Can do multiple operations sequentially": - account() - ^ _.open() - ^ _.deposit(100) - ^ _.deposit(110) - ^ _.withdraw(200) - ^ _.deposit(60) - ^ _.withdraw(50) - ^ _.get-balance() is 20 - end +check "Can do multiple operations sequentially": + account() + ^ _.open() + ^ _.deposit(100) + ^ _.deposit(110) + ^ _.withdraw(200) + ^ _.deposit(60) + ^ _.withdraw(50) + ^ _.get-balance() is 20 end -fun no-balance-for-closed-account(): - check "Cannot check balance of closed account": - account().open().close().get-balance() raises "account not open" - end +check "Cannot check balance of closed account": + account().open().close().get-balance() raises "account not open" end -fun no-deposit-for-closed-account(): - check "Cannot deposit into closed account": - account().open().close().deposit(50) raises "account not open" - end +check "Cannot deposit into closed account": + account().open().close().deposit(50) raises "account not open" end -fun no-deposit-for-unopened-account(): - check "Cannot deposit into unopened account": - account().deposit(50) raises "account not open" - end +check "Cannot deposit into unopened account": + account().deposit(50) raises "account not open" end -fun no-withdraw-for-closed-account(): - check "Cannot withdraw from closed account": - account().open().close().withdraw(50) raises "account not open" - end +check "Cannot withdraw from closed account": + account().open().close().withdraw(50) raises "account not open" end -fun no-close-unopened-account(): - check "Cannot close an account that was not opened": - account().close() raises "account not open" - end +check "Cannot close an account that was not opened": + account().close() raises "account not open" end -fun no-open-already-opened-account(): - check "Cannot open an already opened account": - account().open().open() raises "account already open" - end +check "Cannot open an already opened account": + account().open().open() raises "account already open" end -fun reopened-account-does-not-retain-balance(): - check "Reopened account does not retain balance": - account().open().deposit(50).close().open().get-balance() is 0 - end +check "Reopened account does not retain balance": + account().open().deposit(50).close().open().get-balance() is 0 end -fun no-withdraw-more-than-deposited(): - check "Cannot withdraw more than deposited": - account().open().deposit(25).withdraw(50) raises "amount must be less than balance" - end +check "Cannot withdraw more than deposited": + account().open().deposit(25).withdraw(50) raises "amount must be less than balance" end -fun no-withdraw-negative-amount(): - check "Cannot withdraw negative": - account().open().deposit(100).withdraw(-50) raises "amount must be greater than 0" - end +check "Cannot withdraw negative": + account().open().deposit(100).withdraw(-50) raises "amount must be greater than 0" end -fun no-deposit-negative-amount(): - check "Cannot deposit negative": - account().open().deposit(-50) raises "amount must be greater than 0" - end +check "Cannot deposit negative": + account().open().deposit(-50) raises "amount must be greater than 0" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(open-account-zero-balance, true), - test(single-deposit, false), - test(multiple-deposits, false), - test(withdraw-once, false), - test(withdraw-twice, false), - test(multiple-operations, false), - test(no-balance-for-closed-account, false), - test(no-deposit-for-closed-account, false), - test(no-deposit-for-unopened-account, false), - test(no-withdraw-for-closed-account, false), - test(no-close-unopened-account, false), - test(no-open-already-opened-account, false), - test(reopened-account-does-not-retain-balance, false), - test(no-withdraw-more-than-deposited, false), - test(no-withdraw-negative-amount, false), - test(no-deposit-negative-amount, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/bank-account/bank-account.arr b/exercises/practice/bank-account/bank-account.arr index b87beb10..b29c09a6 100644 --- a/exercises/practice/bank-account/bank-account.arr +++ b/exercises/practice/bank-account/bank-account.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * @@ -19,4 +19,4 @@ data Account: method get-balance(self): raise("please implement the get-balance method") end -end \ No newline at end of file +end diff --git a/exercises/practice/binary-search/.meta/example.arr b/exercises/practice/binary-search/.meta/example.arr index 48a02269..1d7f83a7 100644 --- a/exercises/practice/binary-search/.meta/example.arr +++ b/exercises/practice/binary-search/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: binary-search end diff --git a/exercises/practice/binary-search/binary-search-test.arr b/exercises/practice/binary-search/binary-search-test.arr index 70b20ee2..33a4f651 100644 --- a/exercises/practice/binary-search/binary-search-test.arr +++ b/exercises/practice/binary-search/binary-search-test.arr @@ -1,98 +1,47 @@ -use context essentials2020 +use context starter2024 include file("binary-search.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun value-in-list-of-one(): - check "finds a value in a list with one element": - binary-search([list: 6], 6) is 0 - end +check "finds a value in a list with one element": + binary-search([list: 6], 6) is 0 end -fun value-in-middle-of-list(): - check "finds a value in the middle of a list": - binary-search([list: 1, 3, 4, 6, 8, 9, 11], 6) is 3 - end +check "finds a value in the middle of a list": + binary-search([list: 1, 3, 4, 6, 8, 9, 11], 6) is 3 end - -fun value-in-beginning-of-list(): - check "finds a value at the beginning of a list": - binary-search([list: 1, 3, 4, 6, 8, 9, 11], 1) is 0 - end +check "finds a value at the beginning of a list": + binary-search([list: 1, 3, 4, 6, 8, 9, 11], 1) is 0 end -fun value-at-end-of-list(): - check "finds a value at the end of a list": - binary-search([list: 1, 3, 4, 6, 8, 9, 11], 11) is 6 - end +check "finds a value at the end of a list": + binary-search([list: 1, 3, 4, 6, 8, 9, 11], 11) is 6 end -fun value-in-odd-length-list(): - check "finds a value in a list of odd length": - binary-search([list: 1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634], 144) is 9 - end +check "finds a value in a list of odd length": + binary-search([list: 1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634], 144) is 9 end -fun value-in-even-length-list(): - check "finds a value in a list of even length": - binary-search([list: 1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377], 21) is 5 - end +check "finds a value in a list of even length": + binary-search([list: 1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377], 21) is 5 end -fun error-value-not-in-list(): - check "identifies that a value is not included in the list": - binary-search([list: 1, 3, 4, 6, 8, 9, 11], 7) raises "value not in list" - end +check "identifies that a value is not included in the list": + binary-search([list: 1, 3, 4, 6, 8, 9, 11], 7) raises "value not in list" end -fun error-value-too-small(): - check "a value smaller than the list's smallest value is not found": - binary-search([list: 1, 3, 4, 6, 8, 9, 11], 0) raises "value not in list" - end +check "a value smaller than the list's smallest value is not found": + binary-search([list: 1, 3, 4, 6, 8, 9, 11], 0) raises "value not in list" end -fun err-value-too-large(): - check "a value larger than the list's largest value is not found": - binary-search([list: 1, 3, 4, 6, 8, 9, 11], 13) raises "value not in list" - end +check "a value larger than the list's largest value is not found": + binary-search([list: 1, 3, 4, 6, 8, 9, 11], 13) raises "value not in list" end -fun err-empty-list(): - check "nothing is found in an empty list": - binary-search([list: ], 1) raises "value not in list" - end +check "nothing is found in an empty list": + binary-search([list: ], 1) raises "value not in list" end -fun err-bounds-cross(): - check "nothing is found when the left and right bounds cross": - binary-search([list: 1, 2], 0) raises "value not in list" - end +check "nothing is found when the left and right bounds cross": + binary-search([list: 1, 2], 0) raises "value not in list" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(value-in-list-of-one, true), - test(value-in-middle-of-list, false), - test(value-in-beginning-of-list, false), - test(value-at-end-of-list, false), - test(value-in-odd-length-list, false), - test(value-in-even-length-list, false), - test(error-value-not-in-list, false), - test(error-value-too-small, false), - test(err-value-too-large, false), - test(err-empty-list, false), - test(err-bounds-cross, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/binary-search/binary-search.arr b/exercises/practice/binary-search/binary-search.arr index 313a42e7..9062bf7a 100644 --- a/exercises/practice/binary-search/binary-search.arr +++ b/exercises/practice/binary-search/binary-search.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: binary-search end diff --git a/exercises/practice/bob/.meta/example.arr b/exercises/practice/bob/.meta/example.arr index 1793c560..be28fadd 100644 --- a/exercises/practice/bob/.meta/example.arr +++ b/exercises/practice/bob/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: response end @@ -58,4 +58,4 @@ fun response(hey-bob): | is-question() then: "Sure." | otherwise: "Whatever." end -end \ No newline at end of file +end diff --git a/exercises/practice/bob/bob-test.arr b/exercises/practice/bob/bob-test.arr index c847f9d6..99801fd4 100644 --- a/exercises/practice/bob/bob-test.arr +++ b/exercises/practice/bob/bob-test.arr @@ -1,270 +1,178 @@ -use context essentials2020 +use context starter2024 include file("bob.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +check "stating something": + input = "Tom-ay-to, tom-aaaah-to." + expected = "Whatever." -fun stating-something(): - check "stating something": - input = "Tom-ay-to, tom-aaaah-to." - expected = "Whatever." - - response(input) is expected - end + response(input) is expected end -fun shouting(): - check "shouting": - input = "WATCH OUT!" - expected = "Whoa, chill out!" - - response(input) is expected - end +check "shouting": + input = "WATCH OUT!" + expected = "Whoa, chill out!" + + response(input) is expected end -fun shouting-gibberish(): - check "shouting gibberish": - input = "FCECDFCAAB" - expected = "Whoa, chill out!" - - response(input) is expected - end +check "shouting gibberish": + input = "FCECDFCAAB" + expected = "Whoa, chill out!" + + response(input) is expected end -fun asking-a-question(): - check "asking a question": - input = "Does this cryogenic chamber make me look fat?" - expected = "Sure." - - response(input) is expected - end +check "asking a question": + input = "Does this cryogenic chamber make me look fat?" + expected = "Sure." + + response(input) is expected end -fun asking-numeric-question(): - check "asking a numeric question": - input = "You are, what, like 15?" - expected = "Sure." - - response(input) is expected - end +check "asking a numeric question": + input = "You are, what, like 15?" + expected = "Sure." + + response(input) is expected end -fun asking-gibberish(): - check "asking gibberish": - input = "fffbbcbeab?" - expected = "Sure." - - response(input) is expected - end +check "asking gibberish": + input = "fffbbcbeab?" + expected = "Sure." + + response(input) is expected end -fun talking-forcefully(): - check "talking forcefully": - input = "Hi there!" - expected = "Whatever." - - response(input) is expected - end +check "talking forcefully": + input = "Hi there!" + expected = "Whatever." + + response(input) is expected end -fun using-acronyms(): - check "using acronyms in regular speech": - input = "It's OK if you don't want to go work for NASA." - expected = "Whatever." - - response(input) is expected - end +check "using acronyms in regular speech": + input = "It's OK if you don't want to go work for NASA." + expected = "Whatever." + + response(input) is expected end -fun forceful-question(): - check "forceful question": - input = "WHAT'S GOING ON?" - expected = "Calm down, I know what I'm doing!" - - response(input) is expected - end +check "forceful question": + input = "WHAT'S GOING ON?" + expected = "Calm down, I know what I'm doing!" + + response(input) is expected end -fun shouting-numbers(): - check "shouting numbers": - input = "1, 2, 3 GO!" - expected = "Whoa, chill out!" +check "shouting numbers": + input = "1, 2, 3 GO!" + expected = "Whoa, chill out!" - response(input) is expected - end + response(input) is expected end -fun no-letters(): - check "no letters": - input = "1, 2, 3" - expected = "Whatever." +check "no letters": + input = "1, 2, 3" + expected = "Whatever." - response(input) is expected - end + response(input) is expected end -fun question-with-no-letters(): - check "question with no letters": - input = "4?" - expected = "Sure." +check "question with no letters": + input = "4?" + expected = "Sure." - response(input) is expected - end + response(input) is expected end -fun shouting-with-special-characters(): - check "shouting with special characters": - input = "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!" - expected = "Whoa, chill out!" +check "shouting with special characters": + input = "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!" + expected = "Whoa, chill out!" - response(input) is expected - end + response(input) is expected end -fun shouting-with-no-exclamation-mark(): - check "shouting with no exclamation mark": - input = "I HATE THE DENTIST" - expected = "Whoa, chill out!" +check "shouting with no exclamation mark": + input = "I HATE THE DENTIST" + expected = "Whoa, chill out!" - response(input) is expected - end + response(input) is expected end -fun statement-with-question-mark(): - check "statement containing question mark": - input = "Ending with ? means a question." - expected = "Whatever." +check "statement containing question mark": + input = "Ending with ? means a question." + expected = "Whatever." - response(input) is expected - end + response(input) is expected end -fun non-letters-with-question(): - check "non-letters with question": - input = ":) ?" - expected = "Sure." +check "non-letters with question": + input = ":) ?" + expected = "Sure." - response(input) is expected - end + response(input) is expected end -fun prattling-on(): - check "prattling on": - input = "Wait! Hang on. Are you going to be OK?" - expected = "Sure." +check "prattling on": + input = "Wait! Hang on. Are you going to be OK?" + expected = "Sure." - response(input) is expected - end + response(input) is expected end -fun silence(): - check "silence": - input = "" - expected = "Fine. Be that way!" +check "silence": + input = "" + expected = "Fine. Be that way!" - response(input) is expected - end + response(input) is expected end -fun prolonged-silence(): - check "prolonged silence": - input = " " - expected = "Fine. Be that way!" +check "prolonged silence": + input = " " + expected = "Fine. Be that way!" - response(input) is expected - end + response(input) is expected end -fun alternate-silence(): - check "alternate silence": - input = "\t\t\t\t\t\t\t\t\t\t" - expected = "Fine. Be that way!" +check "alternate silence": + input = "\t\t\t\t\t\t\t\t\t\t" + expected = "Fine. Be that way!" - response(input) is expected - end + response(input) is expected end -fun multiple-line-question(): - check "multiple line question": - input = "\nDoes this cryogenic chamber make\n me look fat?" - expected = "Sure." +check "multiple line question": + input = "\nDoes this cryogenic chamber make\n me look fat?" + expected = "Sure." - response(input) is expected - end + response(input) is expected end -fun starting-with-whitespace(): - check "starting with whitespace": - input = " hmmmmmmm..." - expected = "Whatever." +check "starting with whitespace": + input = " hmmmmmmm..." + expected = "Whatever." - response(input) is expected - end + response(input) is expected end -fun ending-with-whitespace(): - check "ending with whitespace": - input = "Okay if like my spacebar quite a bit? " - expected = "Sure." +check "ending with whitespace": + input = "Okay if like my spacebar quite a bit? " + expected = "Sure." - response(input) is expected - end + response(input) is expected end -fun other-whitespace(): - check "other whitespace": - input = "\n\r \t" - expected = "Fine. Be that way!" +check "other whitespace": + input = "\n\r \t" + expected = "Fine. Be that way!" - response(input) is expected - end + response(input) is expected end -fun non-question-ending-with-whitespace(): - check "non-question ending with whitespace": - input = "This is a statement ending with whitespace " - expected = "Whatever." +check "non-question ending with whitespace": + input = "This is a statement ending with whitespace " + expected = "Whatever." - response(input) is expected - end + response(input) is expected end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(stating-something, true), - test(shouting, false), - test(shouting-gibberish, false), - test(asking-a-question, false), - test(asking-numeric-question, false), - test(asking-gibberish, false), - test(talking-forcefully, false), - test(using-acronyms, false), - test(forceful-question, false), - test(shouting-numbers, false), - test(no-letters, false), - test(question-with-no-letters, false), - test(shouting-with-special-characters, false), - test(shouting-with-no-exclamation-mark, false), - test(statement-with-question-mark, false), - test(non-letters-with-question, false), - test(prattling-on, false), - test(silence, false), - test(prolonged-silence, false), - test(alternate-silence, false), - test(multiple-line-question, false), - test(starting-with-whitespace, false), - test(ending-with-whitespace, false), - test(other-whitespace, false), - test(non-question-ending-with-whitespace, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/bob/bob.arr b/exercises/practice/bob/bob.arr index 649676ef..3178eef2 100644 --- a/exercises/practice/bob/bob.arr +++ b/exercises/practice/bob/bob.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: response end diff --git a/exercises/practice/circular-buffer/.meta/example.arr b/exercises/practice/circular-buffer/.meta/example.arr index 43dac8e6..498fb1eb 100644 --- a/exercises/practice/circular-buffer/.meta/example.arr +++ b/exercises/practice/circular-buffer/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * provide: make-buffer end diff --git a/exercises/practice/circular-buffer/circular-buffer-test.arr b/exercises/practice/circular-buffer/circular-buffer-test.arr index d1653dcb..469a22e6 100644 --- a/exercises/practice/circular-buffer/circular-buffer-test.arr +++ b/exercises/practice/circular-buffer/circular-buffer-test.arr @@ -1,230 +1,171 @@ -use context essentials2020 +use context starter2024 include file("circular-buffer.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +check "reading empty buffer should fail": + buff = make-buffer(1) -fun read-empty-buffer-should-fail(): - check "reading empty buffer should fail": - buff = make-buffer(1) - - buff.read() raises "empty buffer" - end + buff.read() raises "empty buffer" end -fun can-read-an-item-just-written(): - check "can read an item just written": - var buff = make-buffer(1) - buff := buff.write(1) +check "can read an item just written": + var buff = make-buffer(1) + buff := buff.write(1) - buff.read().{0} is 1 - end + buff.read().{0} is 1 end -fun each-item-may-only-be-read-once(): - check "each item may only be read once": - var buff = make-buffer(1) - buff := buff.write(1) +check "each item may only be read once": + var buff = make-buffer(1) + buff := buff.write(1) - results = buff.read() - results.{0} is 1 - results.{1}.read() raises "empty buffer" - end + results = buff.read() + results.{0} is 1 + results.{1}.read() raises "empty buffer" end -fun items-are-read-in-the-order-they-are-written(): - check "items are read in the order they are written": - var buff = make-buffer(2) - buff := buff.write(1) - buff := buff.write(2) - - var results = buff.read() - results.{0} is 1 - results := results.{1}.read() - results.{0} is 2 - end +check "items are read in the order they are written": + var buff = make-buffer(2) + buff := buff.write(1) + buff := buff.write(2) + + var results = buff.read() + results.{0} is 1 + results := results.{1}.read() + results.{0} is 2 end -fun full-buffer-can-not-be-written-to(): - check "full buffer can't be written to": - var buff = make-buffer(1) - buff := buff.write(1) +check "full buffer can't be written to": + var buff = make-buffer(1) + buff := buff.write(1) - buff.write(2) raises "full buffer" - end + buff.write(2) raises "full buffer" end -fun a-read-frees-up-capacity-for-another-write(): - check "a read frees up capacity for another write": - var buff = make-buffer(1) - buff := buff.write(1) +check "a read frees up capacity for another write": + var buff = make-buffer(1) + buff := buff.write(1) - var results = buff.read() - results.{0} is 1 - - buff := results.{1}.write(2) - results := buff.read() - results.{0} is 2 - end + var results = buff.read() + results.{0} is 1 + + buff := results.{1}.write(2) + results := buff.read() + results.{0} is 2 end -fun read-position-is-maintained-even-across-multiple-writes(): - check "read position is maintained even across multiple writes": - var buff = make-buffer(3) - buff := buff.write(1) - buff := buff.write(2) +check "read position is maintained even across multiple writes": + var buff = make-buffer(3) + buff := buff.write(1) + buff := buff.write(2) - var results = buff.read() - results.{0} is 1 + var results = buff.read() + results.{0} is 1 - buff := results.{1} - buff := buff.write(3) - - results := buff.read() - results.{0} is 2 + buff := results.{1} + buff := buff.write(3) + + results := buff.read() + results.{0} is 2 - buff := results.{1} - results := buff.read() - results.{0} is 3 - end + buff := results.{1} + results := buff.read() + results.{0} is 3 end -fun items-cleared-out-of-buffer-can-not-be-read(): - check "items cleared out of buffer can't be read": - var buff = make-buffer(1) - buff := buff.write(1) - buff := buff.clear() - - buff.read() raises "empty buffer" - end +check "items cleared out of buffer can't be read": + var buff = make-buffer(1) + buff := buff.write(1) + buff := buff.clear() + + buff.read() raises "empty buffer" end -fun clear-frees-up-capacity-for-another-write(): - check "clear frees up capacity for another write": - var buff = make-buffer(1) - buff := buff.write(1) - buff := buff.clear() - buff := buff.write(2) +check "clear frees up capacity for another write": + var buff = make-buffer(1) + buff := buff.write(1) + buff := buff.clear() + buff := buff.write(2) - buff.read().{0} is 2 - end + buff.read().{0} is 2 end -fun clear-does-nothing-on-empty-buffer(): - check "clear does nothing on empty buffer": - var buff = make-buffer(1) - buff := buff.clear() - buff := buff.write(1) - - results = buff.read() - results.{0} is 1 - end +check "clear does nothing on empty buffer": + var buff = make-buffer(1) + buff := buff.clear() + buff := buff.write(1) + + results = buff.read() + results.{0} is 1 end -fun overwrite-acts-like-write-on-non-full-buffer(): - check "overwrite acts like write on non-full buffer": - var buff = make-buffer(2) - buff := buff.write(1) - buff := buff.overwrite(2) +check "overwrite acts like write on non-full buffer": + var buff = make-buffer(2) + buff := buff.write(1) + buff := buff.overwrite(2) - var results = buff.read() - results.{0} is 1 + var results = buff.read() + results.{0} is 1 - buff := results.{1} - results := buff.read() - results.{0} is 2 - end + buff := results.{1} + results := buff.read() + results.{0} is 2 end -fun overwrite-replaces-the-oldest-item-on-full-buffer(): - check "overwrite replaces the oldest item on full buffer": - var buff = make-buffer(2) - buff := buff.write(1) - buff := buff.write(2) - buff := buff.overwrite(3) +check "overwrite replaces the oldest item on full buffer": + var buff = make-buffer(2) + buff := buff.write(1) + buff := buff.write(2) + buff := buff.overwrite(3) - var results = buff.read() - results.{0} is 2 + var results = buff.read() + results.{0} is 2 - buff := results.{1} - results := buff.read() - results.{0} is 3 - end + buff := results.{1} + results := buff.read() + results.{0} is 3 end -fun overwrite-replaces-the-oldest-item-remaining-in-buffer-following-a-read(): - check "overwrite replaces the oldest item remaining in buffer following a read": - var buff = make-buffer(3) - buff := buff.write(1) - buff := buff.write(2) - buff := buff.write(3) +check "overwrite replaces the oldest item remaining in buffer following a read": + var buff = make-buffer(3) + buff := buff.write(1) + buff := buff.write(2) + buff := buff.write(3) - var results = buff.read() - results.{0} is 1 + var results = buff.read() + results.{0} is 1 - buff := results.{1} - buff := buff.write(4) - buff := buff.overwrite(5) - - results := buff.read() - results.{0} is 3 + buff := results.{1} + buff := buff.write(4) + buff := buff.overwrite(5) - buff := results.{1} - results := buff.read() - results.{0} is 4 + results := buff.read() + results.{0} is 3 - buff := results.{1} - results := buff.read() - results.{0} is 5 - end -end + buff := results.{1} + results := buff.read() + results.{0} is 4 -fun initial-clear-does-not-affect-wrapping-around(): - check "initial clear does not affect wrapping around": - var buff = make-buffer(2) - buff := buff.clear() - buff := buff.write(1) - buff := buff.write(2) - buff := buff.overwrite(3) - buff := buff.overwrite(4) - - var results = buff.read() - results.{0} is 3 - - buff := results.{1} - results := buff.read() - results.{0} is 4 - - buff := results.{1} - buff.read() raises "empty buffer" - end + buff := results.{1} + results := buff.read() + results.{0} is 5 end -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(read-empty-buffer-should-fail, true), - test(can-read-an-item-just-written, false), - test(each-item-may-only-be-read-once, false), - test(items-are-read-in-the-order-they-are-written, false), - test(full-buffer-can-not-be-written-to, false), - test(a-read-frees-up-capacity-for-another-write, false), - test(read-position-is-maintained-even-across-multiple-writes, false), - test(items-cleared-out-of-buffer-can-not-be-read, false), - test(clear-frees-up-capacity-for-another-write, false), - test(clear-does-nothing-on-empty-buffer, false), - test(overwrite-acts-like-write-on-non-full-buffer, false), - test(overwrite-replaces-the-oldest-item-on-full-buffer, false), - test(overwrite-replaces-the-oldest-item-remaining-in-buffer-following-a-read, false), - test(initial-clear-does-not-affect-wrapping-around, false) -].each(lam(t): when t.active: t.run() end end) +check "initial clear does not affect wrapping around": + var buff = make-buffer(2) + buff := buff.clear() + buff := buff.write(1) + buff := buff.write(2) + buff := buff.overwrite(3) + buff := buff.overwrite(4) + + var results = buff.read() + results.{0} is 3 + + buff := results.{1} + results := buff.read() + results.{0} is 4 + + buff := results.{1} + buff.read() raises "empty buffer" +end diff --git a/exercises/practice/circular-buffer/circular-buffer.arr b/exercises/practice/circular-buffer/circular-buffer.arr index 4031d88b..816d87a9 100644 --- a/exercises/practice/circular-buffer/circular-buffer.arr +++ b/exercises/practice/circular-buffer/circular-buffer.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * provide: make-buffer end diff --git a/exercises/practice/clock/.meta/example.arr b/exercises/practice/clock/.meta/example.arr index ce9652ed..13034c29 100644 --- a/exercises/practice/clock/.meta/example.arr +++ b/exercises/practice/clock/.meta/example.arr @@ -1,8 +1,8 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * -import equality as E +import equality as EQ data Clock: | clock(hours :: Number, minutes :: Number) @@ -34,14 +34,14 @@ sharing: self end end, - method _equals(self, other :: Clock, _) -> E.EqualityResult: + method _equals(self, other :: Clock, _) -> EQ.EqualityResult: left = self.normalize() right = other.normalize() if (left.hours == right.hours) and (left.minutes == right.minutes): - E.Equal + EQ.Equal else: - E.NotEqual("Clocks represent different periods in time", self, other) + EQ.NotEqual("Clocks represent different periods in time", self, other) end end, method to-string(self) -> String: @@ -58,4 +58,4 @@ sharing: to-two-digits(normalized.hours) + ":" + to-two-digits(normalized.minutes) end -end \ No newline at end of file +end diff --git a/exercises/practice/clock/clock-test.arr b/exercises/practice/clock/clock-test.arr index e3109659..a6ffe884 100644 --- a/exercises/practice/clock/clock-test.arr +++ b/exercises/practice/clock/clock-test.arr @@ -1,383 +1,211 @@ -use context essentials2020 +use context starter2024 include file("clock.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +check "Create a new clock with an initial time -> on the hour": + clock(8, 0).normalize().to-string() is "08:00" +end + +check "Create a new clock with an initial time -> past the hour": + clock(11, 09).normalize().to-string() is "11:09" +end + +check "Create a new clock with an initial time -> midnight is zero hours": + clock(24, 0).normalize().to-string() is "00:00" +end + +check "Create a new clock with an initial time -> hour rolls over": + clock(25, 0).normalize().to-string() is "01:00" +end + +check "Create a new clock with an initial time -> hour rolls over continuously": + clock(100, 0).normalize().to-string() is "04:00" +end -fun create-clock-on-hour(): - check "Create a new clock with an initial time -> on the hour": - clock(8, 0).normalize().to-string() is "08:00" - end +check "Create a new clock with an initial time -> sixty minutes is next hour": + clock(1, 60).normalize().to-string() is "02:00" end -fun create-clock-past-hour(): - check "Create a new clock with an initial time -> past the hour": - clock(11, 09).normalize().to-string() is "11:09" - end +check "Create a new clock with an initial time -> minutes roll over": + clock(0, 160).normalize().to-string() is "02:40" end -fun create-clock-midnight(): - check "Create a new clock with an initial time -> midnight is zero hours": - clock(24, 0).normalize().to-string() is "00:00" - end +check "Create a new clock with an initial time -> minutes roll over continuously": + clock(0, 1723).normalize().to-string() is "04:43" end -fun create-clock-hours-rollover(): - check "Create a new clock with an initial time -> hour rolls over": - clock(25, 0).normalize().to-string() is "01:00" - end +check "Create a new clock with an initial time -> hour and minutes roll over": + clock(25, 160).normalize().to-string() is "03:40" end -fun create-clock-hours-rollover-multiple(): - check "Create a new clock with an initial time -> hour rolls over continuously": - clock(100, 0).normalize().to-string() is "04:00" - end +check "Create a new clock with an initial time -> hour and minutes roll over continuously": + clock(201, 3001).normalize().to-string() is "11:01" end -fun create-clock-sixty-minutes(): - check "Create a new clock with an initial time -> sixty minutes is next hour": - clock(1, 60).normalize().to-string() is "02:00" - end +check "Create a new clock with an initial time -> hour and minutes roll over to exactly midnight": + clock(72, 8640).normalize().to-string() is "00:00" end -fun create-clock-minutes-rollover(): - check "Create a new clock with an initial time -> minutes roll over": - clock(0, 160).normalize().to-string() is "02:40" - end +check "Create a new clock with an initial time -> negative hour": + clock(-1, 15).normalize().to-string() is "23:15" end -fun create-clock-minutes-rollover-multiple(): - check "Create a new clock with an initial time -> minutes roll over continuously": - clock(0, 1723).normalize().to-string() is "04:43" - end +check "Create a new clock with an initial time -> negative hour rolls over": + clock(-25, 0).normalize().to-string() is "23:00" end -fun create-clock-rollover(): - check "Create a new clock with an initial time -> hour and minutes roll over": - clock(25, 160).normalize().to-string() is "03:40" - end +check "Create a new clock with an initial time -> negative hour rolls over continuously": + clock(-91, 0).normalize().to-string() is "05:00" end -fun create-clock-rollover-multiple(): - check "Create a new clock with an initial time -> hour and minutes roll over continuously": - clock(201, 3001).normalize().to-string() is "11:01" - end +check "Create a new clock with an initial time -> negative minutes": + clock(1, -40).normalize().to-string() is "00:20" end -fun create-clock-rollover-to-midnight(): - check "Create a new clock with an initial time -> hour and minutes roll over to exactly midnight": - clock(72, 8640).normalize().to-string() is "00:00" - end +check "Create a new clock with an initial time -> negative minutes roll over": + clock(1, -160).normalize().to-string() is "22:20" end -fun create-clock-negative-hours(): - check "Create a new clock with an initial time -> negative hour": - clock(-1, 15).normalize().to-string() is "23:15" - end +check "Create a new clock with an initial time -> negative minutes roll over continuously": + clock(1, -4820).normalize().to-string() is "16:40" end -fun create-clock-negative-hours-rollover(): - check "Create a new clock with an initial time -> negative hour rolls over": - clock(-25, 0).normalize().to-string() is "23:00" - end +check "Create a new clock with an initial time -> negative sixty minutes is previous hour": + clock(2, -60).normalize().to-string() is "01:00" end -fun create-clock-negative-hours-rollover-multiple(): - check "Create a new clock with an initial time -> negative hour rolls over continuously": - clock(-91, 0).normalize().to-string() is "05:00" - end +check "Create a new clock with an initial time -> negative hour and minutes both roll over": + clock(-25, -160).normalize().to-string() is "20:20" end -fun create-clock-negative-minutes(): - check "Create a new clock with an initial time -> negative minutes": - clock(1, -40).normalize().to-string() is "00:20" - end +check "Create a new clock with an initial time -> negative hour and minutes both roll over continuously": + clock(-121, -5810).normalize().to-string() is "22:10" end -fun create-clock-negative-minutes-rollover(): - check "Create a new clock with an initial time -> negative minutes roll over": - clock(1, -160).normalize().to-string() is "22:20" - end +check "Add minutes -> add minutes": + clock(10, 0).add(3).to-string() is "10:03" end -fun create-clock-negative-minutes-rollover-multiple(): - check "Create a new clock with an initial time -> negative minutes roll over continuously": - clock(1, -4820).normalize().to-string() is "16:40" - end +check "Add minutes -> add no minutes": + clock(6, 41).add(0).to-string() is "06:41" end -fun create-clock-negative-sixty-minutes(): - check "Create a new clock with an initial time -> negative sixty minutes is previous hour": - clock(2, -60).normalize().to-string() is "01:00" - end +check "Add minutes -> add to next hour": + clock(0, 45).add(40).to-string() is "01:25" end -fun create-clock-negative-rollover(): - check "Create a new clock with an initial time -> negative hour and minutes both roll over": - clock(-25, -160).normalize().to-string() is "20:20" - end +check "Add minutes -> add more than one hour": + clock(10, 0).add(61).to-string() is "11:01" end -fun create-clock-negative-rollover-multiple(): - check "Create a new clock with an initial time -> negative hour and minutes both roll over continuously": - clock(-121, -5810).normalize().to-string() is "22:10" - end +check "Add minutes -> add more than two hours with carry": + clock(0, 45).add(160).to-string() is "03:25" end -fun add-minutes(): - check "Add minutes -> add minutes": - clock(10, 0).add(3).to-string() is "10:03" - end +check "Add minutes -> add across midnight": + clock(23, 59).add(2).to-string() is "00:01" end -fun add-no-minutes(): - check "Add minutes -> add no minutes": - clock(6, 41).add(0).to-string() is "06:41" - end +check "Add minutes -> add more than one day (1500 min = 25 hrs)": + clock(5, 32).add(1500).to-string() is "06:32" end -fun add-to-hours(): - check "Add minutes -> add to next hour": - clock(0, 45).add(40).to-string() is "01:25" - end +check "Add minutes -> add more than two days": + clock(1, 1).add(3500).to-string() is "11:21" end -fun add-to-hours-multiple(): - check "Add minutes -> add more than one hour": - clock(10, 0).add(61).to-string() is "11:01" - end +check "Subtract minutes -> subtract minutes": + clock(10, 3).subtract(3).to-string() is "10:00" end -fun add-to-hours-carryover(): - check "Add minutes -> add more than two hours with carry": - clock(0, 45).add(160).to-string() is "03:25" - end +check "Subtract minutes -> subtract to previous hour": + clock(10, 3).subtract(30).to-string() is "09:33" end -fun add-across-midnight(): - check "Add minutes -> add across midnight": - clock(23, 59).add(2).to-string() is "00:01" - end +check "Subtract minutes -> subtract more than an hour": + clock(10, 3).subtract(70).to-string() is "08:53" end -fun add-more-than-one-day(): - check "Add minutes -> add more than one day (1500 min = 25 hrs)": - clock(5, 32).add(1500).to-string() is "06:32" - end +check "Subtract minutes -> subtract across midnight": + clock(0, 3).subtract(4).to-string() is "23:59" end -fun add-more-than-one-day-multiple(): - check "Add minutes -> add more than two days": - clock(1, 1).add(3500).to-string() is "11:21" - end +check "Subtract minutes -> subtract more than two hours": + clock(0, 0).subtract(160).to-string() is "21:20" end -fun subtract-minutes(): - check "Subtract minutes -> subtract minutes": - clock(10, 3).subtract(3).to-string() is "10:00" - end +check "Subtract minutes -> subtract more than two hours with borrow": + clock(6, 15).subtract(160).to-string() is "03:35" end -fun subtract-rollover(): - check "Subtract minutes -> subtract to previous hour": - clock(10, 3).subtract(30).to-string() is "09:33" - end +check "Subtract minutes -> subtract more than one day (1500 min = 25 hrs)": + clock(5, 32).subtract(1500).to-string() is "04:32" end -fun subtract-rollover-multiple(): - check "Subtract minutes -> subtract more than an hour": - clock(10, 3).subtract(70).to-string() is "08:53" - end +check "Subtract minutes -> subtract more than two days": + clock(2, 20).subtract(3000).to-string() is "00:20" end -fun subtract-across-midnight(): - check "Subtract minutes -> subtract across midnight": - clock(0, 3).subtract(4).to-string() is "23:59" - end +check "Compare two clocks for equality -> clocks with same time": + clock(15, 37) is clock(15, 37) end -fun subtract-more-than-two-hours(): - check "Subtract minutes -> subtract more than two hours": - clock(0, 0).subtract(160).to-string() is "21:20" - end +check "Compare two clocks for equality -> clocks a minute apart": + clock(15, 36) is-not clock(15, 37) end -fun subtract-rollover-borrow(): - check "Subtract minutes -> subtract more than two hours with borrow": - clock(6, 15).subtract(160).to-string() is "03:35" - end +check "Compare two clocks for equality -> clocks an hour apart": + clock(14, 37) is-not clock(15, 37) end -fun subtract-more-than-a-day(): - check "Subtract minutes -> subtract more than one day (1500 min = 25 hrs)": - clock(5, 32).subtract(1500).to-string() is "04:32" - end +check "Compare two clocks for equality -> clocks with hour overflow": + clock(10, 37) is clock(34, 37) end -fun subtract-more-than-two-days(): - check "Subtract minutes -> subtract more than two days": - clock(2, 20).subtract(3000).to-string() is "00:20" - end +check "Compare two clocks for equality -> clocks with hour overflow by several days": + clock(3, 11) is clock(99, 11) end -fun equality-same-time(): - check "Compare two clocks for equality -> clocks with same time": - clock(15, 37) is clock(15, 37) - end +check "Compare two clocks for equality -> clocks with negative hour": + clock(22, 40) is clock(-2, 40) end -fun equality-a-minute-apart(): - check "Compare two clocks for equality -> clocks a minute apart": - clock(15, 36) is-not clock(15, 37) - end +check "Compare two clocks for equality -> clocks with negative hour that wraps": + clock(17, 3) is clock(-31, 3) end -fun equality-an-hour-apart(): - check "Compare two clocks for equality -> clocks an hour apart": - clock(14, 37) is-not clock(15, 37) - end +check "Compare two clocks for equality -> clocks with negative hour that wraps multiple times": + clock(13, 49) is clock(-83, 49) end -fun equality-hour-rollover(): - check "Compare two clocks for equality -> clocks with hour overflow": - clock(10, 37) is clock(34, 37) - end +check "Compare two clocks for equality -> clocks with minute overflow": + clock(0, 1) is clock(0, 1441) end -fun equality-hour-overflow-multiple(): - check "Compare two clocks for equality -> clocks with hour overflow by several days": - clock(3, 11) is clock(99, 11) - end +check "Compare two clocks for equality -> clocks with minute overflow by several days": + clock(2, 2) is clock(2, 4322) end -fun equality-negative-hour(): - check "Compare two clocks for equality -> clocks with negative hour": - clock(22, 40) is clock(-2, 40) - end +check "Compare two clocks for equality -> clocks with negative minute": + clock(2, 40) is clock(3, -20) end -fun equality-negative-hour-rollover(): - check "Compare two clocks for equality -> clocks with negative hour that wraps": - clock(17, 3) is clock(-31, 3) - end +check "Compare two clocks for equality -> clocks with negative minute that wraps": + clock(4, 10) is clock(5, -1490) end -fun equality-negative-hour-rollover-multiple(): - check "Compare two clocks for equality -> clocks with negative hour that wraps multiple times": - clock(13, 49) is clock(-83, 49) - end +check "Compare two clocks for equality -> clocks with negative minute that wraps multiple times": + clock(6, 15) is clock(6, -4305) end -fun equality-minute-rollover(): - check "Compare two clocks for equality -> clocks with minute overflow": - clock(0, 1) is clock(0, 1441) - end +check "Compare two clocks for equality -> clocks with negative hours and minutes": + clock(7, 32) is clock(-12, -268) end -fun equality-rollover-multiple(): - check "Compare two clocks for equality -> clocks with minute overflow by several days": - clock(2, 2) is clock(2, 4322) - end -end - -fun equality-negative-minute(): - check "Compare two clocks for equality -> clocks with negative minute": - clock(2, 40) is clock(3, -20) - end -end - -fun equality-negative-minute-rollover(): - check "Compare two clocks for equality -> clocks with negative minute that wraps": - clock(4, 10) is clock(5, -1490) - end -end - -fun equality-negative-minute-rollover-multiple(): - check "Compare two clocks for equality -> clocks with negative minute that wraps multiple times": - clock(6, 15) is clock(6, -4305) - end -end - -fun equality-negative-hour-and-minute(): - check "Compare two clocks for equality -> clocks with negative hours and minutes": - clock(7, 32) is clock(-12, -268) - end -end - -fun equality-negative-hours-and-minutes-rollover(): - check "Compare two clocks for equality -> clocks with negative hours and minutes that wrap": - clock(18, 7) is clock(-54, -11513) - end -end - -fun equality-full-clock-empty-clock(): - check "Compare two clocks for equality -> full clock and zeroed clock": - clock(24, 0) is clock(0, 0) - end -end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(create-clock-on-hour, true), - test(create-clock-past-hour, false), - test(create-clock-midnight, false), - test(create-clock-hours-rollover, false), - test(create-clock-hours-rollover-multiple, false), - test(create-clock-sixty-minutes, false), - test(create-clock-minutes-rollover, false), - test(create-clock-minutes-rollover-multiple, false), - test(create-clock-rollover, false), - test(create-clock-rollover-multiple, false), - test(create-clock-rollover-to-midnight, false), - test(create-clock-negative-hours, false), - test(create-clock-negative-hours-rollover, false), - test(create-clock-negative-hours-rollover-multiple, false), - test(create-clock-negative-minutes, false), - test(create-clock-negative-minutes-rollover-multiple, false), - test(create-clock-negative-sixty-minutes, false), - test(create-clock-negative-rollover, false), - test(create-clock-negative-rollover-multiple, false), - test(add-minutes, false), - test(add-no-minutes, false), - test(add-to-hours, false), - test(add-to-hours-multiple, false), - test(add-to-hours-carryover, false), - test(add-across-midnight, false), - test(add-more-than-one-day, false), - test(add-more-than-one-day-multiple, false), - test(subtract-minutes, false), - test(subtract-rollover, false), - test(subtract-rollover-multiple, false), - test(subtract-across-midnight, false), - test(subtract-more-than-two-hours, false), - test(subtract-rollover-borrow, false), - test(subtract-more-than-a-day, false), - test(subtract-more-than-two-days, false), - test(equality-same-time, false), - test(equality-a-minute-apart, false), - test(equality-an-hour-apart, false), - test(equality-hour-rollover, false), - test(equality-hour-overflow-multiple, false), - test(equality-negative-hour, false), - test(equality-negative-hour-rollover, false), - test(equality-negative-hour-rollover-multiple, false), - test(equality-minute-rollover, false), - test(equality-rollover-multiple, false), - test(equality-negative-minute, false), - test(equality-negative-minute-rollover, false), - test(equality-negative-minute-rollover-multiple, false), - test(equality-negative-hour-and-minute, false), - test(equality-negative-hours-and-minutes-rollover, false), - test(equality-full-clock-empty-clock, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file +check "Compare two clocks for equality -> clocks with negative hours and minutes that wrap": + clock(18, 7) is clock(-54, -11513) +end + +check "Compare two clocks for equality -> full clock and zeroed clock": + clock(24, 0) is clock(0, 0) +end diff --git a/exercises/practice/clock/clock.arr b/exercises/practice/clock/clock.arr index 26980b3a..4ebac4c2 100644 --- a/exercises/practice/clock/clock.arr +++ b/exercises/practice/clock/clock.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * diff --git a/exercises/practice/collatz-conjecture/.meta/example.arr b/exercises/practice/collatz-conjecture/.meta/example.arr index 56635d92..e89525d6 100644 --- a/exercises/practice/collatz-conjecture/.meta/example.arr +++ b/exercises/practice/collatz-conjecture/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: steps end diff --git a/exercises/practice/collatz-conjecture/collatz-conjecture-test.arr b/exercises/practice/collatz-conjecture/collatz-conjecture-test.arr index e624f9a4..da407779 100644 --- a/exercises/practice/collatz-conjecture/collatz-conjecture-test.arr +++ b/exercises/practice/collatz-conjecture/collatz-conjecture-test.arr @@ -1,62 +1,27 @@ -use context essentials2020 +use context starter2024 include file("collatz-conjecture.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun zero-steps-for-one(): - check "zero steps for one": - steps(1) is 0 - end +check "zero steps for one": + steps(1) is 0 end -fun divide-if-even(): - check "divide if even": - steps(16) is 4 - end +check "divide if even": + steps(16) is 4 end -fun even-and-odd-steps(): - check "even and odd steps": - steps(12) is 9 - end +check "even and odd steps": + steps(12) is 9 end -fun large-number-of-even-and-odd-steps(): - check "large number of even and odd steps": - steps(1000000) is 152 - end +check "large number of even and odd steps": + steps(1000000) is 152 end -fun zero-is-an-error(): - check "zero is an error": - steps(0) raises "Only positive numbers are allowed" - end +check "zero is an error": + steps(0) raises "Only positive numbers are allowed" end -fun negative-is-an-error(): - check "negative value is an error": - steps(-15) raises "Only positive numbers are allowed" - end +check "negative value is an error": + steps(-15) raises "Only positive numbers are allowed" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(zero-steps-for-one, true), - test(divide-if-even, false), - test(even-and-odd-steps, false), - test(large-number-of-even-and-odd-steps, false), - test(zero-is-an-error, false), - test(negative-is-an-error, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/collatz-conjecture/collatz-conjecture.arr b/exercises/practice/collatz-conjecture/collatz-conjecture.arr index edeb8179..bad67d99 100644 --- a/exercises/practice/collatz-conjecture/collatz-conjecture.arr +++ b/exercises/practice/collatz-conjecture/collatz-conjecture.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: steps end diff --git a/exercises/practice/darts/.meta/example.arr b/exercises/practice/darts/.meta/example.arr index 29ca1b4c..3da3abac 100644 --- a/exercises/practice/darts/.meta/example.arr +++ b/exercises/practice/darts/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: score end diff --git a/exercises/practice/darts/darts-test.arr b/exercises/practice/darts/darts-test.arr index 5d4def01..40a9c303 100644 --- a/exercises/practice/darts/darts-test.arr +++ b/exercises/practice/darts/darts-test.arr @@ -1,111 +1,55 @@ -use context essentials2020 +use context starter2024 include file("darts.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun missed-target(): - check "Missed target": - score(-9, 9) is 0 - end +check "Missed target": + score(-9, 9) is 0 end -fun on-outer-circle(): - check "On the outer circle": - score(0, 10) is 1 - end +check "On the outer circle": + score(0, 10) is 1 end -fun on-middle-circle(): - check "On the middle circle": - score(-5, 0) is 5 - end +check "On the middle circle": + score(-5, 0) is 5 end -fun on-inner-circle(): - check "On the inner circle": - score(0, -1) is 10 - end +check "On the inner circle": + score(0, -1) is 10 end -fun at-center(): - check "Exactly on center": - score(0, 0) is 10 - end +check "Exactly on center": + score(0, 0) is 10 end -fun near-center(): - check "Near the center": - score(-0.1, -0.1) is 10 - end +check "Near the center": + score(-0.1, -0.1) is 10 end -fun just-within-inner-circle(): - check "Just within the inner circle": - score(0.7, 0.7) is 10 - end +check "Just within the inner circle": + score(0.7, 0.7) is 10 end -fun just-outside-inner-circle(): - check "Just outside the inner circle": - score(0.8, -0.8) is 5 - end +check "Just outside the inner circle": + score(0.8, -0.8) is 5 end -fun just-within-middle-circle(): - check "Just within the middle circle": - score(-3.5, 3.5) is 5 - end +check "Just within the middle circle": + score(-3.5, 3.5) is 5 end -fun just-outside-middle-circle(): - check "Just outside the middle circle": - score(-3.6, 3.6) is 1 - end +check "Just outside the middle circle": + score(-3.6, 3.6) is 1 end -fun just-within-outer-circle(): - check "Just within the outer circle": - score(-7.0, 7.0) is 1 - end +check "Just within the outer circle": + score(-7.0, 7.0) is 1 end -fun just-outside-outer-circle(): - check "Just outside the outer circle": - score(7.1, -7.1) is 0 - end +check "Just outside the outer circle": + score(7.1, -7.1) is 0 end -fun asymmetric-position(): - check "Asymmetric position between the inner and middle circles": - score(0.5, -4) is 5 - end +check "Asymmetric position between the inner and middle circles": + score(0.5, -4) is 5 end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(missed-target, true), - test(on-outer-circle, false), - test(on-middle-circle, false), - test(on-inner-circle, false), - test(at-center, false), - test(near-center, false), - test(just-within-inner-circle, false), - test(just-outside-inner-circle, false), - test(just-within-middle-circle, false), - test(just-outside-middle-circle, false), - test(just-within-outer-circle, false), - test(just-outside-outer-circle, false), - test(asymmetric-position, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/darts/darts.arr b/exercises/practice/darts/darts.arr index 46b7d754..924f0239 100644 --- a/exercises/practice/darts/darts.arr +++ b/exercises/practice/darts/darts.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: score end diff --git a/exercises/practice/difference-of-squares/.meta/example.arr b/exercises/practice/difference-of-squares/.meta/example.arr index deaab4bc..e1bb6998 100644 --- a/exercises/practice/difference-of-squares/.meta/example.arr +++ b/exercises/practice/difference-of-squares/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: square-of-sum, sum-of-squares, difference-of-squares end @@ -13,4 +13,4 @@ end fun difference-of-squares(number): square-of-sum(number) - sum-of-squares(number) -end \ No newline at end of file +end diff --git a/exercises/practice/difference-of-squares/difference-of-squares-test.arr b/exercises/practice/difference-of-squares/difference-of-squares-test.arr index 192dc8aa..479ce83e 100644 --- a/exercises/practice/difference-of-squares/difference-of-squares-test.arr +++ b/exercises/practice/difference-of-squares/difference-of-squares-test.arr @@ -1,83 +1,39 @@ -use context essentials2020 +use context starter2024 include file("difference-of-squares.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun square-of-sum-1(): - check "Square the sum of the numbers up to the given number -> square of sum 1": - square-of-sum(1) is 1 - end +check "Square the sum of the numbers up to the given number -> square of sum 1": + square-of-sum(1) is 1 end -fun square-of-sum-5(): - check "Square the sum of the numbers up to the given number -> square of sum 5": - square-of-sum(5) is 225 - end +check "Square the sum of the numbers up to the given number -> square of sum 5": + square-of-sum(5) is 225 end -fun square-of-sum-100(): - check "Square the sum of the numbers up to the given number -> square of sum 100": - square-of-sum(100) is 25502500 - end +check "Square the sum of the numbers up to the given number -> square of sum 100": + square-of-sum(100) is 25502500 end -fun sum-of-squares-1(): - check "Sum the squares of the numbers up to the given number -> sum of squares 1": - sum-of-squares(1) is 1 - end +check "Sum the squares of the numbers up to the given number -> sum of squares 1": + sum-of-squares(1) is 1 end -fun sum-of-squares-5(): - check "Sum the squares of the numbers up to the given number -> sum of squares 5": - sum-of-squares(5) is 55 - end +check "Sum the squares of the numbers up to the given number -> sum of squares 5": + sum-of-squares(5) is 55 end -fun sum-of-squares-100(): - check "Sum the squares of the numbers up to the given number -> sum of squares 100": - sum-of-squares(100) is 338350 - end +check "Sum the squares of the numbers up to the given number -> sum of squares 100": + sum-of-squares(100) is 338350 end -fun difference-of-squares-1(): - check "Subtract sum of squares from square of sums -> difference of squares 1": - difference-of-squares(1) is 0 - end +check "Subtract sum of squares from square of sums -> difference of squares 1": + difference-of-squares(1) is 0 end -fun difference-of-squares-5(): - check "Subtract sum of squares from square of sums -> difference of squares 5": - difference-of-squares(5) is 170 - end +check "Subtract sum of squares from square of sums -> difference of squares 5": + difference-of-squares(5) is 170 end -fun dfference-of-squares-100(): - check "Subtract sum of squares from square of sums -> difference of squares 100": - difference-of-squares(100) is 25164150 - end +check "Subtract sum of squares from square of sums -> difference of squares 100": + difference-of-squares(100) is 25164150 end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(square-of-sum-1, true), - test(square-of-sum-5, false), - test(square-of-sum-100, false), - test(sum-of-squares-1, false), - test(sum-of-squares-5, false), - test(sum-of-squares-100, false), - test(difference-of-squares-1, false), - test(difference-of-squares-5, false), - test(dfference-of-squares-100, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/difference-of-squares/difference-of-squares.arr b/exercises/practice/difference-of-squares/difference-of-squares.arr index a1aac354..bf36cc5f 100644 --- a/exercises/practice/difference-of-squares/difference-of-squares.arr +++ b/exercises/practice/difference-of-squares/difference-of-squares.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: square-of-sum, sum-of-squares, difference-of-squares end @@ -12,4 +12,4 @@ end fun difference-of-squares(number): raise("please implement the difference-of-squares function") -end \ No newline at end of file +end diff --git a/exercises/practice/dnd-character/.meta/example.arr b/exercises/practice/dnd-character/.meta/example.arr index 398475cc..41f598f2 100644 --- a/exercises/practice/dnd-character/.meta/example.arr +++ b/exercises/practice/dnd-character/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * diff --git a/exercises/practice/dnd-character/dnd-character-test.arr b/exercises/practice/dnd-character/dnd-character-test.arr index f8d9b613..60f4f877 100644 --- a/exercises/practice/dnd-character/dnd-character-test.arr +++ b/exercises/practice/dnd-character/dnd-character-test.arr @@ -1,168 +1,96 @@ -use context essentials2020 +use context starter2024 include file("dnd-character.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - - # declaring some variables to be more concise inside the tests. modifier = blank-character().modifier ability = blank-character().ability randomize-stats = blank-character().randomize-stats -fun modifier-score-3(): - check "ability modifier -> ability modifier for score 3 is -4": - modifier(3) is -4 - end +check "ability modifier -> ability modifier for score 3 is -4": + modifier(3) is -4 end -fun modifier-score-4(): - check "ability modifier -> ability modifier for score 4 is -3": - modifier(4) is -3 - end +check "ability modifier -> ability modifier for score 4 is -3": + modifier(4) is -3 end -fun modifier-score-5(): - check "ability modifier -> ability modifier for score 5 is -3": - modifier(5) is -3 - end +check "ability modifier -> ability modifier for score 5 is -3": + modifier(5) is -3 end -fun modifier-score-6(): - check "ability modifier -> ability modifier for score 6 is -2": - modifier(6) is -2 - end +check "ability modifier -> ability modifier for score 6 is -2": + modifier(6) is -2 end -fun modifier-score-7(): - check "ability modifier -> ability modifier for score 7 is -2": - modifier(7) is -2 - end +check "ability modifier -> ability modifier for score 7 is -2": + modifier(7) is -2 end -fun modifier-score-8(): - check "ability modifier -> ability modifier for score 8 is -1": - modifier(8) is -1 - end +check "ability modifier -> ability modifier for score 8 is -1": + modifier(8) is -1 end -fun modifier-score-9(): - check "ability modifier -> ability modifier for score 9 is -1": - modifier(9) is -1 - end +check "ability modifier -> ability modifier for score 9 is -1": + modifier(9) is -1 end -fun modifier-score-10(): - check "ability modifier -> ability modifier for score 10 is 0": - modifier(10) is 0 - end +check "ability modifier -> ability modifier for score 10 is 0": + modifier(10) is 0 end -fun modifier-score-11(): - check "ability modifier -> ability modifier for score 11 is 0": - modifier(11) is 0 - end +check "ability modifier -> ability modifier for score 11 is 0": + modifier(11) is 0 end -fun modifier-score-12(): - check "ability modifier -> ability modifier for score 12 is +1": - modifier(12) is 1 - end +check "ability modifier -> ability modifier for score 12 is +1": + modifier(12) is 1 end -fun modifier-score-13(): - check "ability modifier -> ability modifier for score 13 is +1": - modifier(13) is 1 - end +check "ability modifier -> ability modifier for score 13 is +1": + modifier(13) is 1 end -fun modifier-score-14(): - check "ability modifier -> ability modifier for score 14 is +2": - modifier(14) is 2 - end +check "ability modifier -> ability modifier for score 14 is +2": + modifier(14) is 2 end -fun modifier-score-15(): - check "ability modifier -> ability modifier for score 15 is +2": - modifier(15) is 2 - end +check "ability modifier -> ability modifier for score 15 is +2": + modifier(15) is 2 end -fun modifier-score-16(): - check "ability modifier -> ability modifier for score 16 is +3": - modifier(16) is 3 - end +check "ability modifier -> ability modifier for score 16 is +3": + modifier(16) is 3 end -fun modifier-score-17(): - check "ability modifier -> ability modifier for score 17 is +3": - modifier(17) is 3 - end +check "ability modifier -> ability modifier for score 17 is +3": + modifier(17) is 3 end -fun modifier-score-18(): - check "ability modifier -> ability modifier for score 18 is +4": - modifier(18) is 4 - end +check "ability modifier -> ability modifier for score 18 is +4": + modifier(18) is 4 end -fun ability-within-range(): - check "random ability is within range": - stat = ability() - - is-valid = lam(n): (n >= 3) and (n <= 18) end +check "random ability is within range": + stat = ability() + + is-valid = lam(n): (n >= 3) and (n <= 18) end - is-valid(stat) is true - end + is-valid(stat) is true end -fun random-character-is-valid(): - check "random character is valid": - new-character = randomize-stats() +check "random character is valid": + new-character = randomize-stats() - is-valid = lam(n): (n >= 3) and (n <= 18) end + is-valid = lam(n): (n >= 3) and (n <= 18) end + + is-valid(new-character.strength) is true + is-valid(new-character.dexterity) is true + is-valid(new-character.constitution) is true + is-valid(new-character.intelligence) is true + is-valid(new-character.wisdom) is true + is-valid(new-character.charisma) is true - is-valid(new-character.strength) is true - is-valid(new-character.dexterity) is true - is-valid(new-character.constitution) is true - is-valid(new-character.intelligence) is true - is-valid(new-character.wisdom) is true - is-valid(new-character.charisma) is true - - expected = 10 + new-character.modifier(new-character.constitution) - new-character.get-hitpoints() is expected - end -end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(modifier-score-3, true), - test(modifier-score-4, false), - test(modifier-score-5, false), - test(modifier-score-6, false), - test(modifier-score-7, false), - test(modifier-score-8, false), - test(modifier-score-9, false), - test(modifier-score-10, false), - test(modifier-score-11, false), - test(modifier-score-12, false), - test(modifier-score-13, false), - test(modifier-score-14, false), - test(modifier-score-15, false), - test(modifier-score-16, false), - test(modifier-score-17, false), - test(modifier-score-18, false), - test(ability-within-range, false), - test(random-character-is-valid, false) -].each(lam(t): when t.active: t.run() end end) + expected = 10 + new-character.modifier(new-character.constitution) + new-character.get-hitpoints() is expected +end diff --git a/exercises/practice/dnd-character/dnd-character.arr b/exercises/practice/dnd-character/dnd-character.arr index 1e6eed8f..7080ae96 100644 --- a/exercises/practice/dnd-character/dnd-character.arr +++ b/exercises/practice/dnd-character/dnd-character.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * diff --git a/exercises/practice/eliuds-eggs/.meta/example.arr b/exercises/practice/eliuds-eggs/.meta/example.arr index 942779d4..df3fd98b 100644 --- a/exercises/practice/eliuds-eggs/.meta/example.arr +++ b/exercises/practice/eliuds-eggs/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: egg-count end diff --git a/exercises/practice/eliuds-eggs/eliuds-eggs-test.arr b/exercises/practice/eliuds-eggs/eliuds-eggs-test.arr index 744d8fb9..a2f6da06 100644 --- a/exercises/practice/eliuds-eggs/eliuds-eggs-test.arr +++ b/exercises/practice/eliuds-eggs/eliuds-eggs-test.arr @@ -1,48 +1,19 @@ -use context essentials2020 +use context starter2024 include file("eliuds-eggs.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun zero-eggs(): - check "0 eggs": - egg-count(0) is 0 - end +check "0 eggs": + egg-count(0) is 0 end -fun one-egg(): - check "1 egg": - egg-count(16) is 1 - end +check "1 egg": + egg-count(16) is 1 end -fun four-eggs(): - check "4 eggs": - egg-count(89) is 4 - end +check "4 eggs": + egg-count(89) is 4 end -fun thirteen-eggs(): - check "13 eggs": - egg-count(2000000000) is 13 - end +check "13 eggs": + egg-count(2000000000) is 13 end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(zero-eggs, true), - test(one-egg, false), - test(four-eggs, false), - test(thirteen-eggs, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/eliuds-eggs/eliuds-eggs.arr b/exercises/practice/eliuds-eggs/eliuds-eggs.arr index 7965c12a..056a5c0d 100644 --- a/exercises/practice/eliuds-eggs/eliuds-eggs.arr +++ b/exercises/practice/eliuds-eggs/eliuds-eggs.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: egg-count end diff --git a/exercises/practice/etl/.meta/example.arr b/exercises/practice/etl/.meta/example.arr index 961423e6..f0f3df53 100644 --- a/exercises/practice/etl/.meta/example.arr +++ b/exercises/practice/etl/.meta/example.arr @@ -1,10 +1,10 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 -provide: translate end +provide: my-translate end include string-dict -fun translate(legacy): +fun my-translate(legacy): result = block: var result = [mutable-string-dict:] (legacy.keys().to-list()).each(lam(n): legacy.get-value(n).each(lam(letter): result.set-now(string-to-lower(letter), n) end) end) diff --git a/exercises/practice/etl/etl-test.arr b/exercises/practice/etl/etl-test.arr index 42c7c0ce..536ea719 100644 --- a/exercises/practice/etl/etl-test.arr +++ b/exercises/practice/etl/etl-test.arr @@ -1,66 +1,37 @@ -use context essentials2020 +use context starter2024 include file("etl.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - include string-dict -fun single-letter(): - check "single letter": - translate([string-dict: "1", [list: "A"]]) is [string-dict: "a", "1"] - end +check "single letter": + my-translate([string-dict: "1", [list: "A"]]) is [string-dict: "a", "1"] end -fun single-score-multiple-letters(): - check "single score with multiple letters": - translate([string-dict: "1", [list: "A", "E", "I", "O", "U"]]) is [string-dict: "a", "1", "e", "1", "i", "1", "o", "1", "u", "1"] - end +check "single score with multiple letters": + my-translate([string-dict: "1", [list: "A", "E", "I", "O", "U"]]) is [string-dict: "a", "1", "e", "1", "i", "1", "o", "1", "u", "1"] end -fun multiple-scores-multiple-letters(): - check "multiple scores with multiple letters": - input = [string-dict: "1", [list: "A", "E", "I", "O", "U"], "2", [list: "D", "G"]] - expected = [string-dict: "a", "1", "e", "1", "i", "1", "o", "1", "u", "1", "d", "2", "g", "2"] - translate(input) is expected - end +check "multiple scores with multiple letters": + input = [string-dict: "1", [list: "A", "E", "I", "O", "U"], "2", [list: "D", "G"]] + expected = [string-dict: "a", "1", "e", "1", "i", "1", "o", "1", "u", "1", "d", "2", "g", "2"] + my-translate(input) is expected end -fun multiple-scores-different-numbers-of-letters(): - check "multiple scores with differing numbers of letters": - input = [string-dict: "1", [list: "A", "E", "I", "O", "U"], - "2", [list: "D", "G"], - "3", [list: "B", "C", "M", "P"], - "4", [list: "F", "H", "V", "W", "Y"], - "5", [list: "K"], - "8", [list: "J", "X"], - "10", [list: "Q", "Z"]] - expected = [string-dict: "a", "1", "e", "1", "i", "1", "o", "1", "u", "1", - "d", "2", "g", "2", - "b", "3", "c", "3", "m", "3", "p", "3", - "f", "4", "h", "4", "v", "4", "w", "4", "y", "4", - "k", "5", - "j", "8", "x", "8", - "q", "10", "z", "10"] - translate(input) is expected - end +check "multiple scores with differing numbers of letters": + input = [string-dict: "1", [list: "A", "E", "I", "O", "U"], + "2", [list: "D", "G"], + "3", [list: "B", "C", "M", "P"], + "4", [list: "F", "H", "V", "W", "Y"], + "5", [list: "K"], + "8", [list: "J", "X"], + "10", [list: "Q", "Z"]] + expected = [string-dict: "a", "1", "e", "1", "i", "1", "o", "1", "u", "1", + "d", "2", "g", "2", + "b", "3", "c", "3", "m", "3", "p", "3", + "f", "4", "h", "4", "v", "4", "w", "4", "y", "4", + "k", "5", + "j", "8", "x", "8", + "q", "10", "z", "10"] + my-translate(input) is expected end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(single-letter, true), - test(single-score-multiple-letters, false), - test(multiple-scores-multiple-letters, false), - test(multiple-scores-different-numbers-of-letters, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/etl/etl.arr b/exercises/practice/etl/etl.arr index 30cfc045..f5c15442 100644 --- a/exercises/practice/etl/etl.arr +++ b/exercises/practice/etl/etl.arr @@ -1,7 +1,7 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 -provide: translate end +provide: my-translate end -fun translate(legacy): - raise("Please implement the translate function") +fun my-translate(legacy): + raise("Please implement the my-translate function") end diff --git a/exercises/practice/flatten-array/.meta/example.arr b/exercises/practice/flatten-array/.meta/example.arr index 81466223..0c36c8b4 100644 --- a/exercises/practice/flatten-array/.meta/example.arr +++ b/exercises/practice/flatten-array/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: flatten end diff --git a/exercises/practice/flatten-array/flatten-array-test.arr b/exercises/practice/flatten-array/flatten-array-test.arr index cd32767e..b2aa91ef 100644 --- a/exercises/practice/flatten-array/flatten-array-test.arr +++ b/exercises/practice/flatten-array/flatten-array-test.arr @@ -1,207 +1,157 @@ -use context essentials2020 +use context starter2024 include file("flatten-array.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +check "empty": + input = [list: ] -fun empty-array(): - check "empty": - input = [list: ] + expected = [list: ] - expected = [list: ] - - flatten(input) is expected - end + flatten(input) is expected end -fun no-nesting(): - check "no nesting": - input = [list: 0, 1, 2] +check "no nesting": + input = [list: 0, 1, 2] - expected = [list: 0, 1, 2] + expected = [list: 0, 1, 2] - flatten(input) is expected - end + flatten(input) is expected end -fun nested-array(): - check "flattens a nested array": - input = [list: [list: ]] +check "flattens a nested array": + input = [list: [list: ]] - expected = [list: ] + expected = [list: ] - flatten(input) is expected - end + flatten(input) is expected end -fun numeric-array(): - check "flattens array with just integers present": - input = [list: 1, [list: 2, 3, 4, 5, 6, 7], 8] +check "flattens array with just integers present": + input = [list: 1, [list: 2, 3, 4, 5, 6, 7], 8] - expected = [list: 1, 2, 3, 4, 5, 6, 7, 8] + expected = [list: 1, 2, 3, 4, 5, 6, 7, 8] - flatten(input) is expected - end + flatten(input) is expected end -fun five-levels(): - check "5 level nesting": - input = [list: - 0, - 2, - [list: - [list: 2, 3], - 8, - 100, - 4, - [list: - [list: - [list: 50]]]], - -2] - - expected = [list: - 0, - 2, - 2, - 3, +check "5 level nesting": + input = [list: + 0, + 2, + [list: + [list: 2, 3], 8, 100, 4, - 50, - -2] - - flatten(input) is expected - end -end - -fun six-levels(): - check "6 level nesting": - input = [list: - 1, [list: - 2, - [list: [list: 3]], [list: - 4, - [list: [list: 5]]], - 6, - 7], - 8] - - expected = [list: - 1, + [list: 50]]]], + -2] + + expected = [list: + 0, + 2, + 2, + 3, + 8, + 100, + 4, + 50, + -2] + + flatten(input) is expected +end + +check "6 level nesting": + input = [list: + 1, + [list: 2, - 3, + [list: [list: 3]], + [list: 4, - 5, + [list: [list: 5]]], 6, - 7, - 8] - - flatten(input) is expected - end + 7], + 8] + + expected = [list: + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8] + + flatten(input) is expected end -fun omit-a-nothing(): - check "nothing values are omitted from the final result": - input = [list: 1, 2, nothing] +check "nothing values are omitted from the final result": + input = [list: 1, 2, nothing] - expected = [list: 1, 2] + expected = [list: 1, 2] - flatten(input) is expected - end + flatten(input) is expected end -fun omit-nothings-from-beginning(): - check "consecutive nothing values at the front of the array are omitted from the final result": - input = [list: nothing, nothing, 3] +check "consecutive nothing values at the front of the array are omitted from the final result": + input = [list: nothing, nothing, 3] - expected = [list: 3] + expected = [list: 3] - flatten(input) is expected - end + flatten(input) is expected end -fun omit-nothings-from-middle(): - check "consecutive nothing values in the middle of the array are omitted from the final result": - input = [list: 1, nothing, nothing, 4] +check "consecutive nothing values in the middle of the array are omitted from the final result": + input = [list: 1, nothing, nothing, 4] - expected = [list: 1, 4] + expected = [list: 1, 4] - flatten(input) is expected - end + flatten(input) is expected end -fun six-levels-with-nothings(): - check "6 level nest array with nothing values": - input = [list: - 0, - 2, - [list: - [list: 2, 3], - 8, - [list: [list: 100 ]], - nothing, - [list: [list: nothing]]], - -2] - - expected = [list: - 0, - 2, - 2, - 3, +check "6 level nest array with nothing values": + input = [list: + 0, + 2, + [list: + [list: 2, 3], 8, - 100, - -2] - - flatten(input) is expected - end + [list: [list: 100 ]], + nothing, + [list: [list: nothing]]], + -2] + + expected = [list: + 0, + 2, + 2, + 3, + 8, + 100, + -2] + + flatten(input) is expected end -fun all-nothings(): - check "all values in nested array are nothing": - input = [list: - nothing, +check "all values in nested array are nothing": + input = [list: + nothing, + [list: [list: - [list: - [list: nothing]]], - nothing, - nothing, + [list: nothing]]], + nothing, + nothing, + [list: [list: - [list: - nothing, - nothing], + nothing, nothing], - nothing] + nothing], + nothing] - expected = [list: ] + expected = [list: ] - flatten(input) is expected - end + flatten(input) is expected end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(empty-array, true), - test(no-nesting, false), - test(nested-array, false), - test(numeric-array, false), - test(five-levels, false), - test(six-levels, false), - test(omit-a-nothing, false), - test(omit-nothings-from-beginning, false), - test(omit-nothings-from-middle, false), - test(six-levels-with-nothings, false), - test(all-nothings, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/flatten-array/flatten-array.arr b/exercises/practice/flatten-array/flatten-array.arr index 61c4bc3d..28b41c11 100644 --- a/exercises/practice/flatten-array/flatten-array.arr +++ b/exercises/practice/flatten-array/flatten-array.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: flatten end diff --git a/exercises/practice/grains/.meta/example.arr b/exercises/practice/grains/.meta/example.arr index 475d7f8a..6bb79e14 100644 --- a/exercises/practice/grains/.meta/example.arr +++ b/exercises/practice/grains/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: on-square, total end @@ -16,4 +16,4 @@ end fun total() -> Number: num-expt(2, 64) - 1 -end \ No newline at end of file +end diff --git a/exercises/practice/grains/grains-test.arr b/exercises/practice/grains/grains-test.arr index 27982e0d..84a6bb09 100644 --- a/exercises/practice/grains/grains-test.arr +++ b/exercises/practice/grains/grains-test.arr @@ -1,97 +1,47 @@ -use context essentials2020 +use context starter2024 include file("grains.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun on-square-1(): - check "returns the number of grains on the square -> grains on square 1": - on-square(1) is 1 - end +check "returns the number of grains on the square -> grains on square 1": + on-square(1) is 1 end -fun on-square-2(): - check "returns the number of grains on the square -> grains on square 2": - on-square(2) is 2 - end +check "returns the number of grains on the square -> grains on square 2": + on-square(2) is 2 end -fun on-square-3(): - check "returns the number of grains on the square -> grains on square 3": - on-square(3) is 4 - end +check "returns the number of grains on the square -> grains on square 3": + on-square(3) is 4 end -fun on-square-4(): - check "returns the number of grains on the square -> grains on square 4": - on-square(4) is 8 - end +check "returns the number of grains on the square -> grains on square 4": + on-square(4) is 8 end -fun on-square-16(): - check "returns the number of grains on the square -> grains on square 16": - on-square(16) is 32768 - end +check "returns the number of grains on the square -> grains on square 16": + on-square(16) is 32768 end -fun on-square-32(): - check "returns the number of grains on the square -> grains on square 32": - on-square(32) is 2147483648 - end +check "returns the number of grains on the square -> grains on square 32": + on-square(32) is 2147483648 end -fun on-square-64(): - check "returns the number of grains on the square -> grains on square 64": - on-square(64) is 9223372036854775808 - end +check "returns the number of grains on the square -> grains on square 64": + on-square(64) is 9223372036854775808 end -fun on-square-raises-exception-for-zero(): - check "returns the number of grains on the square -> square 0 raises an exception": - on-square(0) raises "square must be between 1 and 64" - end +check "returns the number of grains on the square -> square 0 raises an exception": + on-square(0) raises "square must be between 1 and 64" end -fun on-square-raises-exception-for-negative(): - check "returns the number of grains on the square -> negative square raises an exception": - on-square(-1) raises "square must be between 1 and 64" - end +check "returns the number of grains on the square -> negative square raises an exception": + on-square(-1) raises "square must be between 1 and 64" end -fun on-square-raises-exception-for-65(): - check "returns the number of grains on the square -> square greater than 64 raises an exception": - on-square(65) raises "square must be between 1 and 64" - end +check "returns the number of grains on the square -> square greater than 64 raises an exception": + on-square(65) raises "square must be between 1 and 64" end -fun total-returns-all-grains(): - check "returns the total number of grains on the board": - total() is 18446744073709551615 - end +check "returns the total number of grains on the board": + total() is 18446744073709551615 end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(on-square-1, true), - test(on-square-2, false), - test(on-square-3, false), - test(on-square-4, false), - test(on-square-16, false), - test(on-square-32, false), - test(on-square-64, false), - test(on-square-raises-exception-for-zero, false), - test(on-square-raises-exception-for-negative, false), - test(on-square-raises-exception-for-65, false), - test(total-returns-all-grains, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/grains/grains.arr b/exercises/practice/grains/grains.arr index 11dde7f6..017f6628 100644 --- a/exercises/practice/grains/grains.arr +++ b/exercises/practice/grains/grains.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: on-square, total end @@ -8,4 +8,4 @@ end fun total(): raise("Please implement the total function") -end \ No newline at end of file +end diff --git a/exercises/practice/hamming/.meta/example.arr b/exercises/practice/hamming/.meta/example.arr index c60b88c0..47656a3b 100644 --- a/exercises/practice/hamming/.meta/example.arr +++ b/exercises/practice/hamming/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: distance end @@ -26,4 +26,4 @@ fun distance(first-strand, second-strand): string-explode(first-strand), string-explode(second-strand)) end -end \ No newline at end of file +end diff --git a/exercises/practice/hamming/hamming-test.arr b/exercises/practice/hamming/hamming-test.arr index 93452e4f..9bb31980 100644 --- a/exercises/practice/hamming/hamming-test.arr +++ b/exercises/practice/hamming/hamming-test.arr @@ -1,83 +1,39 @@ -use context essentials2020 +use context starter2024 include file("hamming.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun empty-strands(): - check "empty strands": - distance("", "") is 0 - end +check "empty strands": + distance("", "") is 0 end -fun single-letter-identical-strands(): - check "single letter identical strands": - distance("A", "A") is 0 - end +check "single letter identical strands": + distance("A", "A") is 0 end -fun single-letter-different-strands(): - check "single letter different strands": - distance("G", "T") is 1 - end +check "single letter different strands": + distance("G", "T") is 1 end -fun long-identical-strands(): - check "long identical strands": - distance("GGACTGAAATCTG", "GGACTGAAATCTG") is 0 - end +check "long identical strands": + distance("GGACTGAAATCTG", "GGACTGAAATCTG") is 0 end -fun long-different-strands(): - check "long different strands": - distance("GGACGGATTCTG", "AGGACGGATTCT") is 9 - end +check "long different strands": + distance("GGACGGATTCTG", "AGGACGGATTCT") is 9 end -fun disallow-first-strand-longer(): - check "disallow first strand longer": - distance("AATG", "AAA") raises "Strands must be of equal length." - end +check "disallow first strand longer": + distance("AATG", "AAA") raises "Strands must be of equal length." end -fun disallow-second-strand-longer(): - check "disallow second strand longer": - distance("ATA", "AGTG") raises "Strands must be of equal length." - end +check "disallow second strand longer": + distance("ATA", "AGTG") raises "Strands must be of equal length." end -fun disallow-empty-first-strand(): - check "disallow empty first strand": - distance("", "G") raises "Strands must be of equal length." - end +check "disallow empty first strand": + distance("", "G") raises "Strands must be of equal length." end -fun disallow-empty-second-strand(): - check "disallow empty second strand": - distance("G", "") raises "Strands must be of equal length." - end +check "disallow empty second strand": + distance("G", "") raises "Strands must be of equal length." end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(empty-strands, true), - test(single-letter-identical-strands, false), - test(single-letter-different-strands, false), - test(long-identical-strands, false), - test(long-different-strands, false), - test(disallow-first-strand-longer, false), - test(disallow-second-strand-longer, false), - test(disallow-empty-first-strand, false), - test(disallow-empty-second-strand, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/hamming/hamming.arr b/exercises/practice/hamming/hamming.arr index ab01d188..79c30a90 100644 --- a/exercises/practice/hamming/hamming.arr +++ b/exercises/practice/hamming/hamming.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: distance end diff --git a/exercises/practice/hello-world/.meta/example.arr b/exercises/practice/hello-world/.meta/example.arr index 67470869..49089e90 100644 --- a/exercises/practice/hello-world/.meta/example.arr +++ b/exercises/practice/hello-world/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: hello end diff --git a/exercises/practice/hello-world/hello-world-test.arr b/exercises/practice/hello-world/hello-world-test.arr index 46d955f5..44d6ee3c 100644 --- a/exercises/practice/hello-world/hello-world-test.arr +++ b/exercises/practice/hello-world/hello-world-test.arr @@ -1,27 +1,7 @@ -use context essentials2020 +use context starter2024 include file("hello-world.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun say-hi(): - check "Say Hi!": - hello() is "Hello, World!" - end +check "Say Hi!": + hello() is "Hello, World!" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(say-hi, true) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/hello-world/hello-world.arr b/exercises/practice/hello-world/hello-world.arr index 38206d47..80fdebe0 100644 --- a/exercises/practice/hello-world/hello-world.arr +++ b/exercises/practice/hello-world/hello-world.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: hello end diff --git a/exercises/practice/high-scores/high-scores-test.arr b/exercises/practice/high-scores/high-scores-test.arr index 977bdbb9..4154a53e 100644 --- a/exercises/practice/high-scores/high-scores-test.arr +++ b/exercises/practice/high-scores/high-scores-test.arr @@ -1,100 +1,59 @@ -use context essentials2020 +use context starter2024 include file("high-scores.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +check "List of scores": + scores = [list: 30, 50, 20, 70] + expected = [list: 30, 50, 20, 70] -fun list-of-scores(): - check "List of scores": - scores = [list: 30, 50, 20, 70] - expected = [list: 30, 50, 20, 70] - - high-scores(scores).scores is expected - end + high-scores(scores).scores is expected end -fun latest-score(): - check "Latest score": - scores = [list: 100, 0, 90, 30] - expected = 30 +check "Latest score": + scores = [list: 100, 0, 90, 30] + expected = 30 - high-scores(scores).latest() is expected - end + high-scores(scores).latest() is expected end -fun personal-best(): - check "Personal best": - scores = [list: 40, 100, 70] - expected = 100 +check "Personal best": + scores = [list: 40, 100, 70] + expected = 100 - high-scores(scores).personal-best() is expected - end + high-scores(scores).personal-best() is expected end -fun top-three(): - check "Top 3 scores -> Personal top three from a list of scores": - scores = [list: 10, 30, 90, 30, 100, 20, 10, 0, 30, 40, 40, 70, 70] - expected = [list: 100, 90, 70] +check "Top 3 scores -> Personal top three from a list of scores": + scores = [list: 10, 30, 90, 30, 100, 20, 10, 0, 30, 40, 40, 70, 70] + expected = [list: 100, 90, 70] - high-scores(scores).personal-top-three() is expected - end + high-scores(scores).personal-top-three() is expected end -fun top-three-is-sorted(): - check "Top 3 scores -> Personal top highest to lowest": - scores = [list: 20, 10, 30] - expected = [list: 30, 20, 10] +check "Top 3 scores -> Personal top highest to lowest": + scores = [list: 20, 10, 30] + expected = [list: 30, 20, 10] - high-scores(scores).personal-top-three() is expected - end + high-scores(scores).personal-top-three() is expected end -fun top-three-with-tie(): - check "Top 3 scores -> Personal top when there is a tie": - scores = [list: 40, 20, 40, 30] - expected = [list: 40, 40, 30] - - high-scores(scores).personal-top-three() is expected - end +check "Top 3 scores -> Personal top when there is a tie": + scores = [list: 40, 20, 40, 30] + expected = [list: 40, 40, 30] + + high-scores(scores).personal-top-three() is expected end -fun top-three-when-less-than-three(): - check "Top 3 scores -> Personal top when there are less than 3": - scores = [list: 30, 70] - expected = [list: 70, 30] - - high-scores(scores).personal-top-three() is expected - end +check "Top 3 scores -> Personal top when there are less than 3": + scores = [list: 30, 70] + expected = [list: 70, 30] + + high-scores(scores).personal-top-three() is expected end -fun top-three-when-only-one(): - check "Top 3 scores -> Personal top when there is only one": - scores = [list: 40] - expected = [list: 40] - - high-scores(scores).personal-top-three() is expected - end +check "Top 3 scores -> Personal top when there is only one": + scores = [list: 40] + expected = [list: 40] + + high-scores(scores).personal-top-three() is expected end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(list-of-scores, true), - test(latest-score, false), - test(personal-best, false), - test(top-three, false), - test(top-three-is-sorted, false), - test(top-three-with-tie, false), - test(top-three-when-less-than-three, false), - test(top-three-when-only-one, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/high-scores/high-scores.arr b/exercises/practice/high-scores/high-scores.arr index 631cd019..a4031e86 100644 --- a/exercises/practice/high-scores/high-scores.arr +++ b/exercises/practice/high-scores/high-scores.arr @@ -1,7 +1,7 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: high-scores end fun high-scores(scores): raise("Please implement the high-scores function") -end \ No newline at end of file +end diff --git a/exercises/practice/isogram/.meta/example.arr b/exercises/practice/isogram/.meta/example.arr index 0a45b23a..bbcd05ca 100644 --- a/exercises/practice/isogram/.meta/example.arr +++ b/exercises/practice/isogram/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: is-isogram end diff --git a/exercises/practice/isogram/isogram-test.arr b/exercises/practice/isogram/isogram-test.arr index a7b92314..c58ed1e7 100644 --- a/exercises/practice/isogram/isogram-test.arr +++ b/exercises/practice/isogram/isogram-test.arr @@ -1,118 +1,59 @@ -use context essentials2020 +use context starter2024 include file("isogram.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun empty-string(): - check "empty string": - is-isogram("") is true - end +check "empty string": + is-isogram("") is true end -fun only-lowercase(): - check "isogram with only lower case characters": - is-isogram("isogram") is true - end +check "isogram with only lower case characters": + is-isogram("isogram") is true end -fun duplicated-character(): - check "word with one duplicated character": - is-isogram("eleven") is false - end +check "word with one duplicated character": + is-isogram("eleven") is false end -fun duplicate-character-from-end-of-alphabet(): - check "word with one duplicated character from the end of the alphabet": - is-isogram("zzyzx") is false - end +check "word with one duplicated character from the end of the alphabet": + is-isogram("zzyzx") is false end -fun longest-reported-isogram(): - check "longest reported english isogram": - is-isogram("subdermatoglyphic") is true - end +check "longest reported english isogram": + is-isogram("subdermatoglyphic") is true end -fun duplicate-character-mixed-case(): - check "word with duplicated character in mixed case": - is-isogram("Alphabet") is false - end +check "word with duplicated character in mixed case": + is-isogram("Alphabet") is false end -fun duplicated-character-mixed-case-lowercase-first(): - check "word with duplicated character in mixed case, lowercase first": - is-isogram("alphAbet") is false - end +check "word with duplicated character in mixed case, lowercase first": + is-isogram("alphAbet") is false end -fun isogram-with-hyphen(): - check "hypothetical isogrammic word with hyphen": - is-isogram("thumbscrew-japingly") is true - end +check "hypothetical isogrammic word with hyphen": + is-isogram("thumbscrew-japingly") is true end -fun isogram-with-hyphen-and-duplicate-character(): - check "hypothetical word with duplicated character following hyphen": - is-isogram("thumbscrew-jappingly") is false - end +check "hypothetical word with duplicated character following hyphen": + is-isogram("thumbscrew-jappingly") is false end -fun isogram-with-duplicated-hyphen(): - check "isogram with duplicated hyphen": - is-isogram("six-year-old") is true - end +check "isogram with duplicated hyphen": + is-isogram("six-year-old") is true end -fun made-up-name(): - check "made-up name that is an isogram": - is-isogram("Emily Jung Schwartzkopf") is true - end +check "made-up name that is an isogram": + is-isogram("Emily Jung Schwartzkopf") is true end -fun duplicate-character-in-middle(): - check "duplicated character in the middle": - is-isogram("accentor") is false - end +check "duplicated character in the middle": + is-isogram("accentor") is false end -fun duplicate-character-on-ends(): - check "same first and last characters": - is-isogram("angola") is false - end +check "same first and last characters": + is-isogram("angola") is false end -fun duplicate-character-and-hyphens(): - check "word with duplicated character and with two hyphens": - is-isogram("up-to-date") is false - end +check "word with duplicated character and with two hyphens": + is-isogram("up-to-date") is false end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(empty-string, true), - test(only-lowercase, false), - test(duplicated-character, false), - test(duplicate-character-from-end-of-alphabet, false), - test(longest-reported-isogram, false), - test(duplicate-character-mixed-case, false), - test(duplicated-character-mixed-case-lowercase-first, false), - test(isogram-with-hyphen, false), - test(isogram-with-hyphen-and-duplicate-character, false), - test(isogram-with-duplicated-hyphen, false), - test(made-up-name, false), - test(duplicate-character-in-middle, false), - test(duplicate-character-on-ends, false), - test(duplicate-character-and-hyphens, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/isogram/isogram.arr b/exercises/practice/isogram/isogram.arr index 9a2ce9c1..4819ded1 100644 --- a/exercises/practice/isogram/isogram.arr +++ b/exercises/practice/isogram/isogram.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: is-isogram end diff --git a/exercises/practice/leap/.meta/example.arr b/exercises/practice/leap/.meta/example.arr index e32173d1..23965dfa 100644 --- a/exercises/practice/leap/.meta/example.arr +++ b/exercises/practice/leap/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: leap end diff --git a/exercises/practice/leap/leap-test.arr b/exercises/practice/leap/leap-test.arr index a9c8336f..d8b5d1e0 100644 --- a/exercises/practice/leap/leap-test.arr +++ b/exercises/practice/leap/leap-test.arr @@ -1,83 +1,39 @@ -use context essentials2020 +use context starter2024 include file("leap.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun not-divisible-by-4(): - check "year not divisible by 4 in common year": - leap(2015) is false - end +check "year not divisible by 4 in common year": + leap(2015) is false end -fun divisible-by-2-not-4(): - check "year divisible by 2, not divisible by 4 in common year": - leap(1970) is false - end +check "year divisible by 2, not divisible by 4 in common year": + leap(1970) is false end -fun divisible-by-4-not-100(): - check "year divisible by 4, not divisible by 100 in leap year": - leap(1996) is true - end +check "year divisible by 4, not divisible by 100 in leap year": + leap(1996) is true end -fun divisible-by-4-and-5(): - check "year divisible by 4 and 5 is still a leap year": - leap(1960) is true - end +check "year divisible by 4 and 5 is still a leap year": + leap(1960) is true end -fun divisible-by-100-not-400(): - check "year divisible by 100, not divisible by 400 in common year": - leap(2100) is false - end +check "year divisible by 100, not divisible by 400 in common year": + leap(2100) is false end -fun divisible-by-100-not-3(): - check "year divisible by 100 but not by 3 is still not a leap year": - leap(1900) is false - end +check "year divisible by 100 but not by 3 is still not a leap year": + leap(1900) is false end -fun divisible-by-400(): - check "year divisible by 400 is leap year": - leap(2000) is true - end +check "year divisible by 400 is leap year": + leap(2000) is true end -fun divisible-by-400-not-125(): - check "year divisible by 400 but not by 125 is still a leap year": - leap(2400) is true - end +check "year divisible by 400 but not by 125 is still a leap year": + leap(2400) is true end -fun divisible-by-200-not-400(): - check "year divisible by 200, not divisible by 400 in common year": - leap(1800) is false - end +check "year divisible by 200, not divisible by 400 in common year": + leap(1800) is false end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(not-divisible-by-4, true), - test(divisible-by-2-not-4, false), - test(divisible-by-4-not-100, false), - test(divisible-by-4-and-5, false), - test(divisible-by-100-not-400, false), - test(divisible-by-100-not-3, false), - test(divisible-by-400, false), - test(divisible-by-400-not-125, false), - test(divisible-by-200-not-400, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/leap/leap.arr b/exercises/practice/leap/leap.arr index 5ca0df04..8c87f51b 100644 --- a/exercises/practice/leap/leap.arr +++ b/exercises/practice/leap/leap.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: leap end diff --git a/exercises/practice/line-up/.meta/example.arr b/exercises/practice/line-up/.meta/example.arr index efe42f26..cd9eecc4 100644 --- a/exercises/practice/line-up/.meta/example.arr +++ b/exercises/practice/line-up/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: format-message @@ -26,4 +26,4 @@ fun ordinal-suffix-for(n): else: "th" end -end \ No newline at end of file +end diff --git a/exercises/practice/line-up/line-up-test.arr b/exercises/practice/line-up/line-up-test.arr index 66fde336..5b7b9e9e 100644 --- a/exercises/practice/line-up/line-up-test.arr +++ b/exercises/practice/line-up/line-up-test.arr @@ -1,154 +1,79 @@ -use context essentials2020 +use context starter2024 include file("line-up.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - - -fun format-4(): - check "format smallest non-exceptional ordinal numeral 4": - format-message("Gianna", 4) is "Gianna, you are the 4th customer we serve today. Thank you!" - end +check "format smallest non-exceptional ordinal numeral 4": + format-message("Gianna", 4) is "Gianna, you are the 4th customer we serve today. Thank you!" end -fun format-9(): - check "format greatest single digit non-exceptional ordinal numeral 9": - format-message("Maarten", 9) is "Maarten, you are the 9th customer we serve today. Thank you!" - end +check "format greatest single digit non-exceptional ordinal numeral 9": + format-message("Maarten", 9) is "Maarten, you are the 9th customer we serve today. Thank you!" end -fun format-5(): - check "format non-exceptional ordinal numeral 5": - format-message("Petronila", 5) is "Petronila, you are the 5th customer we serve today. Thank you!" - end +check "format non-exceptional ordinal numeral 5": + format-message("Petronila", 5) is "Petronila, you are the 5th customer we serve today. Thank you!" end -fun format-6(): - check "format non-exceptional ordinal numeral 6": - format-message("Attakullakulla", 6) is "Attakullakulla, you are the 6th customer we serve today. Thank you!" - end +check "format non-exceptional ordinal numeral 6": + format-message("Attakullakulla", 6) is "Attakullakulla, you are the 6th customer we serve today. Thank you!" end -fun format-7(): - check "format non-exceptional ordinal numeral 7": - format-message("Kate", 7) is "Kate, you are the 7th customer we serve today. Thank you!" - end +check "format non-exceptional ordinal numeral 7": + format-message("Kate", 7) is "Kate, you are the 7th customer we serve today. Thank you!" end -fun format-8(): - check "format non-exceptional ordinal numeral 8": - format-message("Maximiliano", 8) is "Maximiliano, you are the 8th customer we serve today. Thank you!" - end +check "format non-exceptional ordinal numeral 8": + format-message("Maximiliano", 8) is "Maximiliano, you are the 8th customer we serve today. Thank you!" end -fun format-1(): - check "format exceptional ordinal numeral 1": - format-message("Mary", 1) is "Mary, you are the 1st customer we serve today. Thank you!" - end +check "format exceptional ordinal numeral 1": + format-message("Mary", 1) is "Mary, you are the 1st customer we serve today. Thank you!" end -fun format-2(): - check "format exceptional ordinal numeral 2": - format-message("Haruto", 2) is "Haruto, you are the 2nd customer we serve today. Thank you!" - end +check "format exceptional ordinal numeral 2": + format-message("Haruto", 2) is "Haruto, you are the 2nd customer we serve today. Thank you!" end -fun format-3(): - check "format exceptional ordinal numeral 3": - format-message("Henriette", 3) is "Henriette, you are the 3rd customer we serve today. Thank you!" - end +check "format exceptional ordinal numeral 3": + format-message("Henriette", 3) is "Henriette, you are the 3rd customer we serve today. Thank you!" end -fun format-10(): - check "format smallest two digit non-exceptional ordinal numeral 10": - format-message("Alvarez", 10) is "Alvarez, you are the 10th customer we serve today. Thank you!" - end +check "format smallest two digit non-exceptional ordinal numeral 10": + format-message("Alvarez", 10) is "Alvarez, you are the 10th customer we serve today. Thank you!" end -fun format-11(): - check "format non-exceptional ordinal numeral 11": - format-message("Jacqueline", 11) is "Jacqueline, you are the 11th customer we serve today. Thank you!" - end +check "format non-exceptional ordinal numeral 11": + format-message("Jacqueline", 11) is "Jacqueline, you are the 11th customer we serve today. Thank you!" end -fun format-12(): - check "format non-exceptional ordinal numeral 12": - format-message("Juan", 12) is "Juan, you are the 12th customer we serve today. Thank you!" - end +check "format non-exceptional ordinal numeral 12": + format-message("Juan", 12) is "Juan, you are the 12th customer we serve today. Thank you!" end -fun format-13(): - check "format non-exceptional ordinal numeral 13": - format-message("Patricia", 13) is "Patricia, you are the 13th customer we serve today. Thank you!" - end +check "format non-exceptional ordinal numeral 13": + format-message("Patricia", 13) is "Patricia, you are the 13th customer we serve today. Thank you!" end -fun format-21(): - check "format exceptional ordinal numeral 21": - format-message("Washi", 21) is "Washi, you are the 21st customer we serve today. Thank you!" - end +check "format exceptional ordinal numeral 21": + format-message("Washi", 21) is "Washi, you are the 21st customer we serve today. Thank you!" end -fun format-62(): - check "format exceptional ordinal numeral 62": - format-message("Nayra", 62) is "Nayra, you are the 62nd customer we serve today. Thank you!" - end +check "format exceptional ordinal numeral 62": + format-message("Nayra", 62) is "Nayra, you are the 62nd customer we serve today. Thank you!" end -fun format-100(): - check "format exceptional ordinal numeral 100": - format-message("John", 100) is "John, you are the 100th customer we serve today. Thank you!" - end +check "format exceptional ordinal numeral 100": + format-message("John", 100) is "John, you are the 100th customer we serve today. Thank you!" end -fun format-101(): - check "format exceptional ordinal numeral 101": - format-message("Zeinab", 101) is "Zeinab, you are the 101st customer we serve today. Thank you!" - end +check "format exceptional ordinal numeral 101": + format-message("Zeinab", 101) is "Zeinab, you are the 101st customer we serve today. Thank you!" end -fun format-112(): - check "format non-exceptional ordinal numeral 112": - format-message("Knud", 112) is "Knud, you are the 112th customer we serve today. Thank you!" - end +check "format non-exceptional ordinal numeral 112": + format-message("Knud", 112) is "Knud, you are the 112th customer we serve today. Thank you!" end -fun format-123(): - check "format exceptional ordinal numeral 123": - format-message("Yma", 123) is "Yma, you are the 123rd customer we serve today. Thank you!" - end +check "format exceptional ordinal numeral 123": + format-message("Yma", 123) is "Yma, you are the 123rd customer we serve today. Thank you!" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(format-4, true), - test(format-9, false), - test(format-5, false), - test(format-6, false), - test(format-7, false), - test(format-8, false), - test(format-1, false), - test(format-2, false), - test(format-3, false), - test(format-10, false), - test(format-11, false), - test(format-12, false), - test(format-13, false), - test(format-21, false), - test(format-62, false), - test(format-100, false), - test(format-101, false), - test(format-112, false), - test(format-123, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/line-up/line-up.arr b/exercises/practice/line-up/line-up.arr index 390655c4..80c0dc91 100644 --- a/exercises/practice/line-up/line-up.arr +++ b/exercises/practice/line-up/line-up.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: format-message diff --git a/exercises/practice/list-ops/.meta/example.arr b/exercises/practice/list-ops/.meta/example.arr index f74bb588..e2633ca3 100644 --- a/exercises/practice/list-ops/.meta/example.arr +++ b/exercises/practice/list-ops/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: my-append, diff --git a/exercises/practice/list-ops/list-ops-test.arr b/exercises/practice/list-ops/list-ops-test.arr index d0938df3..c82f1149 100644 --- a/exercises/practice/list-ops/list-ops-test.arr +++ b/exercises/practice/list-ops/list-ops-test.arr @@ -1,276 +1,193 @@ -use context essentials2020 +use context starter2024 include file("list-ops.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun append-empty-to-empty(): - check "append entries to a list and return the new list -> empty lists": - list1 = [list: ] - list2 = [list: ] - expected = [list: ] - - my-append(list1, list2) is expected - end +check "append entries to a list and return the new list -> empty lists": + list1 = [list: ] + list2 = [list: ] + expected = [list: ] + + my-append(list1, list2) is expected end -fun append-list-to-empty(): - check "append entries to a list and return the new list -> list to empty list": - list1 = [list: ] - list2 = [list: 1, 2, 3, 4] - expected = [list: 1, 2, 3, 4] +check "append entries to a list and return the new list -> list to empty list": + list1 = [list: ] + list2 = [list: 1, 2, 3, 4] + expected = [list: 1, 2, 3, 4] - my-append(list1, list2) is expected - end + my-append(list1, list2) is expected end -fun append-empty-to-list(): - check "append entries to a list and return the new list -> empty list to list": - list1 = [list: 1, 2, 3, 4] - list2 = [list: ] - expected = [list: 1, 2, 3, 4] +check "append entries to a list and return the new list -> empty list to list": + list1 = [list: 1, 2, 3, 4] + list2 = [list: ] + expected = [list: 1, 2, 3, 4] - my-append(list1, list2) is expected - end + my-append(list1, list2) is expected end -fun append-list-to-list(): - check "append entries to a list and return the new list -> non-empty lists": - list1 = [list: 1, 2] - list2 = [list: 3, 4, 5] - expected = [list: 1, 2, 3, 4, 5] +check "append entries to a list and return the new list -> non-empty lists": + list1 = [list: 1, 2] + list2 = [list: 3, 4, 5] + expected = [list: 1, 2, 3, 4, 5] - my-append(list1, list2) is expected - end + my-append(list1, list2) is expected end -fun concatenate-empties(): - check "concatenate a list of lists -> empty list": - input = [list: ] - expected = [list: ] +check "concatenate a list of lists -> empty list": + input = [list: ] + expected = [list: ] - my-concatenate(input) is expected - end + my-concatenate(input) is expected end -fun concatenate-lists(): - check "concatenate a list of lists -> list of lists": - input = [list: [list: 1, 2], [list: 3], [list: ], [list: 4, 5, 6]] - expected = [list: 1, 2, 3, 4, 5, 6] +check "concatenate a list of lists -> list of lists": + input = [list: [list: 1, 2], [list: 3], [list: ], [list: 4, 5, 6]] + expected = [list: 1, 2, 3, 4, 5, 6] - my-concatenate(input) is expected - end + my-concatenate(input) is expected end -fun concatenate-nested-lists(): - check "concatenate a list of lists -> list of nested lists": - input = [list: - [list: [list: 1], [list: 2]], - [list: [list: 3]], - [list: [list: ]], - [list: [list: 4, 5, 6]]] - expected = [list: - [list: 1], - [list: 2], - [list: 3], - [list:], - [list: 4, 5, 6]] - - my-concatenate(input) is expected - end +check "concatenate a list of lists -> list of nested lists": + input = [list: + [list: [list: 1], [list: 2]], + [list: [list: 3]], + [list: [list: ]], + [list: [list: 4, 5, 6]]] + expected = [list: + [list: 1], + [list: 2], + [list: 3], + [list:], + [list: 4, 5, 6]] + + my-concatenate(input) is expected end -fun filter-empty(): - check "filter list returning only values that satisfy the filter function -> empty list": - input = [list: ] - f = lam(x): num-modulo(x, 2) == 1 end - expected = [list: ] +check "filter list returning only values that satisfy the filter function -> empty list": + input = [list: ] + f = lam(x): num-modulo(x, 2) == 1 end + expected = [list: ] - my-filter(input, f) is expected - end + my-filter(input, f) is expected end -fun filter-list(): - check "filter list returning only values that satisfy the filter function -> non-empty list": - input = [list: 1, 2, 3, 5] - f = lam(x): num-modulo(x, 2) == 1 end - expected = [list: 1, 3, 5] +check "filter list returning only values that satisfy the filter function -> non-empty list": + input = [list: 1, 2, 3, 5] + f = lam(x): num-modulo(x, 2) == 1 end + expected = [list: 1, 3, 5] - my-filter(input, f) is expected - end + my-filter(input, f) is expected end -fun length-empty(): - check "returns the length of a list -> empty list": - input = [list: ] - expected = 0 +check "returns the length of a list -> empty list": + input = [list: ] + expected = 0 - my-length(input) is expected - end + my-length(input) is expected end -fun length-list(): - check "returns the length of a list -> non-empty list": - input = [list: 1, 2, 3, 4] - expected = 4 - my-length(input) is expected - end +check "returns the length of a list -> non-empty list": + input = [list: 1, 2, 3, 4] + expected = 4 + my-length(input) is expected end -fun map-empty(): - check "return a list of elements whose values equal the list value transformed by the mapping function -> empty list": - input = [list: ] - f = lam(x): x + 1 end - expected = [list: ] +check "return a list of elements whose values equal the list value transformed by the mapping function -> empty list": + input = [list: ] + f = lam(x): x + 1 end + expected = [list: ] - my-map(input, f) is expected - end + my-map(input, f) is expected end -fun map-list(): - check "return a list of elements whose values equal the list value transformed by the mapping function -> non-empty list": - input = [list: 1, 3, 5, 7] - f = lam(x): x + 1 end - expected = [list: 2, 4, 6, 8] +check "return a list of elements whose values equal the list value transformed by the mapping function -> non-empty list": + input = [list: 1, 3, 5, 7] + f = lam(x): x + 1 end + expected = [list: 2, 4, 6, 8] - my-map(input, f) is expected - end + my-map(input, f) is expected end -fun foldl-empty(): - check "folds (reduces) the given list from the left with a function -> empty list": - input = [list: ] - f = lam(elt, acc): elt * acc end - initial = 2 - expected = 2 +check "folds (reduces) the given list from the left with a function -> empty list": + input = [list: ] + f = lam(elt, acc): elt * acc end + initial = 2 + expected = 2 - my-foldl(input, f, initial) is expected - end + my-foldl(input, f, initial) is expected end -fun foldl-direction-independent(): - check "folds (reduces) the given list from the left with a function -> direction independent function applied to non-empty list": - input = [list: 1, 2, 3, 4] - f = lam(elt, acc): elt + acc end - initial = 5 - expected = 15 +check "folds (reduces) the given list from the left with a function -> direction independent function applied to non-empty list": + input = [list: 1, 2, 3, 4] + f = lam(elt, acc): elt + acc end + initial = 5 + expected = 15 - my-foldl(input, f, initial) is expected - end + my-foldl(input, f, initial) is expected end -fun foldl-direction-dependent(): - check "folds (reduces) the given list from the left with a function -> direction dependent function applied to non-empty list": - input = [list: 1, 2, 3, 4] - f = lam(elt, acc): acc / elt end - initial = 24 - expected = 64 +check "folds (reduces) the given list from the left with a function -> direction dependent function applied to non-empty list": + input = [list: 1, 2, 3, 4] + f = lam(elt, acc): acc / elt end + initial = 24 + expected = 64 - my-foldl(input, f, initial) is expected - end + my-foldl(input, f, initial) is expected end -fun foldr-empty(): - check "folds (reduces) the given list from the right with a function -> empty list": - input = [list: ] - f = lam(elt, acc): elt * acc end - initial = 2 - expected = 2 +check "folds (reduces) the given list from the right with a function -> empty list": + input = [list: ] + f = lam(elt, acc): elt * acc end + initial = 2 + expected = 2 - my-foldr(input, f, initial) is expected - end + my-foldr(input, f, initial) is expected end -fun foldr-direction-independent(): - check "folds (reduces) the given list from the right with a function -> direction independent function applied to non-empty list": - input = [list: 1, 2, 3, 4] - f = lam(elt, acc): elt + acc end - initial = 5 - expected = 15 +check "folds (reduces) the given list from the right with a function -> direction independent function applied to non-empty list": + input = [list: 1, 2, 3, 4] + f = lam(elt, acc): elt + acc end + initial = 5 + expected = 15 - my-foldr(input, f, initial) is expected - end + my-foldr(input, f, initial) is expected end -fun foldr-direction-dependent(): - check "folds (reduces) the given list from the right with a function -> direction dependent function applied to non-empty list": - input = [list: 1, 2, 3, 4] - f = lam(elt, acc): elt / acc end - initial = 24 - expected = 9 +check "folds (reduces) the given list from the right with a function -> direction dependent function applied to non-empty list": + input = [list: 1, 2, 3, 4] + f = lam(elt, acc): elt / acc end + initial = 24 + expected = 9 - my-foldr(input, f, initial) is expected - end + my-foldr(input, f, initial) is expected end -fun revverse-empty(): - check "reverse the elements of the list -> empty list": - input = [list: ] - expected = [list: ] - - my-reverse(input) is expected - end +check "reverse the elements of the list -> empty list": + input = [list: ] + expected = [list: ] + + my-reverse(input) is expected end -fun reverse-list(): - check "reverse the elements of the list -> non-empty list": - input = [list: 1, 3, 5, 7] - expected = [list: 7, 5, 3, 1] - - my-reverse(input) is expected - end +check "reverse the elements of the list -> non-empty list": + input = [list: 1, 3, 5, 7] + expected = [list: 7, 5, 3, 1] + + my-reverse(input) is expected end -fun reverse-nested(): - check "reverse the elements of the list -> list of lists is not flattened": - input = [list: - [list: 1, 2], - [list: 3], - [list: ], - [list: 4, 5, 6]] - expected = [list: - [list: 4, 5, 6], - [list: ], - [list: 3], - [list: 1, 2]] - - my-reverse(input) is expected - end -end +check "reverse the elements of the list -> list of lists is not flattened": + input = [list: + [list: 1, 2], + [list: 3], + [list: ], + [list: 4, 5, 6]] + expected = [list: + [list: 4, 5, 6], + [list: ], + [list: 3], + [list: 1, 2]] -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(append-empty-to-empty, true), - test(append-list-to-empty, false), - test(append-empty-to-list, false), - test(append-list-to-list, false), - test(concatenate-empties, false), - test(concatenate-lists, false), - test(concatenate-nested-lists, false), - test(filter-empty, false), - test(filter-list, false), - test(length-empty, false), - test(length-list, false), - test(map-empty, false), - test(map-list, false), - test(foldl-empty, false), - test(foldl-direction-independent, false), - test(foldl-direction-dependent, false), - test(foldr-empty, false), - test(foldr-direction-independent, false), - test(foldr-direction-dependent, false), - test(revverse-empty, false), - test(reverse-list, false), - test(reverse-nested, false) -].each(lam(t): when t.active: t.run() end end) + my-reverse(input) is expected +end diff --git a/exercises/practice/list-ops/list-ops.arr b/exercises/practice/list-ops/list-ops.arr index 13a9f8b5..b330748a 100644 --- a/exercises/practice/list-ops/list-ops.arr +++ b/exercises/practice/list-ops/list-ops.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: my-append, diff --git a/exercises/practice/luhn/.meta/example.arr b/exercises/practice/luhn/.meta/example.arr index c017b9b3..a5552d84 100644 --- a/exercises/practice/luhn/.meta/example.arr +++ b/exercises/practice/luhn/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: is-valid end @@ -36,4 +36,4 @@ fun is-valid(card-number): | otherwise: false end -end \ No newline at end of file +end diff --git a/exercises/practice/luhn/luhn-test.arr b/exercises/practice/luhn/luhn-test.arr index ed526429..f6d7a10a 100644 --- a/exercises/practice/luhn/luhn-test.arr +++ b/exercises/practice/luhn/luhn-test.arr @@ -1,174 +1,91 @@ -use context essentials2020 +use context starter2024 include file("luhn.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun invalid-single-digit(): - check "single digit strings can not be valid": - is-valid("1") is false - end +check "single digit strings can not be valid": + is-valid("1") is false end -fun invalid-single-zero(): - check "a single zero is invalid": - is-valid("0") is false - end +check "a single zero is invalid": + is-valid("0") is false end -fun valid-even-if-reversed(): - check "a simple valid SIN that remains valid if reversed": - is-valid("059") is true - end +check "a simple valid SIN that remains valid if reversed": + is-valid("059") is true end -fun valid-but-not-reversed(): - check "a simple valid SIN that becomes invalid if reversed": - is-valid("59") is true - end +check "a simple valid SIN that becomes invalid if reversed": + is-valid("59") is true end -fun valid-canadian(): - check "a valid Canadian SIN": - is-valid("055 444 285") is true - end +check "a valid Canadian SIN": + is-valid("055 444 285") is true end -fun invalid-canadian(): - check "invalid Canadian SIN": - is-valid("055 444 286") is false - end +check "invalid Canadian SIN": + is-valid("055 444 286") is false end -fun invalid-credit-card(): - check "invalid credit card": - is-valid("8273 1232 7352 0569") is false - end +check "invalid credit card": + is-valid("8273 1232 7352 0569") is false end -fun invalid-long-number-even-remainder(): - check "invalid long number with an even remainder": - is-valid("1 2345 6789 1234 5678 9012") is false - end +check "invalid long number with an even remainder": + is-valid("1 2345 6789 1234 5678 9012") is false end -fun invalid-long-number-remainder-div-by-five(): - check "invalid long number with a remainder divisible by 5": - is-valid("1 2345 6789 1234 5678 9013") is false - end +check "invalid long number with a remainder divisible by 5": + is-valid("1 2345 6789 1234 5678 9013") is false end -fun valid-number-with-even-number-of-digits(): - check "valid number with an even number of digits": - is-valid("095 245 88") is true - end +check "valid number with an even number of digits": + is-valid("095 245 88") is true end -fun valid-number-with-odd-nummber-of-spaces(): - check "valid number with an odd number of spaces": - is-valid("234 567 891 234") is true - end +check "valid number with an odd number of spaces": + is-valid("234 567 891 234") is true end -fun invalid-number-after-non-digit-added(): - check "valid strings with a non-digit added at the end become invalid": - is-valid("059a") is false - end +check "valid strings with a non-digit added at the end become invalid": + is-valid("059a") is false end -fun invalid-number-after-punctuation-added(): - check "valid strings with punctuation included become invalid": - is-valid("055-444-285") is false - end +check "valid strings with punctuation included become invalid": + is-valid("055-444-285") is false end -fun invalid-number-after-symbols-added(): - check "valid strings with symbols included become invalid": - is-valid("055# 444$ 285") is false - end +check "valid strings with symbols included become invalid": + is-valid("055# 444$ 285") is false end -fun invalid-space-and-zero(): - check "single zero with space is invalid": - is-valid(" 0") is false - end +check "single zero with space is invalid": + is-valid(" 0") is false end -fun valid-multiple-zeroes(): - check "more than a single zero is valid": - is-valid("0000 0") is true - end +check "more than a single zero is valid": + is-valid("0000 0") is true end -fun valid-input-digit-nine(): - check "input digit 9 is correctly converted to output digit 9": - is-valid("091") is true - end +check "input digit 9 is correctly converted to output digit 9": + is-valid("091") is true end -fun valid-very-long-input(): - check "very long input is valid": - is-valid("9999999999 9999999999 9999999999 9999999999") is true - end +check "very long input is valid": + is-valid("9999999999 9999999999 9999999999 9999999999") is true end -fun valid-with-odd-number-of-digits-and-non-zero-first-digit(): - check "valid luhn with an odd number of digits and non zero first digit": - is-valid("109") is true - end +check "valid luhn with an odd number of digits and non zero first digit": + is-valid("109") is true end -fun invalid-number-with-ascii-non-double(): - check "using ascii value for non-doubled non-digit isn't allowed": - is-valid("055b 444 285") is false - end +check "using ascii value for non-doubled non-digit isn't allowed": + is-valid("055b 444 285") is false end -fun invalid-number-with-ascii-doubled(): - check "using ascii value for doubled non-digit isn't allowed": - is-valid(":9") is false - end +check "using ascii value for doubled non-digit isn't allowed": + is-valid(":9") is false end -fun invalid-number-with-non-space-letter(): - check "non-numeric, non-space char in the middle with a sum that's divisible by 10 isn't allowed": - is-valid("59%59") is false - end +check "non-numeric, non-space char in the middle with a sum that's divisible by 10 isn't allowed": + is-valid("59%59") is false end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(invalid-single-digit, true), - test(invalid-single-zero, false), - test(valid-even-if-reversed, false), - test(valid-but-not-reversed, false), - test(valid-canadian, false), - test(invalid-canadian, false), - test(invalid-credit-card, false), - test(invalid-long-number-even-remainder, false), - test(invalid-long-number-remainder-div-by-five, false), - test(valid-number-with-even-number-of-digits, false), - test(valid-number-with-odd-nummber-of-spaces, false), - test(invalid-number-after-non-digit-added, false), - test(invalid-number-after-punctuation-added, false), - test(invalid-number-after-symbols-added, false), - test(invalid-space-and-zero, false), - test(valid-multiple-zeroes, false), - test(valid-input-digit-nine, false), - test(valid-very-long-input, false), - test(valid-with-odd-number-of-digits-and-non-zero-first-digit, false), - test(invalid-number-with-ascii-non-double, false), - test(invalid-number-with-ascii-doubled, false), - test(invalid-number-with-non-space-letter, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/luhn/luhn.arr b/exercises/practice/luhn/luhn.arr index ec1d9634..8ac974d0 100644 --- a/exercises/practice/luhn/luhn.arr +++ b/exercises/practice/luhn/luhn.arr @@ -1,7 +1,7 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: is-valid end fun is-valid(card-number): raise("Please implement the is-valid function") -end \ No newline at end of file +end diff --git a/exercises/practice/matrix/.meta/example.arr b/exercises/practice/matrix/.meta/example.arr index 00f12b08..d17e58ba 100644 --- a/exercises/practice/matrix/.meta/example.arr +++ b/exercises/practice/matrix/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: matrix end @@ -31,4 +31,4 @@ fun matrix(input :: String): end, values: process-input() } -end \ No newline at end of file +end diff --git a/exercises/practice/matrix/matrix-test.arr b/exercises/practice/matrix/matrix-test.arr index 0b22560b..fea88391 100644 --- a/exercises/practice/matrix/matrix-test.arr +++ b/exercises/practice/matrix/matrix-test.arr @@ -1,85 +1,43 @@ -use context essentials2020 +use context starter2024 include file("matrix.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun extract-row-from-one-row-matrix(): - check "extract row from one number matrix": - m = matrix("1") - m.row(1) is [list: 1] - end +check "extract row from one number matrix": + m = matrix("1") + m.row(1) is [list: 1] end -fun extract-row-from-two-row-matrix(): - check "can extract row": - m = matrix("1 2\n3 4") - m.row(2) is [list: 3, 4] - end +check "can extract row": + m = matrix("1 2\n3 4") + m.row(2) is [list: 3, 4] end -fun extract-row-from-variable-number-width-matrix(): - check "extract row where numbers have different widths": - m = matrix("1 2\n10 20") - m.row(2) is [list: 10, 20] - end +check "extract row where numbers have different widths": + m = matrix("1 2\n10 20") + m.row(2) is [list: 10, 20] end -fun extract-row-from-non-square-matrix(): - check "can extract row from non-square matrix with no corresponding column": - m = matrix("1 2 3\n4 5 6\n7 8 9\n8 7 6") - m.row(4) is [list: 8, 7, 6] - end +check "can extract row from non-square matrix with no corresponding column": + m = matrix("1 2 3\n4 5 6\n7 8 9\n8 7 6") + m.row(4) is [list: 8, 7, 6] end - -fun extract-column-from-one-column-matrix(): - check "extract column from one number matrix": - m = matrix("1") - m.column(1) is [list: 1] - end +check "extract column from one number matrix": + m = matrix("1") + m.column(1) is [list: 1] end -fun extract-column-from-three-column-matrix(): - check "can extract column": - m = matrix("1 2 3\n4 5 6\n7 8 9") - m.column(3) is [list: 3, 6, 9] - end +check "can extract column": + m = matrix("1 2 3\n4 5 6\n7 8 9") + m.column(3) is [list: 3, 6, 9] end -fun extract-column-from-non-square-matrix(): - check "can extract column from non-square matrix with no corresponding row": - m = matrix("1 2 3 4\n5 6 7 8\n9 8 7 6") - m.column(4) is [list: 4, 8, 6] - end +check "can extract column from non-square matrix with no corresponding row": + m = matrix("1 2 3 4\n5 6 7 8\n9 8 7 6") + m.column(4) is [list: 4, 8, 6] end -fun extract-column-from-variable-number-width-matrix(): - check "extract column where numbers have different widths": - m = matrix("89 1903 3\n18 3 1\n9 4 800") - m.column(2) is [list: 1903, 3, 4] - end +check "extract column where numbers have different widths": + m = matrix("89 1903 3\n18 3 1\n9 4 800") + m.column(2) is [list: 1903, 3, 4] end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(extract-row-from-one-row-matrix, true), - test(extract-row-from-two-row-matrix, false), - test(extract-row-from-variable-number-width-matrix, false), - test(extract-row-from-non-square-matrix, false), - test(extract-column-from-one-column-matrix, false), - test(extract-column-from-three-column-matrix, false), - test(extract-column-from-non-square-matrix, false), - test(extract-column-from-variable-number-width-matrix, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/matrix/matrix.arr b/exercises/practice/matrix/matrix.arr index 1d54f558..c5e4395c 100644 --- a/exercises/practice/matrix/matrix.arr +++ b/exercises/practice/matrix/matrix.arr @@ -1,7 +1,7 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: matrix end fun matrix(input): raise("Please implement the matrix function") -end \ No newline at end of file +end diff --git a/exercises/practice/nucleotide-count/.meta/example.arr b/exercises/practice/nucleotide-count/.meta/example.arr index dfc2b79e..f9896421 100644 --- a/exercises/practice/nucleotide-count/.meta/example.arr +++ b/exercises/practice/nucleotide-count/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: nucleotide-counts end @@ -14,4 +14,4 @@ fun nucleotide-counts(strand): acc.set(elt, count + 1) end end, [string-dict: "A", 0, "C", 0, "G", 0, "T", 0]) -end \ No newline at end of file +end diff --git a/exercises/practice/nucleotide-count/nucleotide-count-test.arr b/exercises/practice/nucleotide-count/nucleotide-count-test.arr index a835af4a..e81ad5bc 100644 --- a/exercises/practice/nucleotide-count/nucleotide-count-test.arr +++ b/exercises/practice/nucleotide-count/nucleotide-count-test.arr @@ -1,71 +1,39 @@ -use context essentials2020 +use context starter2024 include file("nucleotide-count.arr") include string-dict -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +check "empty strand": + input = "" + expected = [string-dict: "A", 0, "C", 0, "G", 0, "T", 0] -fun empty-strand(): - check "empty strand": - input = "" - expected = [string-dict: "A", 0, "C", 0, "G", 0, "T", 0] - - nucleotide-counts(input) is expected - end + nucleotide-counts(input) is expected end -fun single-nucleotide-strand(): - check "can count one nucleotide in single-character input": - input = "G" - expected = [string-dict: "A", 0, "C", 0, "G", 1, "T", 0] +check "can count one nucleotide in single-character input": + input = "G" + expected = [string-dict: "A", 0, "C", 0, "G", 1, "T", 0] - nucleotide-counts(input) is expected - end + nucleotide-counts(input) is expected end -fun repeated-nucleotide-strand(): - check "strand with repeated nucleotide": - input = "GGGGGGG" - expected = [string-dict: "A", 0, "C", 0, "G", 7, "T", 0] +check "strand with repeated nucleotide": + input = "GGGGGGG" + expected = [string-dict: "A", 0, "C", 0, "G", 7, "T", 0] - nucleotide-counts(input) is expected - end + nucleotide-counts(input) is expected end -fun multiple-nucleotide-strand(): - check "strand with multiple nucleotides": - input = "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC" - expected = [string-dict: "A", 20, "C", 12, "G", 17, "T", 21] +check "strand with multiple nucleotides": + input = "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC" + expected = [string-dict: "A", 20, "C", 12, "G", 17, "T", 21] - nucleotide-counts(input) is expected - end + nucleotide-counts(input) is expected end -fun invalid-nucleotide-strand(): - check "strand with invalid nucleotides": - input = "AGXXACT" +check "strand with invalid nucleotides": + input = "AGXXACT" - nucleotide-counts(input) raises "Invalid nucleotide in strand" - end + nucleotide-counts(input) raises "Invalid nucleotide in strand" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(empty-strand, true), - test(single-nucleotide-strand, false), - test(repeated-nucleotide-strand, false), - test(multiple-nucleotide-strand, false), - test(invalid-nucleotide-strand, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/nucleotide-count/nucleotide-count.arr b/exercises/practice/nucleotide-count/nucleotide-count.arr index b53dad82..d8ff371f 100644 --- a/exercises/practice/nucleotide-count/nucleotide-count.arr +++ b/exercises/practice/nucleotide-count/nucleotide-count.arr @@ -1,7 +1,7 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: nucleotide-counts end fun nucleotide-counts(strand): raise("Please implement the nucleotide-counts function") -end \ No newline at end of file +end diff --git a/exercises/practice/pangram/.meta/example.arr b/exercises/practice/pangram/.meta/example.arr index 316e6ec1..0c19263c 100644 --- a/exercises/practice/pangram/.meta/example.arr +++ b/exercises/practice/pangram/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: is-pangram end @@ -12,4 +12,4 @@ fun is-pangram(phrase): L.all( lam(char): letters.member(char) end, LOWERCASE) -end \ No newline at end of file +end diff --git a/exercises/practice/pangram/pangram-test.arr b/exercises/practice/pangram/pangram-test.arr index 89331590..60fdae66 100644 --- a/exercises/practice/pangram/pangram-test.arr +++ b/exercises/practice/pangram/pangram-test.arr @@ -1,100 +1,53 @@ -use context essentials2020 +use context starter2024 include file("pangram.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun empty-sentence(): - check "empty sentence": - input = "" - is-pangram(input) is false - end +check "empty sentence": + input = "" + is-pangram(input) is false end -fun perfect-lower-case(): - check "perfect lower case": - input = "abcdefghijklmnopqrstuvwxyz" - is-pangram(input) is true - end +check "perfect lower case": + input = "abcdefghijklmnopqrstuvwxyz" + is-pangram(input) is true end -fun only-lower-case(): - check "only lower case": - input = "the quick brown fox jumps over the lazy dog" - is-pangram(input) is true - end +check "only lower case": + input = "the quick brown fox jumps over the lazy dog" + is-pangram(input) is true end -fun missing-letter-x(): - check "missing the letter 'x'": - input = "a quick movement of the enemy will jeopardize five gunboats" - is-pangram(input) is false - end +check "missing the letter 'x'": + input = "a quick movement of the enemy will jeopardize five gunboats" + is-pangram(input) is false end -fun missing-letter-h(): - check "missing the letter 'h'": - input = "five boxing wizards jump quickly at it" - is-pangram(input) is false - end +check "missing the letter 'h'": + input = "five boxing wizards jump quickly at it" + is-pangram(input) is false end -fun with-underscores(): - check "with underscores": - input = "the_quick_brown_fox_jumps_over_the_lazy_dog" - is-pangram(input) is true - end +check "with underscores": + input = "the_quick_brown_fox_jumps_over_the_lazy_dog" + is-pangram(input) is true end -fun with-numbers(): - check "with numbers": - input = "the 1 quick brown fox jumps over the 2 lazy dogs" - is-pangram(input) is true - end +check "with numbers": + input = "the 1 quick brown fox jumps over the 2 lazy dogs" + is-pangram(input) is true end -fun missing-letters-replaced-by-numbers(): - check "missing letters replaced by numbers": - input = "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog" - is-pangram(input) is false - end +check "missing letters replaced by numbers": + input = "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog" + is-pangram(input) is false end -fun mixed-case-and-punctuation(): - check "mixed case and punctuation": - input = "\"Five quacking Zephyrs jolt my wax bed.\"" - is-pangram(input) is true - end +check "mixed case and punctuation": + input = "\"Five quacking Zephyrs jolt my wax bed.\"" + is-pangram(input) is true end -fun length-of-alphabet-but-not-pangram(): - check "a-m and A-M are 26 different characters but not a pangram": - input = "abcdefghijklm ABCDEFGHIJKLM" - is-pangram(input) is false - end +check "a-m and A-M are 26 different characters but not a pangram": + input = "abcdefghijklm ABCDEFGHIJKLM" + is-pangram(input) is false end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(empty-sentence, true), - test(perfect-lower-case, false), - test(only-lower-case, false), - test(missing-letter-x, false), - test(missing-letter-h, false), - test(with-underscores, false), - test(with-numbers, false), - test(missing-letters-replaced-by-numbers, false), - test(mixed-case-and-punctuation, false), - test(length-of-alphabet-but-not-pangram, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/pangram/pangram.arr b/exercises/practice/pangram/pangram.arr index d7c2652e..9c59fcbf 100644 --- a/exercises/practice/pangram/pangram.arr +++ b/exercises/practice/pangram/pangram.arr @@ -1,7 +1,7 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: is-pangram end fun is-pangram(phrase): raise("Please implement the is-pangram function") -end \ No newline at end of file +end diff --git a/exercises/practice/perfect-numbers/.meta/example.arr b/exercises/practice/perfect-numbers/.meta/example.arr index f69151db..c1ad2972 100644 --- a/exercises/practice/perfect-numbers/.meta/example.arr +++ b/exercises/practice/perfect-numbers/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: classify end diff --git a/exercises/practice/perfect-numbers/perfect-numbers-test.arr b/exercises/practice/perfect-numbers/perfect-numbers-test.arr index 80c9978c..30743fa3 100644 --- a/exercises/practice/perfect-numbers/perfect-numbers-test.arr +++ b/exercises/practice/perfect-numbers/perfect-numbers-test.arr @@ -1,118 +1,59 @@ -use context essentials2020 +use context starter2024 include file("perfect-numbers.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun smallest-perfect(): - check "Perfect numbers -> Smallest perfect number is classified correctly": - classify(6) is "perfect" - end +check "Perfect numbers -> Smallest perfect number is classified correctly": + classify(6) is "perfect" end -fun medium-perfect-number(): - check "Perfect numbers -> Medium perfect number is classified correctly": - classify(28) is "perfect" - end +check "Perfect numbers -> Medium perfect number is classified correctly": + classify(28) is "perfect" end -fun large-perfect-number(): - check "Perfect numbers -> Large perfect number is classified correctly": - classify(33550336) is "perfect" - end +check "Perfect numbers -> Large perfect number is classified correctly": + classify(33550336) is "perfect" end -fun smallest-abundant(): - check "Abundant numbers -> Smallest abundant number is classified correctly": - classify(12) is "abundant" - end +check "Abundant numbers -> Smallest abundant number is classified correctly": + classify(12) is "abundant" end -fun medium-abundant(): - check "Abundant numbers -> Medium abundant number is classified correctly": - classify(30) is "abundant" - end +check "Abundant numbers -> Medium abundant number is classified correctly": + classify(30) is "abundant" end -fun large-abundant(): - check "Abundant numbers -> Large abundant number is classified correctly": - classify(33550335) is "abundant" - end +check "Abundant numbers -> Large abundant number is classified correctly": + classify(33550335) is "abundant" end -fun perfect-square-abundant(): - check "Abundant numbers -> Perfect square abundant number is classified correctly": - classify(196) is "abundant" - end +check "Abundant numbers -> Perfect square abundant number is classified correctly": + classify(196) is "abundant" end -fun smallest-prime-deficient(): - check "Deficient numbers -> Smallest prime deficient number is classified correctly": - classify(2) is "deficient" - end +check "Deficient numbers -> Smallest prime deficient number is classified correctly": + classify(2) is "deficient" end -fun smallest-non-prime-deficient(): - check "Deficient numbers -> Smallest non-prime deficient number is classified correctly": - classify(4) is "deficient" - end +check "Deficient numbers -> Smallest non-prime deficient number is classified correctly": + classify(4) is "deficient" end -fun medium-deficient(): - check "Deficient numbers -> Medium deficient number is classified correctly": - classify(32) is "deficient" - end +check "Deficient numbers -> Medium deficient number is classified correctly": + classify(32) is "deficient" end -fun large-deficient(): - check "Deficient numbers -> Large deficient number is classified correctly": - classify(33550337) is "deficient" - end +check "Deficient numbers -> Large deficient number is classified correctly": + classify(33550337) is "deficient" end -fun one-is-deficient(): - check "Deficient numbers -> Edge case (no factors other than itself) is classified correctly": - classify(1) is "deficient" - end +check "Deficient numbers -> Edge case (no factors other than itself) is classified correctly": + classify(1) is "deficient" end -fun reject-zero(): - check "Invalid inputs -> Zero is rejected (as it is not a positive integer)": - classify(0) raises "Classification is only possible for positive integers." - end +check "Invalid inputs -> Zero is rejected (as it is not a positive integer)": + classify(0) raises "Classification is only possible for positive integers." end -fun reject-negative(): - check "Invalid inputs -> Negative integer is rejected (as it is not a positive integer)": - classify(-1) raises "Classification is only possible for positive integers." - end +check "Invalid inputs -> Negative integer is rejected (as it is not a positive integer)": + classify(-1) raises "Classification is only possible for positive integers." end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(smallest-perfect, true), - test(medium-perfect-number, false), - test(large-perfect-number, false), - test(smallest-abundant, false), - test(medium-abundant, false), - test(large-abundant, false), - test(perfect-square-abundant, false), - test(smallest-prime-deficient, false), - test(smallest-non-prime-deficient, false), - test(medium-deficient, false), - test(large-deficient, false), - test(one-is-deficient, false), - test(reject-zero, false), - test(reject-negative, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/perfect-numbers/perfect-numbers.arr b/exercises/practice/perfect-numbers/perfect-numbers.arr index 6e1d6bb1..fa7ff3ed 100644 --- a/exercises/practice/perfect-numbers/perfect-numbers.arr +++ b/exercises/practice/perfect-numbers/perfect-numbers.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: classify end diff --git a/exercises/practice/phone-number/.meta/example.arr b/exercises/practice/phone-number/.meta/example.arr index 63ec11c6..c79cd471 100644 --- a/exercises/practice/phone-number/.meta/example.arr +++ b/exercises/practice/phone-number/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: clean end diff --git a/exercises/practice/phone-number/phone-number-test.arr b/exercises/practice/phone-number/phone-number-test.arr index e6f86dd2..41c6e3cc 100644 --- a/exercises/practice/phone-number/phone-number-test.arr +++ b/exercises/practice/phone-number/phone-number-test.arr @@ -1,146 +1,75 @@ -use context essentials2020 +use context starter2024 include file("phone-number.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun clean-number(): - check "cleans the number": - clean("(223) 456-7890") is "2234567890" - end +check "cleans the number": + clean("(223) 456-7890") is "2234567890" end -fun clean-number-with-dots(): - check "cleans numbers with dots": - clean("223.456.7890") is "2234567890" - end +check "cleans numbers with dots": + clean("223.456.7890") is "2234567890" end -fun clean-number-with-spaces(): - check "cleans numbers with multiple spaces": - clean("223 456 7890 ") is "2234567890" - end +check "cleans numbers with multiple spaces": + clean("223 456 7890 ") is "2234567890" end -fun invalid-nine-digits(): - check "invalid when 9 digits": - clean("123456789") raises "must not be fewer than 10 digits" - end +check "invalid when 9 digits": + clean("123456789") raises "must not be fewer than 10 digits" end -fun invalid-eleven-digits-starting-with-two(): - check "invalid when 11 digits does not start with a 1": - clean("22234567890") raises "11 digits must start with 1" - end +check "invalid when 11 digits does not start with a 1": + clean("22234567890") raises "11 digits must start with 1" end -fun valid-eleven-digits-starting-with-one(): - check "valid when 11 digits and starting with 1": - clean("12234567890") is "2234567890" - end +check "valid when 11 digits and starting with 1": + clean("12234567890") is "2234567890" end -fun valid-eleven-digits-starting-with-one-and-punctuation(): - check "valid when 11 digits and starting with 1 even with punctuation": - clean("+1 (223) 456-7890") is "2234567890" - end +check "valid when 11 digits and starting with 1 even with punctuation": + clean("+1 (223) 456-7890") is "2234567890" end -fun invalid-more-than-eleven-digits(): - check "invalid when more than 11 digits": - clean("321234567890") raises "must not be greater than 11 digits" - end +check "invalid when more than 11 digits": + clean("321234567890") raises "must not be greater than 11 digits" end -fun invalid-with-letters(): - check "invalid with letters": - clean("523-abc-7890") raises "letters not permitted" - end +check "invalid with letters": + clean("523-abc-7890") raises "letters not permitted" end -fun invalid-with-punctuation(): - check "invalid with punctuations": - clean("523-@:!-7890") raises "punctuations not permitted" - end +check "invalid with punctuations": + clean("523-@:!-7890") raises "punctuations not permitted" end -fun invalid-area-code-starts-with-zero(): - check "invalid if area code starts with 0": - clean("(023) 456-7890") raises "area code cannot start with zero" - end +check "invalid if area code starts with 0": + clean("(023) 456-7890") raises "area code cannot start with zero" end -fun invalid-area-code-starts-with-one(): - check "invalid if area code starts with 1": - clean("(123) 456-7890") raises "area code cannot start with one" - end +check "invalid if area code starts with 1": + clean("(123) 456-7890") raises "area code cannot start with one" end -fun invalid-exchange-code-starts-with-zero(): - check "invalid if exchange code starts with 0": - clean("(223) 056-7890") raises "exchange code cannot start with zero" - end +check "invalid if exchange code starts with 0": + clean("(223) 056-7890") raises "exchange code cannot start with zero" end -fun invalid-exchange-code-starts-with-one(): - check "invalid if exchange code starts with 1": - clean("(223) 156-7890") raises "exchange code cannot start with one" - end +check "invalid if exchange code starts with 1": + clean("(223) 156-7890") raises "exchange code cannot start with one" end -fun invalid-eleven-digits-and-area-code-starts-with-zero(): - check "invalid if area code starts with 0 on valid 11-digit number": - clean("1 (023) 456-7890") raises "area code cannot start with zero" - end +check "invalid if area code starts with 0 on valid 11-digit number": + clean("1 (023) 456-7890") raises "area code cannot start with zero" end -fun invalid-eleven-digits-and-area-code-starts-with-one(): - check "invalid if area code starts with 1 on valid 11-digit number": - clean("1 (123) 456-7890") raises "area code cannot start with one" - end +check "invalid if area code starts with 1 on valid 11-digit number": + clean("1 (123) 456-7890") raises "area code cannot start with one" end -fun invalid-eleven-digits-and-exchange-code-starts-with-zero(): - check "invalid if exchange code starts with 0 on valid 11-digit number": - clean("1 (223) 056-7890") raises "exchange code cannot start with zero" - end +check "invalid if exchange code starts with 0 on valid 11-digit number": + clean("1 (223) 056-7890") raises "exchange code cannot start with zero" end -fun invalid-eleven-digits-and-exchange-code-starts-with-one(): - check "invalid if exchange code starts with 1 on valid 11-digit number": - clean("1 (223) 156-7890") raises "exchange code cannot start with one" - end +check "invalid if exchange code starts with 1 on valid 11-digit number": + clean("1 (223) 156-7890") raises "exchange code cannot start with one" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(clean-number, true), - test(clean-number-with-dots, false), - test(clean-number-with-spaces, false), - test(invalid-nine-digits, false), - test(invalid-eleven-digits-starting-with-two, false), - test(valid-eleven-digits-starting-with-one, false), - test(valid-eleven-digits-starting-with-one-and-punctuation, false), - test(invalid-more-than-eleven-digits, false), - test(invalid-with-letters, false), - test(invalid-with-punctuation, false), - test(invalid-area-code-starts-with-zero, false), - test(invalid-area-code-starts-with-one, false), - test(invalid-exchange-code-starts-with-zero, false), - test(invalid-exchange-code-starts-with-one, false), - test(invalid-eleven-digits-and-area-code-starts-with-zero, false), - test(invalid-eleven-digits-and-area-code-starts-with-one, false), - test(invalid-eleven-digits-and-exchange-code-starts-with-zero, false), - test(invalid-eleven-digits-and-exchange-code-starts-with-one, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/phone-number/phone-number.arr b/exercises/practice/phone-number/phone-number.arr index 0b2ae6c1..bd9d9dd4 100644 --- a/exercises/practice/phone-number/phone-number.arr +++ b/exercises/practice/phone-number/phone-number.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: clean end diff --git a/exercises/practice/protein-translation/.meta/example.arr b/exercises/practice/protein-translation/.meta/example.arr index afd5cff2..443820a4 100644 --- a/exercises/practice/protein-translation/.meta/example.arr +++ b/exercises/practice/protein-translation/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: proteins end diff --git a/exercises/practice/protein-translation/protein-translation-test.arr b/exercises/practice/protein-translation/protein-translation-test.arr index f56ca5a2..f25fed45 100644 --- a/exercises/practice/protein-translation/protein-translation-test.arr +++ b/exercises/practice/protein-translation/protein-translation-test.arr @@ -1,236 +1,123 @@ -use context essentials2020 +use context starter2024 include file("protein-translation.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun no-protein(): - check "Empty RNA sequence results in no proteins": - proteins("") is [list: ] - end -end - -fun methionine(): - check "Methionine RNA sequence": - proteins("AUG") is [list: "Methionine"] - end +check "Empty RNA sequence results in no proteins": + proteins("") is [list: ] end -fun phenylalanine-one(): - check "Phenylalanine RNA sequence 1": - proteins("UUU") is [list: "Phenylalanine"] - end +check "Methionine RNA sequence": + proteins("AUG") is [list: "Methionine"] end -fun phenylalanine-two(): - check "Phenylalanine RNA sequence 2": - proteins("UUC") is [list: "Phenylalanine"] - end +check "Phenylalanine RNA sequence 1": + proteins("UUU") is [list: "Phenylalanine"] end -fun leucine-one(): - check "Leucine RNA sequence 1": - proteins("UUA") is [list: "Leucine"] - end +check "Phenylalanine RNA sequence 2": + proteins("UUC") is [list: "Phenylalanine"] end -fun leucine-two(): - check "Leucine RNA sequence 2": - proteins("UUG") is [list: "Leucine"] - end +check "Leucine RNA sequence 1": + proteins("UUA") is [list: "Leucine"] end -fun serine-one(): - check "Serine RNA sequence 1": - proteins("UCU") is [list: "Serine"] - end +check "Leucine RNA sequence 2": + proteins("UUG") is [list: "Leucine"] end -fun serine-two(): - check "Serine RNA sequence 2": - proteins("UCC") is [list: "Serine"] - end +check "Serine RNA sequence 1": + proteins("UCU") is [list: "Serine"] end -fun serine-three(): - check "Serine RNA sequence 3": - proteins("UCA") is [list: "Serine"] - end +check "Serine RNA sequence 2": + proteins("UCC") is [list: "Serine"] end -fun serine-four(): - check "Serine RNA sequence 4": - proteins("UCG") is [list: "Serine"] - end +check "Serine RNA sequence 3": + proteins("UCA") is [list: "Serine"] end -fun tyrosine-one(): - check "Tyrosine RNA sequence 1": - proteins("UAU") is [list: "Tyrosine"] - end +check "Serine RNA sequence 4": + proteins("UCG") is [list: "Serine"] end -fun tyrosine-two(): - check "Tyrosine RNA sequence 2": - proteins("UAC") is [list: "Tyrosine"] - end +check "Tyrosine RNA sequence 1": + proteins("UAU") is [list: "Tyrosine"] end -fun cysteine-one(): - check "Cysteine RNA sequence 1": - proteins("UGU") is [list: "Cysteine"] - end +check "Tyrosine RNA sequence 2": + proteins("UAC") is [list: "Tyrosine"] end -fun cysteine-two(): - check "Cysteine RNA sequence 2": - proteins("UGC") is [list: "Cysteine"] - end +check "Cysteine RNA sequence 1": + proteins("UGU") is [list: "Cysteine"] end -fun tryptophan(): - check "Tryptophan RNA sequence": - proteins("UGG") is [list: "Tryptophan"] - end +check "Cysteine RNA sequence 2": + proteins("UGC") is [list: "Cysteine"] end -fun stop-one(): - check "STOP codon RNA sequence 1": - proteins("UAA") is [list: ] - end +check "Tryptophan RNA sequence": + proteins("UGG") is [list: "Tryptophan"] end -fun stop-two(): - check "STOP codon RNA sequence 2": - proteins("UAG") is [list: ] - end +check "STOP codon RNA sequence 1": + proteins("UAA") is [list: ] end -fun stop-three(): - check "STOP codon RNA sequence 3": - proteins("UGA") is [list: ] - end +check "STOP codon RNA sequence 2": + proteins("UAG") is [list: ] end -fun two-identical-proteins(): - check "Sequence of two protein codons translates into proteins": - proteins("UUUUUU") is [list: "Phenylalanine", "Phenylalanine"] - end +check "STOP codon RNA sequence 3": + proteins("UGA") is [list: ] end -fun two-different-proteins(): - check "Sequence of two different protein codons translates into proteins": - proteins("UUAUUG") is [list: "Leucine", "Leucine"] - end +check "Sequence of two protein codons translates into proteins": + proteins("UUUUUU") is [list: "Phenylalanine", "Phenylalanine"] end -fun three-different-proteins(): - check "Translate RNA strand into correct protein list": - proteins("AUGUUUUGG") is [list: "Methionine", "Phenylalanine", "Tryptophan"] - end +check "Sequence of two different protein codons translates into proteins": + proteins("UUAUUG") is [list: "Leucine", "Leucine"] end -fun stop-at-beginning(): - check "Translation stops if STOP codon at beginning of sequence": - proteins("UAGUGG") is [list: ] - end +check "Translate RNA strand into correct protein list": + proteins("AUGUUUUGG") is [list: "Methionine", "Phenylalanine", "Tryptophan"] end -fun stop-at-end-of-two-codons(): - check "Translation stops if STOP codon at end of two-codon sequence": - proteins("UGGUAG") is [list: "Tryptophan"] - end +check "Translation stops if STOP codon at beginning of sequence": + proteins("UAGUGG") is [list: ] end -fun stop-at-end-of-three-codons(): - check "Translation stops if STOP codon at end of three-codon sequence": - proteins("AUGUUUUAA") is [list: "Methionine", "Phenylalanine"] - end +check "Translation stops if STOP codon at end of two-codon sequence": + proteins("UGGUAG") is [list: "Tryptophan"] end -fun stop-in-middle-of-three-codons(): - check "Translation stops if STOP codon in middle of three-codon sequence": - proteins("UGGUAGUGG") is [list: "Tryptophan"] - end +check "Translation stops if STOP codon at end of three-codon sequence": + proteins("AUGUUUUAA") is [list: "Methionine", "Phenylalanine"] end -fun stop-in-middle-of-six-codons(): - check "Translation stops if STOP codon in middle of six-codon sequence": - proteins("UGGUGUUAUUAAUGGUUU") is [list: "Tryptophan", "Cysteine", "Tyrosine"] - end +check "Translation stops if STOP codon in middle of three-codon sequence": + proteins("UGGUAGUGG") is [list: "Tryptophan"] end -fun sequence-of-two-non-stop-codons(): - check "Sequence of two non-STOP codons does not translate to a STOP codon": - proteins("AUGAUG") is [list: "Methionine", "Methionine"] - end +check "Translation stops if STOP codon in middle of six-codon sequence": + proteins("UGGUGUUAUUAAUGGUUU") is [list: "Tryptophan", "Cysteine", "Tyrosine"] end -fun unknown-codon(): - check "Unknown amino acids, not part of a codon, can't translate": - proteins("XYZ") raises "Invalid codon" - end +check "Sequence of two non-STOP codons does not translate to a STOP codon": + proteins("AUGAUG") is [list: "Methionine", "Methionine"] end -fun incomplete-sequence(): - check "Incomplete RNA sequence can't translate": - proteins("AUGU") raises "Invalid codon" - end +check "Unknown amino acids, not part of a codon, can't translate": + proteins("XYZ") raises "Invalid codon" end -fun incomplete-sequence-with-stop(): - check "Incomplete RNA sequence can translate if valid until a STOP codon": - proteins("UUCUUCUAAUGGU") is [list: "Phenylalanine", "Phenylalanine"] - end +check "Incomplete RNA sequence can't translate": + proteins("AUGU") raises "Invalid codon" end -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(no-protein, true), - test(methionine, false), - test(phenylalanine-one, false), - test(phenylalanine-two, false), - test(leucine-one, false), - test(leucine-two, false), - test(serine-one, false), - test(serine-two, false), - test(serine-three, false), - test(serine-four, false), - test(tyrosine-one, false), - test(tyrosine-two, false), - test(cysteine-one, false), - test(cysteine-two, false), - test(tryptophan, false), - test(stop-one, false), - test(stop-two, false), - test(stop-three, false), - test(two-identical-proteins, false), - test(two-different-proteins, false), - test(three-different-proteins, false), - test(stop-at-beginning, false), - test(stop-at-end-of-two-codons, false), - test(stop-at-end-of-three-codons, false), - test(stop-in-middle-of-three-codons, false), - test(stop-in-middle-of-six-codons, false), - test(sequence-of-two-non-stop-codons, false), - test(unknown-codon, false), - test(incomplete-sequence, false), - test(incomplete-sequence-with-stop, false) -].each(lam(t): when t.active: t.run() end end) - -fun ignore-this-trying-to-trigger-important-files(): - check "Incomplete RNA sequence can translate if valid until a STOP codon": - proteins("UUCUUCUAAUGGU") is [list: "Phenylalanine", "Phenylalanine"] - end +check "Incomplete RNA sequence can translate if valid until a STOP codon": + proteins("UUCUUCUAAUGGU") is [list: "Phenylalanine", "Phenylalanine"] end diff --git a/exercises/practice/protein-translation/protein-translation.arr b/exercises/practice/protein-translation/protein-translation.arr index afd5cff2..443820a4 100644 --- a/exercises/practice/protein-translation/protein-translation.arr +++ b/exercises/practice/protein-translation/protein-translation.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: proteins end diff --git a/exercises/practice/proverb/proverb-test.arr b/exercises/practice/proverb/proverb-test.arr index 6c9b04b1..a670efe7 100644 --- a/exercises/practice/proverb/proverb-test.arr +++ b/exercises/practice/proverb/proverb-test.arr @@ -1,89 +1,54 @@ -use context essentials2020 +use context starter2024 include file("proverb.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun zero-pieces(): - check "zero pieces": - recite([list: ]) is [list: ] - end +check "zero pieces": + recite([list: ]) is [list: ] end -fun one-piece(): - check "one piece": - input = [list: "nail"] - expected = [list: "And all for the want of a nail."] +check "one piece": + input = [list: "nail"] + expected = [list: "And all for the want of a nail."] - recite(input) is expected - end + recite(input) is expected end -fun two-pieces(): - check "two pieces": - input = [list: "nail", "shoe"] - expected = [list: "For want of a nail the shoe was lost.", - "And all for the want of a nail."] +check "two pieces": + input = [list: "nail", "shoe"] + expected = [list: "For want of a nail the shoe was lost.", + "And all for the want of a nail."] - recite(input) is expected - end + recite(input) is expected end -fun three-pieces(): - check "three pieces": - input = [list: "nail", "shoe", "horse"] - expected = [list: "For want of a nail the shoe was lost.", - "For want of a shoe the horse was lost.", - "And all for the want of a nail."] +check "three pieces": + input = [list: "nail", "shoe", "horse"] + expected = [list: "For want of a nail the shoe was lost.", + "For want of a shoe the horse was lost.", + "And all for the want of a nail."] - recite(input) is expected - end + recite(input) is expected end -fun full-proverb(): - check "full proverb": - input = [list: "nail", "shoe", "horse", "rider", "message", "battle", "kingdom"] - expected = [list: "For want of a nail the shoe was lost.", - "For want of a shoe the horse was lost.", - "For want of a horse the rider was lost.", - "For want of a rider the message was lost.", - "For want of a message the battle was lost.", - "For want of a battle the kingdom was lost.", - "And all for the want of a nail."] - - recite(input) is expected - end +check "full proverb": + input = [list: "nail", "shoe", "horse", "rider", "message", "battle", "kingdom"] + expected = [list: "For want of a nail the shoe was lost.", + "For want of a shoe the horse was lost.", + "For want of a horse the rider was lost.", + "For want of a rider the message was lost.", + "For want of a message the battle was lost.", + "For want of a battle the kingdom was lost.", + "And all for the want of a nail."] + + recite(input) is expected end -fun four-pieces-modernized(): - check "four pieces modernized": - input = [list: "pin", "gun", "soldier", "battle"] - expected = [list: "For want of a pin the gun was lost.", - "For want of a gun the soldier was lost.", - "For want of a soldier the battle was lost.", - "And all for the want of a pin."] +check "four pieces modernized": + input = [list: "pin", "gun", "soldier", "battle"] + expected = [list: "For want of a pin the gun was lost.", + "For want of a gun the soldier was lost.", + "For want of a soldier the battle was lost.", + "And all for the want of a pin."] - recite(input) is expected - end + recite(input) is expected end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(zero-pieces, true), - test(one-piece, false), - test(two-pieces, false), - test(three-pieces, false), - test(full-proverb, false), - test(four-pieces-modernized, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/queen-attack/.meta/example.arr b/exercises/practice/queen-attack/.meta/example.arr index 383f90da..090e0255 100644 --- a/exercises/practice/queen-attack/.meta/example.arr +++ b/exercises/practice/queen-attack/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * @@ -17,4 +17,4 @@ data Queen: == num-abs(other.row - self.row) ) end -end \ No newline at end of file +end diff --git a/exercises/practice/queen-attack/queen-attack-test.arr b/exercises/practice/queen-attack/queen-attack-test.arr index c6f78f62..8cc7531b 100644 --- a/exercises/practice/queen-attack/queen-attack-test.arr +++ b/exercises/practice/queen-attack/queen-attack-test.arr @@ -1,111 +1,55 @@ -use context essentials2020 +use context starter2024 include file("queen-attack.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun valid-position(): - check "Test creation of Queens with valid and invalid positions -> queen with a valid position": - queen(2, 2) does-not-raise - end +check "Test creation of Queens with valid and invalid positions -> queen with a valid position": + queen(2, 2) does-not-raise end -fun invalid-negative-row(): - check "Test creation of Queens with valid and invalid positions -> queen must have positive row": - queen(-2, 2) raises "" # matches any exception message - end +check "Test creation of Queens with valid and invalid positions -> queen must have positive row": + queen(-2, 2) raises "" # matches any exception message end -fun invalid-row-not-on-board(): - check "Test creation of Queens with valid and invalid positions -> queen must have row on board": - queen(8, 4) raises "" # matches any exception message - end +check "Test creation of Queens with valid and invalid positions -> queen must have row on board": + queen(8, 4) raises "" # matches any exception message end -fun invalid-negative-column(): - check "Test creation of Queens with valid and invalid positions -> queen must have positive column": - queen(2, -2) raises "" # matches any exception message - end +check "Test creation of Queens with valid and invalid positions -> queen must have positive column": + queen(2, -2) raises "" # matches any exception message end -fun invalid-column-not-on-board(): - check "Test creation of Queens with valid and invalid positions -> queen must have column on board": - queen(4, 8) raises "" # matches any exception message - end +check "Test creation of Queens with valid and invalid positions -> queen must have column on board": + queen(4, 8) raises "" # matches any exception message end -fun can-not-attack(): - check "Test the ability of one queen to attack another -> cannot attack": - queen(2, 4).can-attack(queen(6, 6)) is false - end +check "Test the ability of one queen to attack another -> cannot attack": + queen(2, 4).can-attack(queen(6, 6)) is false end -fun can-attack-on-same-row(): - check "Test the ability of one queen to attack another -> can attack on same row": - queen(2, 4).can-attack(queen(2, 6)) is true - end +check "Test the ability of one queen to attack another -> can attack on same row": + queen(2, 4).can-attack(queen(2, 6)) is true end -fun can-attack-on-same-column(): - check "Test the ability of one queen to attack another -> can attack on same column": - queen(4, 5).can-attack(queen(2, 5)) is true - end +check "Test the ability of one queen to attack another -> can attack on same column": + queen(4, 5).can-attack(queen(2, 5)) is true end -fun can-attack-on-first-diagonal(): - check "Test the ability of one queen to attack another -> can attack on first diagonal": - queen(2, 2).can-attack(queen(0, 4)) is true - end +check "Test the ability of one queen to attack another -> can attack on first diagonal": + queen(2, 2).can-attack(queen(0, 4)) is true end -fun can-attack-on-second-diagonal(): - check "Test the ability of one queen to attack another -> can attack on second diagonal": - queen(2, 2).can-attack(queen(3, 1)) is true - end +check "Test the ability of one queen to attack another -> can attack on second diagonal": + queen(2, 2).can-attack(queen(3, 1)) is true end -fun can-attack-on-third-diagonal(): - check "Test the ability of one queen to attack another -> can attack on third diagonal": - queen(2, 2).can-attack(queen(1, 1)) is true - end +check "Test the ability of one queen to attack another -> can attack on third diagonal": + queen(2, 2).can-attack(queen(1, 1)) is true end -fun can-attack-on-fourth-diagonal(): - check "Test the ability of one queen to attack another -> can attack on fourth diagonal": - queen(1, 7).can-attack(queen(0, 6)) is true - end +check "Test the ability of one queen to attack another -> can attack on fourth diagonal": + queen(1, 7).can-attack(queen(0, 6)) is true end -fun can-not-attack-on-reflected-diagonal(): - check "Test the ability of one queen to attack another -> cannot attack if falling diagonals are only the same when reflected across the longest falling diagonal": - queen(4, 1).can-attack(queen(2, 5)) is false - end +check "Test the ability of one queen to attack another -> cannot attack if falling diagonals are only the same when reflected across the longest falling diagonal": + queen(4, 1).can-attack(queen(2, 5)) is false end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(valid-position, true), - test(invalid-negative-row, false), - test(invalid-row-not-on-board, false), - test(invalid-negative-column, false), - test(invalid-column-not-on-board, false), - test(can-not-attack, false), - test(can-attack-on-same-row, false), - test(can-attack-on-same-column, false), - test(can-attack-on-first-diagonal, false), - test(can-attack-on-second-diagonal, false), - test(can-attack-on-third-diagonal, false), - test(can-attack-on-fourth-diagonal, false), - test(can-not-attack-on-reflected-diagonal, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file diff --git a/exercises/practice/queen-attack/queen-attack.arr b/exercises/practice/queen-attack/queen-attack.arr index f094940c..71833e51 100644 --- a/exercises/practice/queen-attack/queen-attack.arr +++ b/exercises/practice/queen-attack/queen-attack.arr @@ -1,7 +1,7 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * data Queen: ... # replace the dots with your implementation -end \ No newline at end of file +end diff --git a/exercises/practice/raindrops/.meta/example.arr b/exercises/practice/raindrops/.meta/example.arr index 8280944e..104672bc 100644 --- a/exercises/practice/raindrops/.meta/example.arr +++ b/exercises/practice/raindrops/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: convert end diff --git a/exercises/practice/raindrops/raindrops-test.arr b/exercises/practice/raindrops/raindrops-test.arr index a8f62fa1..76ed76ff 100644 --- a/exercises/practice/raindrops/raindrops-test.arr +++ b/exercises/practice/raindrops/raindrops-test.arr @@ -1,145 +1,75 @@ -use context essentials2020 +use context starter2024 include file("raindrops.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun convert-1(): - check "the sound for 1 is 1": - convert(1) is "1" - end +check "the sound for 1 is 1": + convert(1) is "1" end -fun convert-3(): - check "the sound for 3 is Pling": - convert(3) is "Pling" - end +check "the sound for 3 is Pling": + convert(3) is "Pling" end -fun convert-5(): - check "the sound for 5 is Plang": - convert(5) is "Plang" - end +check "the sound for 5 is Plang": + convert(5) is "Plang" end -fun convert-7(): - check "the sound for 7 is Plong": - convert(7) is "Plong" - end +check "the sound for 7 is Plong": + convert(7) is "Plong" end -fun convert-6(): - check "the sound for 6 is Pling as it has a factor 3": - convert(6) is "Pling" - end +check "the sound for 6 is Pling as it has a factor 3": + convert(6) is "Pling" end -fun convert-8(): - check "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base": - convert(8) is "8" - end +check "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base": + convert(8) is "8" end -fun convert-9(): - check "the sound for 9 is Pling as it has a factor 3": - convert(9) is "Pling" - end +check "the sound for 9 is Pling as it has a factor 3": + convert(9) is "Pling" end -fun convert-10(): - check "the sound for 10 is Plang as it has a factor 5": - convert(10) is "Plang" - end +check "the sound for 10 is Plang as it has a factor 5": + convert(10) is "Plang" end -fun convert-14(): - check "the sound for 14 is Plong as it has a factor of 7": - convert(14) is "Plong" - end +check "the sound for 14 is Plong as it has a factor of 7": + convert(14) is "Plong" end -fun convert-15(): - check "the sound for 15 is PlingPlang as it has factors 3 and 5": - convert(15) is "PlingPlang" - end +check "the sound for 15 is PlingPlang as it has factors 3 and 5": + convert(15) is "PlingPlang" end -fun convert-21(): - check "the sound for 21 is PlingPlong as it has factors 3 and 7": - convert(21) is "PlingPlong" - end +check "the sound for 21 is PlingPlong as it has factors 3 and 7": + convert(21) is "PlingPlong" end -fun convert-25(): - check "the sound for 25 is Plang as it has a factor 5": - convert(25) is "Plang" - end +check "the sound for 25 is Plang as it has a factor 5": + convert(25) is "Plang" end -fun convert-27(): - check "the sound for 27 is Pling as it has a factor 3": - convert(27) is "Pling" - end +check "the sound for 27 is Pling as it has a factor 3": + convert(27) is "Pling" end -fun convert-35(): - check "the sound for 35 is PlangPlong as it has factors 5 and 7": - convert(35) is "PlangPlong" - end +check "the sound for 35 is PlangPlong as it has factors 5 and 7": + convert(35) is "PlangPlong" end -fun convert-49(): - check "the sound for 49 is Plong as it has a factor 7": - convert(49) is "Plong" - end +check "the sound for 49 is Plong as it has a factor 7": + convert(49) is "Plong" end -fun convert-52(): - check "the sound for 52 is 52": - convert(52) is "52" - end +check "the sound for 52 is 52": + convert(52) is "52" end -fun convert-105(): - check "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7": - convert(105) is "PlingPlangPlong" - end +check "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7": + convert(105) is "PlingPlangPlong" end -fun convert-3125(): - check "the sound for 3125 is Plang as it has a factor 5": - convert(3125) is "Plang" - end +check "the sound for 3125 is Plang as it has a factor 5": + convert(3125) is "Plang" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(convert-1, true), - test(convert-3, false), - test(convert-5, false), - test(convert-7, false), - test(convert-6, false), - test(convert-8, false), - test(convert-9, false), - test(convert-10, false), - test(convert-14, false), - test(convert-15, false), - test(convert-21, false), - test(convert-25, false), - test(convert-27, false), - test(convert-35, false), - test(convert-49, false), - test(convert-52, false), - test(convert-105, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/raindrops/raindrops.arr b/exercises/practice/raindrops/raindrops.arr index 5817d881..b5778b5d 100644 --- a/exercises/practice/raindrops/raindrops.arr +++ b/exercises/practice/raindrops/raindrops.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: convert end diff --git a/exercises/practice/resistor-color-duo/.meta/example.arr b/exercises/practice/resistor-color-duo/.meta/example.arr index cfdcbbe7..a305c963 100644 --- a/exercises/practice/resistor-color-duo/.meta/example.arr +++ b/exercises/practice/resistor-color-duo/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: color-code end diff --git a/exercises/practice/resistor-color-duo/resistor-color-duo-test.arr b/exercises/practice/resistor-color-duo/resistor-color-duo-test.arr index 1b4440b2..52d1b801 100644 --- a/exercises/practice/resistor-color-duo/resistor-color-duo-test.arr +++ b/exercises/practice/resistor-color-duo/resistor-color-duo-test.arr @@ -1,69 +1,31 @@ -use context essentials2020 +use context starter2024 include file("resistor-color-duo.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun brown-and-black(): - check "Brown and black": - color-code([list: "brown", "black"]) is 10 - end +check "Brown and black": + color-code([list: "brown", "black"]) is 10 end -fun blue-and-grey(): - check "Blue and grey": - color-code([list: "blue", "grey"]) is 68 - end +check "Blue and grey": + color-code([list: "blue", "grey"]) is 68 end -fun yellow-and-violet(): - check "Yellow and violet": - color-code([list: "yellow", "violet"]) is 47 - end +check "Yellow and violet": + color-code([list: "yellow", "violet"]) is 47 end -fun white-and-red(): - check "White and red": - color-code([list: "white", "red"]) is 92 - end +check "White and red": + color-code([list: "white", "red"]) is 92 end -fun orange-and-orange(): - check "Orange and orange": - color-code([list: "orange", "orange"]) is 33 - end +check "Orange and orange": + color-code([list: "orange", "orange"]) is 33 end -fun ignore-additional-colors(): - check "Ignore additional colors": - color-code([list: "green", "brown", "orange"]) is 51 - end +check "Ignore additional colors": + color-code([list: "green", "brown", "orange"]) is 51 end -fun black-and-brown(): - check "Black and brown, one-digit": - color-code([list: "black", "brown"]) is 1 - end +check "Black and brown, one-digit": + color-code([list: "black", "brown"]) is 1 end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(brown-and-black, true), - test(blue-and-grey, false), - test(yellow-and-violet, false), - test(white-and-red, false), - test(orange-and-orange, false), - test(ignore-additional-colors, false), - test(black-and-brown, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/resistor-color-duo/resistor-color-duo.arr b/exercises/practice/resistor-color-duo/resistor-color-duo.arr index 8ceda241..b5b17e60 100644 --- a/exercises/practice/resistor-color-duo/resistor-color-duo.arr +++ b/exercises/practice/resistor-color-duo/resistor-color-duo.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: color-code end diff --git a/exercises/practice/resistor-color-trio/.meta/example.arr b/exercises/practice/resistor-color-trio/.meta/example.arr index 44f8ec79..6ca03bc7 100644 --- a/exercises/practice/resistor-color-trio/.meta/example.arr +++ b/exercises/practice/resistor-color-trio/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: label end diff --git a/exercises/practice/resistor-color-trio/resistor-color-trio-test.arr b/exercises/practice/resistor-color-trio/resistor-color-trio-test.arr index e71fca2e..8ad9455e 100644 --- a/exercises/practice/resistor-color-trio/resistor-color-trio-test.arr +++ b/exercises/practice/resistor-color-trio/resistor-color-trio-test.arr @@ -1,120 +1,73 @@ -use context essentials2020 +use context starter2024 include file("resistor-color-trio.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +check "Orange and orange and black": + colors = [list: "orange", "orange", "black"] + expected = "33 ohms" -fun orange-orange-black(): - check "Orange and orange and black": - colors = [list: "orange", "orange", "black"] - expected = "33 ohms" - - label(colors) is expected - end + label(colors) is expected end -fun blue-grey-brown(): - check "Blue and grey and brown": - colors = [list: "blue", "grey", "brown"] - expected = "680 ohms" +check "Blue and grey and brown": + colors = [list: "blue", "grey", "brown"] + expected = "680 ohms" - label(colors) is expected - end + label(colors) is expected end -fun red-black-red(): - check "Red and black and red": - colors = [list: "red", "black", "red"] - expected = "2 kiloohms" +check "Red and black and red": + colors = [list: "red", "black", "red"] + expected = "2 kiloohms" - label(colors) is expected - end + label(colors) is expected end -fun green-brown-orange(): - check "Green and brown and orange": - colors = [list: "green", "brown", "orange"] - expected = "51 kiloohms" +check "Green and brown and orange": + colors = [list: "green", "brown", "orange"] + expected = "51 kiloohms" - label(colors) is expected - end + label(colors) is expected end -fun yellow-violet-yellow(): - check "Yellow and violet and yellow": - colors = [list: "yellow", "violet", "yellow"] - expected = "470 kiloohms" +check "Yellow and violet and yellow": + colors = [list: "yellow", "violet", "yellow"] + expected = "470 kiloohms" - label(colors) is expected - end + label(colors) is expected end -fun blue-violet-blue(): - check "Blue and violet and blue": - colors = [list: "blue", "violet", "blue"] - expected = "67 megaohms" +check "Blue and violet and blue": + colors = [list: "blue", "violet", "blue"] + expected = "67 megaohms" - label(colors) is expected - end + label(colors) is expected end -fun minimum-value(): - check "Minimum possible value": - colors = [list: "black", "black", "black"] - expected = "0 ohms" +check "Minimum possible value": + colors = [list: "black", "black", "black"] + expected = "0 ohms" - label(colors) is expected - end + label(colors) is expected end -fun maximum-value(): - check "Maximum possible value": - colors = [list: "white", "white", "white"] - expected = "99 gigaohms" +check "Maximum possible value": + colors = [list: "white", "white", "white"] + expected = "99 gigaohms" - label(colors) is expected - end + label(colors) is expected end -fun invalid-octal-number(): - check "First two colors make an invalid octal number": - colors = [list: "black", "grey", "black"] - expected = "8 ohms" +check "First two colors make an invalid octal number": + colors = [list: "black", "grey", "black"] + expected = "8 ohms" - label(colors) is expected - end + label(colors) is expected end -fun ignore-extra-colors(): - check "Ignore extra colors": - colors = [list: "blue", "green", "yellow", "orange"] - expected = "650 kiloohms" +check "Ignore extra colors": + colors = [list: "blue", "green", "yellow", "orange"] + expected = "650 kiloohms" - label(colors) is expected - end + label(colors) is expected end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(orange-orange-black, true), - test(blue-grey-brown, false), - test(red-black-red, false), - test(green-brown-orange, false), - test(yellow-violet-yellow, false), - test(blue-violet-blue, false), - test(minimum-value, false), - test(maximum-value, false), - test(invalid-octal-number, false), - test(ignore-extra-colors, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/resistor-color-trio/resistor-color-trio.arr b/exercises/practice/resistor-color-trio/resistor-color-trio.arr index 44d7c3e6..fcf4df93 100644 --- a/exercises/practice/resistor-color-trio/resistor-color-trio.arr +++ b/exercises/practice/resistor-color-trio/resistor-color-trio.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: label end diff --git a/exercises/practice/resistor-color/.meta/example.arr b/exercises/practice/resistor-color/.meta/example.arr index 86fb9700..2f6d898e 100644 --- a/exercises/practice/resistor-color/.meta/example.arr +++ b/exercises/practice/resistor-color/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: color-code, colors end diff --git a/exercises/practice/resistor-color/resistor-color-test.arr b/exercises/practice/resistor-color/resistor-color-test.arr index 75f96e25..3162ea6d 100644 --- a/exercises/practice/resistor-color/resistor-color-test.arr +++ b/exercises/practice/resistor-color/resistor-color-test.arr @@ -1,59 +1,30 @@ -use context essentials2020 +use context starter2024 include file("resistor-color.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun color-code-black(): - check "Color codes -> Black": - color-code("black") is 0 - end +check "Color codes -> Black": + color-code("black") is 0 end -fun color-code-white(): - check "Color codes -> White": - color-code("white") is 9 - end +check "Color codes -> White": + color-code("white") is 9 end -fun color-code-orange(): - check "Color codes -> Orange": - color-code("orange") is 3 - end +check "Color codes -> Orange": + color-code("orange") is 3 end -fun test-colors(): - check "Colors": - colors() is [list: - "black", - "brown", - "red", - "orange", - "yellow", - "green", - "blue", - "violet", - "grey", - "white", - ] - end +check "Colors": + colors() is [list: + "black", + "brown", + "red", + "orange", + "yellow", + "green", + "blue", + "violet", + "grey", + "white", + ] end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(color-code-black, true), - test(color-code-white, false), - test(color-code-orange, false), - test(test-colors, false), -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/resistor-color/resistor-color.arr b/exercises/practice/resistor-color/resistor-color.arr index f61b4e00..6c8d4d55 100644 --- a/exercises/practice/resistor-color/resistor-color.arr +++ b/exercises/practice/resistor-color/resistor-color.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: color-code, colors end diff --git a/exercises/practice/reverse-string/.meta/example.arr b/exercises/practice/reverse-string/.meta/example.arr index c079e96d..26150b15 100644 --- a/exercises/practice/reverse-string/.meta/example.arr +++ b/exercises/practice/reverse-string/.meta/example.arr @@ -1,7 +1,7 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: reversed end fun reversed(input): string-explode(input).reverse().join-str("") -end \ No newline at end of file +end diff --git a/exercises/practice/reverse-string/reverse-string-test.arr b/exercises/practice/reverse-string/reverse-string-test.arr index 92b90ba7..ebb3971b 100644 --- a/exercises/practice/reverse-string/reverse-string-test.arr +++ b/exercises/practice/reverse-string/reverse-string-test.arr @@ -1,62 +1,27 @@ -use context essentials2020 +use context starter2024 include file("reverse-string.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun empty-string(): - check "an empty string": - reversed("") is "" - end +check "an empty string": + reversed("") is "" end -fun word(): - check "a word": - reversed("robot") is "tobor" - end +check "a word": + reversed("robot") is "tobor" end -fun capitalized-word(): - check "a capitalized word": - reversed("Ramen") is "nemaR" - end +check "a capitalized word": + reversed("Ramen") is "nemaR" end -fun sentence-with-punctuation(): - check "a sentence with punctuation": - reversed("I'm hungry!") is "!yrgnuh m'I" - end +check "a sentence with punctuation": + reversed("I'm hungry!") is "!yrgnuh m'I" end -fun palindrome(): - check "a palindrome": - reversed("racecar") is "racecar" - end +check "a palindrome": + reversed("racecar") is "racecar" end -fun even-sized-word(): - check "an even-sized word": - reversed("drawer") is "reward" - end +check "an even-sized word": + reversed("drawer") is "reward" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(empty-string, true), - test(word, false), - test(capitalized-word, false), - test(sentence-with-punctuation, false), - test(palindrome, false), - test(even-sized-word, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/reverse-string/reverse-string.arr b/exercises/practice/reverse-string/reverse-string.arr index fdb9c525..6ce49b17 100644 --- a/exercises/practice/reverse-string/reverse-string.arr +++ b/exercises/practice/reverse-string/reverse-string.arr @@ -1,7 +1,7 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: reversed end fun reversed(text): raise("please implement the reversed function") -end \ No newline at end of file +end diff --git a/exercises/practice/rna-transcription/.meta/example.arr b/exercises/practice/rna-transcription/.meta/example.arr index c0c5be55..33a1fa25 100644 --- a/exercises/practice/rna-transcription/.meta/example.arr +++ b/exercises/practice/rna-transcription/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: to-rna end @@ -18,4 +18,4 @@ fun to-rna(dna): end, [list: ] ).reverse().join-str("") -end \ No newline at end of file +end diff --git a/exercises/practice/rna-transcription/rna-transcription-test.arr b/exercises/practice/rna-transcription/rna-transcription-test.arr index 9ad34638..12f387fe 100644 --- a/exercises/practice/rna-transcription/rna-transcription-test.arr +++ b/exercises/practice/rna-transcription/rna-transcription-test.arr @@ -1,62 +1,27 @@ -use context essentials2020 +use context starter2024 include file("rna-transcription.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun empty-string(): - check "Empty RNA sequence": - to-rna("") is "" - end +check "Empty RNA sequence": + to-rna("") is "" end -fun cytosine-to-guanine(): - check "RNA complement of cytosine is guanine": - to-rna("C") is "G" - end +check "RNA complement of cytosine is guanine": + to-rna("C") is "G" end -fun guanine-to-cytosine(): - check "RNA complement of guanine is cytosine": - to-rna("G") is "C" - end +check "RNA complement of guanine is cytosine": + to-rna("G") is "C" end -fun thymine-to-adenine(): - check "RNA complement of thymine is adenine": - to-rna("T") is "A" - end +check "RNA complement of thymine is adenine": + to-rna("T") is "A" end -fun adenine-to-uracil(): - check "RNA complement of adenine is uracil": - to-rna("A") is "U" - end +check "RNA complement of adenine is uracil": + to-rna("A") is "U" end -fun rna-complement(): - check "RNA complement": - to-rna("ACGTGGTCTTAA") is "UGCACCAGAAUU" - end +check "RNA complement": + to-rna("ACGTGGTCTTAA") is "UGCACCAGAAUU" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(empty-string, true), - test(cytosine-to-guanine, false), - test(guanine-to-cytosine, false), - test(thymine-to-adenine, false), - test(adenine-to-uracil, false), - test(rna-complement, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/rna-transcription/rna-transcription.arr b/exercises/practice/rna-transcription/rna-transcription.arr index 10bf7ba7..277d49c7 100644 --- a/exercises/practice/rna-transcription/rna-transcription.arr +++ b/exercises/practice/rna-transcription/rna-transcription.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: to-rna end diff --git a/exercises/practice/robot-simulator/.meta/example.arr b/exercises/practice/robot-simulator/.meta/example.arr index 154cbe05..a74c730e 100644 --- a/exercises/practice/robot-simulator/.meta/example.arr +++ b/exercises/practice/robot-simulator/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * diff --git a/exercises/practice/robot-simulator/robot-simulator-test.arr b/exercises/practice/robot-simulator/robot-simulator-test.arr index 2b603067..6e20f295 100644 --- a/exercises/practice/robot-simulator/robot-simulator-test.arr +++ b/exercises/practice/robot-simulator/robot-simulator-test.arr @@ -1,182 +1,111 @@ -use context essentials2020 +use context starter2024 include file("robot-simulator.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +check "Create robot at origin facing north": + r = robot(0, 0, 'north') + expected = robot(0, 0, 'north') + r is expected +end + +check "Create robot at negative position facing south": + r = robot(-1, -1, 'south') + expected = robot(-1, -1, 'south') + r is expected +end + +check "Rotating clockwise changes north to east": + r = robot(0, 0, 'north') + expected = robot(0, 0, 'east') + r.move('R') is expected +end + +check "Rotating clockwise changes east to south": + r = robot(0, 0, 'east') + expected = robot(0, 0, 'south') + r.move('R') is expected +end + +check "Rotating clockwise changes south to west": + r = robot(0, 0, 'south') + expected = robot(0, 0, 'west') + r.move('R') is expected +end + +check "Rotating clockwise changes west to north": + r = robot(0, 0, 'west') + expected = robot(0, 0, 'north') + r.move('R') is expected +end + +check "Rotating counter-clockwise changes north to west": + r = robot(0, 0, 'north') + expected = robot(0, 0, 'west') + r.move('L') is expected +end + +check "Rotating counter-clockwise changes west to south": + r = robot(0, 0, 'west') + expected = robot(0, 0, 'south') + r.move('L') is expected +end -fun create-robot-at-origin-facing-north(): - check "Create robot at origin facing north": - r = robot(0, 0, 'north') - expected = robot(0, 0, 'north') - r is expected - end +check "Rotating counter-clockwise changes south to east": + r = robot(0, 0, 'south') + expected = robot(0, 0, 'east') + r.move('L') is expected end -fun create-robot-at-negative-position-facing-south(): - check "Create robot at negative position facing south": - r = robot(-1, -1, 'south') - expected = robot(-1, -1, 'south') - r is expected - end +check "Rotating counter-clockwise changes east to north": + r = robot(0, 0, 'east') + expected = robot(0, 0, 'north') + r.move('L') is expected end -fun rotating-clockwise-changes-north-to-east(): - check "Rotating clockwise changes north to east": - r = robot(0, 0, 'north') - expected = robot(0, 0, 'east') - r.move('R') is expected - end +check "Moving forward one facing north increments Y": + r = robot(0, 0, 'north') + expected = robot(0, 1, 'north') + r.move('A') is expected end -fun rotating-clockwise-changes-east-to-south(): - check "Rotating clockwise changes east to south": - r = robot(0, 0, 'east') - expected = robot(0, 0, 'south') - r.move('R') is expected - end +check "Moving forward one facing south decrements Y": + r = robot(0, 0, 'south') + expected = robot(0, -1, 'south') + r.move('A') is expected end -fun rotating-clockwise-changes-south-to-west(): - check "Rotating clockwise changes south to west": - r = robot(0, 0, 'south') - expected = robot(0, 0, 'west') - r.move('R') is expected - end +check "Moving forward one facing east increments X": + r = robot(0, 0, 'east') + expected = robot(1, 0, 'east') + r.move('A') is expected end -fun rotating-clockwise-changes-west-to-north(): - check "Rotating clockwise changes west to north": - r = robot(0, 0, 'west') - expected = robot(0, 0, 'north') - r.move('R') is expected - end +check "Moving forward one facing west decrements X": + r = robot(0, 0, 'west') + expected = robot(-1, 0, 'west') + r.move('A') is expected end -fun rotating-counter-clockwise-changes-north-to-west(): - check "Rotating counter-clockwise changes north to west": - r = robot(0, 0, 'north') - expected = robot(0, 0, 'west') - r.move('L') is expected - end +check "Follow series of directions moving east and north from README": + r = robot(7, 3, 'north') + expected = robot(9, 4, 'west') + r.move('RAALAL') is expected end -fun rotating-counter-clockwise-changes-west-to-south(): - check "Rotating counter-clockwise changes west to south": - r = robot(0, 0, 'west') - expected = robot(0, 0, 'south') - r.move('L') is expected - end -end - -fun rotating-counter-clockwise-changes-south-to-east(): - check "Rotating counter-clockwise changes south to east": - r = robot(0, 0, 'south') - expected = robot(0, 0, 'east') - r.move('L') is expected - end -end - -fun rotating-counter-clockwise-changes-east-to-north(): - check "Rotating counter-clockwise changes east to north": - r = robot(0, 0, 'east') - expected = robot(0, 0, 'north') - r.move('L') is expected - end -end - -fun moving-forward-one-facing-north-increments-Y(): - check "Moving forward one facing north increments Y": - r = robot(0, 0, 'north') - expected = robot(0, 1, 'north') - r.move('A') is expected - end -end - -fun moving-forward-one-facing-south-decrements-Y(): - check "Moving forward one facing south decrements Y": - r = robot(0, 0, 'south') - expected = robot(0, -1, 'south') - r.move('A') is expected - end -end - -fun moving-forward-one-facing-east-increments-X(): - check "Moving forward one facing east increments X": - r = robot(0, 0, 'east') - expected = robot(1, 0, 'east') - r.move('A') is expected - end -end - -fun moving-forward-one-facing-west-decrements-X(): - check "Moving forward one facing west decrements X": - r = robot(0, 0, 'west') - expected = robot(-1, 0, 'west') - r.move('A') is expected - end -end - -fun follow-series-of-directions-moving-east-and-north-from-readme(): - check "Follow series of directions moving east and north from README": - r = robot(7, 3, 'north') - expected = robot(9, 4, 'west') - r.move('RAALAL') is expected - end -end - -fun follow-series-of-directions-moving-west-and-north(): - check "Follow series of directions moving west and north": - r = robot(0, 0, 'north') - expected = robot(-4, 1, 'west') - r.move('LAAARALA') is expected - end -end - -fun follow-series-of-directions-moving-west-and-south(): - check "Follow series of directions moving west and south": - r = robot(2, -7, 'east') - expected = robot(-3, -8, 'south') - r.move('RRAAAAALA') is expected - end -end - -fun follow-series-of-directions-moving-east-and-north(): - check "Follow series of directions moving east and north": - r = robot(8, 4, 'south') - expected = robot(11, 5, 'north') - r.move('LAAARRRALLLL') is expected - end -end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(create-robot-at-origin-facing-north, true), - test(create-robot-at-negative-position-facing-south, false), - test(rotating-clockwise-changes-north-to-east, false), - test(rotating-clockwise-changes-east-to-south, false), - test(rotating-clockwise-changes-south-to-west, false), - test(rotating-clockwise-changes-west-to-north, false), - test(rotating-counter-clockwise-changes-north-to-west, false), - test(rotating-counter-clockwise-changes-west-to-south, false), - test(rotating-counter-clockwise-changes-south-to-east, false), - test(rotating-counter-clockwise-changes-east-to-north, false), - test(moving-forward-one-facing-north-increments-Y, false), - test(moving-forward-one-facing-south-decrements-Y, false), - test(moving-forward-one-facing-east-increments-X, false), - test(moving-forward-one-facing-west-decrements-X, false), - test(follow-series-of-directions-moving-east-and-north-from-readme, false), - test(follow-series-of-directions-moving-west-and-north, false), - test(follow-series-of-directions-moving-west-and-south, false), - test(follow-series-of-directions-moving-east-and-north, false) -].each(lam(t): when t.active: t.run() end end) +check "Follow series of directions moving west and north": + r = robot(0, 0, 'north') + expected = robot(-4, 1, 'west') + r.move('LAAARALA') is expected +end + +check "Follow series of directions moving west and south": + r = robot(2, -7, 'east') + expected = robot(-3, -8, 'south') + r.move('RRAAAAALA') is expected +end + +check "Follow series of directions moving east and north": + r = robot(8, 4, 'south') + expected = robot(11, 5, 'north') + r.move('LAAARRRALLLL') is expected +end diff --git a/exercises/practice/robot-simulator/robot-simulator.arr b/exercises/practice/robot-simulator/robot-simulator.arr index 92469271..3b095e87 100644 --- a/exercises/practice/robot-simulator/robot-simulator.arr +++ b/exercises/practice/robot-simulator/robot-simulator.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 # Don't delete this line when using Pyret on Exercism provide-types * diff --git a/exercises/practice/roman-numerals/.meta/example.arr b/exercises/practice/roman-numerals/.meta/example.arr index 3e4826ca..488383cf 100644 --- a/exercises/practice/roman-numerals/.meta/example.arr +++ b/exercises/practice/roman-numerals/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: to-roman end diff --git a/exercises/practice/roman-numerals/roman-numerals-test.arr b/exercises/practice/roman-numerals/roman-numerals-test.arr index 42a203f3..e9471b6b 100644 --- a/exercises/practice/roman-numerals/roman-numerals-test.arr +++ b/exercises/practice/roman-numerals/roman-numerals-test.arr @@ -1,210 +1,111 @@ -use context essentials2020 +use context starter2024 include file("roman-numerals.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun I(): - check "1 is I": - to-roman(1) is "I" - end +check "1 is I": + to-roman(1) is "I" end -fun II(): - check "2 is II": - to-roman(2) is "II" - end +check "2 is II": + to-roman(2) is "II" end -fun III(): - check "3 is III": - to-roman(3) is "III" - end +check "3 is III": + to-roman(3) is "III" end -fun IV(): - check "4 is IV": - to-roman(4) is "IV" - end +check "4 is IV": + to-roman(4) is "IV" end -fun V(): - check "5 is V": - to-roman(5) is "V" - end +check "5 is V": + to-roman(5) is "V" end -fun VI(): - check "6 is VI": - to-roman(6) is "VI" - end +check "6 is VI": + to-roman(6) is "VI" end -fun IX(): - check "9 is IX": - to-roman(9) is "IX" - end +check "9 is IX": + to-roman(9) is "IX" end -fun XVI(): - check "16 is XVI": - to-roman(16) is "XVI" - end +check "16 is XVI": + to-roman(16) is "XVI" end -fun XXVII(): - check "27 is XXVII": - to-roman(27) is "XXVII" - end +check "27 is XXVII": + to-roman(27) is "XXVII" end -fun XLVIII(): - check "48 is XLVIII": - to-roman(48) is "XLVIII" - end +check "48 is XLVIII": + to-roman(48) is "XLVIII" end -fun XLIX(): - check "49 is XLIX": - to-roman(49) is "XLIX" - end +check "49 is XLIX": + to-roman(49) is "XLIX" end -fun LIX(): - check "59 is LIX": - to-roman(59) is "LIX" - end +check "59 is LIX": + to-roman(59) is "LIX" end -fun LXVI(): - check "66 is LXVI": - to-roman(66) is "LXVI" - end +check "66 is LXVI": + to-roman(66) is "LXVI" end -fun XCIII(): - check "93 is XCIII": - to-roman(93) is "XCIII" - end +check "93 is XCIII": + to-roman(93) is "XCIII" end -fun CXLI(): - check "141 is CXLI": - to-roman(141) is "CXLI" - end +check "141 is CXLI": + to-roman(141) is "CXLI" end -fun CLXIII(): - check "163 is CLXIII": - to-roman(163) is "CLXIII" - end +check "163 is CLXIII": + to-roman(163) is "CLXIII" end -fun CLXVI(): - check "166 is CLXVI": - to-roman(166) is "CLXVI" - end +check "166 is CLXVI": + to-roman(166) is "CLXVI" end -fun CDII(): - check "402 is CDII": - to-roman(402) is "CDII" - end +check "402 is CDII": + to-roman(402) is "CDII" end -fun DLXXV(): - check "575 is DLXXV": - to-roman(575) is "DLXXV" - end +check "575 is DLXXV": + to-roman(575) is "DLXXV" end -fun DCLXVI(): - check "666 is DCLXVI": - to-roman(666) is "DCLXVI" - end +check "666 is DCLXVI": + to-roman(666) is "DCLXVI" end -fun CMXI(): - check "911 is CMXI": - to-roman(911) is "CMXI" - end +check "911 is CMXI": + to-roman(911) is "CMXI" end -fun MXXIV(): - check "1024 is MXXIV": - to-roman(1024) is "MXXIV" - end +check "1024 is MXXIV": + to-roman(1024) is "MXXIV" end -fun MDCLXVI(): - check "1666 is MDCLXVI": - to-roman(1666) is "MDCLXVI" - end +check "1666 is MDCLXVI": + to-roman(1666) is "MDCLXVI" end -fun MMM(): - check "3000 is MMM": - to-roman(3000) is "MMM" - end +check "3000 is MMM": + to-roman(3000) is "MMM" end -fun MMMI(): - check "3001 is MMMI": - to-roman(3001) is "MMMI" - end +check "3001 is MMMI": + to-roman(3001) is "MMMI" end -fun MMMDCCCLXXXVIII(): - check "3888 is MMMDCCCLXXXVIII": - to-roman(3888) is "MMMDCCCLXXXVIII" - end +check "3888 is MMMDCCCLXXXVIII": + to-roman(3888) is "MMMDCCCLXXXVIII" end -fun MMMCMXCIX(): - check "3999 is MMMCMXCIX": - to-roman(3999) is "MMMCMXCIX" - end +check "3999 is MMMCMXCIX": + to-roman(3999) is "MMMCMXCIX" end - - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(I, true), - test(II, false), - test(III, false), - test(IV, false), - test(V, false), - test(VI, false), - test(IX, false), - test(XVI, false), - test(XXVII, false), - test(XLVIII, false), - test(XLIX, false), - test(LIX, false), - test(LXVI, false), - test(XCIII, false), - test(CXLI, false), - test(CLXIII, false), - test(CLXVI, false), - test(CDII, false), - test(DLXXV, false), - test(DCLXVI, false), - test(CMXI, false), - test(MXXIV, false), - test(MDCLXVI, false), - test(MMM, false), - test(MMMI, false), - test(MMMDCCCLXXXVIII, false), - test(MMMCMXCIX, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/roman-numerals/roman-numerals.arr b/exercises/practice/roman-numerals/roman-numerals.arr index 18e71878..1670ad11 100644 --- a/exercises/practice/roman-numerals/roman-numerals.arr +++ b/exercises/practice/roman-numerals/roman-numerals.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: to-roman end diff --git a/exercises/practice/scrabble-score/.meta/example.arr b/exercises/practice/scrabble-score/.meta/example.arr index 35d01779..92a8786b 100644 --- a/exercises/practice/scrabble-score/.meta/example.arr +++ b/exercises/practice/scrabble-score/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: score end @@ -54,4 +54,4 @@ fun score(word): end end, 0) -end \ No newline at end of file +end diff --git a/exercises/practice/scrabble-score/scrabble-score-test.arr b/exercises/practice/scrabble-score/scrabble-score-test.arr index 4dbdd857..10409ee3 100644 --- a/exercises/practice/scrabble-score/scrabble-score-test.arr +++ b/exercises/practice/scrabble-score/scrabble-score-test.arr @@ -1,97 +1,47 @@ -use context essentials2020 +use context starter2024 include file("scrabble-score.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun lowercase-letter(): - check "lowercase letter": - score("a") is 1 - end +check "lowercase letter": + score("a") is 1 end -fun uppercase-letter(): - check "uppercase letter": - score("A") is 1 - end +check "uppercase letter": + score("A") is 1 end -fun valuable-letter(): - check "valuable letter": - score("f") is 4 - end +check "valuable letter": + score("f") is 4 end -fun short-word(): - check "short word": - score("at") is 2 - end +check "short word": + score("at") is 2 end -fun short-valuable-word(): - check "short, valuable word": - score("zoo") is 12 - end +check "short, valuable word": + score("zoo") is 12 end -fun medium-word(): - check "medium word": - score("street") is 6 - end +check "medium word": + score("street") is 6 end -fun medium-valuable-word(): - check "medium, valuable word": - score("quirky") is 22 - end +check "medium, valuable word": + score("quirky") is 22 end -fun long-mixed-case-word(): - check "long, mixed-case word": - score("OxyphenButazone") is 41 - end +check "long, mixed-case word": + score("OxyphenButazone") is 41 end -fun english-like-word(): - check "english-like word": - score("pinata") is 8 - end +check "english-like word": + score("pinata") is 8 end -fun empty-input(): - check "empty input": - score("") is 0 - end +check "empty input": + score("") is 0 end -fun entire-alphabet(): - check "entire alphabet available": - score("abcdefghijklmnopqrstuvwxyz") is 87 - end +check "entire alphabet available": + score("abcdefghijklmnopqrstuvwxyz") is 87 end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(lowercase-letter, true), - test(uppercase-letter, false), - test(valuable-letter, false), - test(short-word, false), - test(short-valuable-word, false), - test(medium-word, false), - test(medium-valuable-word, false), - test(long-mixed-case-word, false), - test(english-like-word, false), - test(empty-input, false), - test(entire-alphabet, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/scrabble-score/scrabble-score.arr b/exercises/practice/scrabble-score/scrabble-score.arr index 83dc4066..a76a5c75 100644 --- a/exercises/practice/scrabble-score/scrabble-score.arr +++ b/exercises/practice/scrabble-score/scrabble-score.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: score end diff --git a/exercises/practice/secret-handshake/.meta/example.arr b/exercises/practice/secret-handshake/.meta/example.arr index 0dceedbe..b7b54d4a 100644 --- a/exercises/practice/secret-handshake/.meta/example.arr +++ b/exercises/practice/secret-handshake/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: commands end @@ -28,4 +28,4 @@ fun commands(binary): digits = L.reverse(string-explode(binary)) value = L.fold_n(to-commands, 0, [list: ], digits) L.reverse(value) -end \ No newline at end of file +end diff --git a/exercises/practice/secret-handshake/secret-handshake-test.arr b/exercises/practice/secret-handshake/secret-handshake-test.arr index 41609f43..7bcb96af 100644 --- a/exercises/practice/secret-handshake/secret-handshake-test.arr +++ b/exercises/practice/secret-handshake/secret-handshake-test.arr @@ -1,97 +1,47 @@ -use context essentials2020 +use context starter2024 include file("secret-handshake.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun wink(): - check "wink for 1": - commands("00001") is [list: "wink"] - end +check "wink for 1": + commands("00001") is [list: "wink"] end -fun double-blink(): - check "double blink for 10": - commands("00010") is [list: "double blink"] - end +check "double blink for 10": + commands("00010") is [list: "double blink"] end -fun close-your-eyes(): - check "close your eyes for 100": - commands("00100") is [list: "close your eyes"] - end +check "close your eyes for 100": + commands("00100") is [list: "close your eyes"] end -fun jump(): - check "jump for 1000": - commands("01000") is [list: "jump"] - end +check "jump for 1000": + commands("01000") is [list: "jump"] end -fun combine-two-actions(): - check "combine two actions": - commands("00011") is [list: "wink", "double blink"] - end +check "combine two actions": + commands("00011") is [list: "wink", "double blink"] end -fun reverse-two-actions(): - check "reverse two actions": - commands("10011") is [list: "double blink", "wink"] - end +check "reverse two actions": + commands("10011") is [list: "double blink", "wink"] end -fun reversed-action-is-same(): - check "reversing one action gives the same action": - commands("11000") is [list: "jump"] - end +check "reversing one action gives the same action": + commands("11000") is [list: "jump"] end -fun reversed-inaction-is-same(): - check "reversing no actions still gives no actions": - commands("10000") is [list: ] - end +check "reversing no actions still gives no actions": + commands("10000") is [list: ] end -fun all-possible-actions(): - check "all possible actions": - commands("01111") is [list: "wink", "double blink", "close your eyes", "jump"] - end +check "all possible actions": + commands("01111") is [list: "wink", "double blink", "close your eyes", "jump"] end -fun all-possible-actions-reversed(): - check "reverse all possible actions": - commands("11111") is [list: "jump", "close your eyes", "double blink", "wink"] - end +check "reverse all possible actions": + commands("11111") is [list: "jump", "close your eyes", "double blink", "wink"] end -fun do-nothing(): - check "do nothing for zero": - commands("00000") is [list: ] - end +check "do nothing for zero": + commands("00000") is [list: ] end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(wink, true), - test(double-blink, false), - test(close-your-eyes, false), - test(jump, false), - test(combine-two-actions, false), - test(reverse-two-actions, false), - test(reversed-action-is-same, false), - test(reversed-inaction-is-same, false), - test(all-possible-actions, false), - test(all-possible-actions-reversed, false), - test(do-nothing, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/secret-handshake/secret-handshake.arr b/exercises/practice/secret-handshake/secret-handshake.arr index 12f55215..c6134562 100644 --- a/exercises/practice/secret-handshake/secret-handshake.arr +++ b/exercises/practice/secret-handshake/secret-handshake.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: commands end diff --git a/exercises/practice/series/.meta/example.arr b/exercises/practice/series/.meta/example.arr index c0d93144..e262c8a8 100644 --- a/exercises/practice/series/.meta/example.arr +++ b/exercises/practice/series/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: slices end diff --git a/exercises/practice/series/series-test.arr b/exercises/practice/series/series-test.arr index 59304756..fbbc576f 100644 --- a/exercises/practice/series/series-test.arr +++ b/exercises/practice/series/series-test.arr @@ -1,97 +1,47 @@ -use context essentials2020 +use context starter2024 include file("series.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun slices-of-one-from-one(): - check "slices of one from one": - slices("1", 1) is [list: "1"] - end +check "slices of one from one": + slices("1", 1) is [list: "1"] end -fun slices-of-one-from-two(): - check "slices of one from two": - slices("12", 1) is [list: "1", "2"] - end +check "slices of one from two": + slices("12", 1) is [list: "1", "2"] end -fun slices-of-two(): - check "slices of two": - slices("35", 2) is [list: "35"] - end +check "slices of two": + slices("35", 2) is [list: "35"] end -fun slices-of-two-overlap(): - check "slices of two overlap": - slices("9142", 2) is [list: "91", "14", "42"] - end +check "slices of two overlap": + slices("9142", 2) is [list: "91", "14", "42"] end -fun slices-can-include-duplicates(): - check "slices can include duplicates": - slices("777777", 3) is [list: "777", "777", "777", "777"] - end +check "slices can include duplicates": + slices("777777", 3) is [list: "777", "777", "777", "777"] end -fun slices-of-a-long-series(): - check "slices of a long series": - slices("918493904243", 5) is [list: "91849", "18493", "84939", "49390", "93904", "39042", "90424", "04243"] - end +check "slices of a long series": + slices("918493904243", 5) is [list: "91849", "18493", "84939", "49390", "93904", "39042", "90424", "04243"] end -fun slice-length-too-large(): - check "slice length is too large": - slices("12345", 6) raises "slice length cannot be greater than series length" - end +check "slice length is too large": + slices("12345", 6) raises "slice length cannot be greater than series length" end -fun slice-length-way-too-large(): - check "slice length is way too large": - slices("12345", 42) raises "slice length cannot be greater than series length" - end +check "slice length is way too large": + slices("12345", 42) raises "slice length cannot be greater than series length" end -fun slice-length-can-not-be-zero(): - check "slice length cannot be zero": - slices("12345", 0) raises "slice length cannot be zero" - end +check "slice length cannot be zero": + slices("12345", 0) raises "slice length cannot be zero" end -fun slice-length-can-not-be-negative(): - check "slice length cannot be negative": - slices("12345", -1) raises "slice length cannot be negative" - end +check "slice length cannot be negative": + slices("12345", -1) raises "slice length cannot be negative" end -fun empty-series-is-invalid(): - check "empty series is invalid": - slices("", 1) raises "series cannot be empty" - end +check "empty series is invalid": + slices("", 1) raises "series cannot be empty" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(slices-of-one-from-one, true), - test(slices-of-one-from-two, false), - test(slices-of-two, false), - test(slices-of-two-overlap, false), - test(slices-can-include-duplicates, false), - test(slices-of-a-long-series, false), - test(slice-length-too-large, false), - test(slice-length-way-too-large, false), - test(slice-length-can-not-be-zero, false), - test(slice-length-can-not-be-negative, false), - test(empty-series-is-invalid, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/series/series.arr b/exercises/practice/series/series.arr index ba72f962..471ff278 100644 --- a/exercises/practice/series/series.arr +++ b/exercises/practice/series/series.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: slices end diff --git a/exercises/practice/sieve/.meta/example.arr b/exercises/practice/sieve/.meta/example.arr index 14fcbd11..404ed381 100644 --- a/exercises/practice/sieve/.meta/example.arr +++ b/exercises/practice/sieve/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: primes end diff --git a/exercises/practice/sieve/sieve-test.arr b/exercises/practice/sieve/sieve-test.arr index ec4c0a80..044abf6a 100644 --- a/exercises/practice/sieve/sieve-test.arr +++ b/exercises/practice/sieve/sieve-test.arr @@ -1,18 +1,11 @@ -use context essentials2020 +use context starter2024 include file("sieve.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun no-primes-under-two(): - check "no primes under two": - primes(1) is [list:] - end +check "no primes under two": + primes(1) is [list:] end + fun find-first-prime(): check "find first prime": @@ -20,49 +13,27 @@ end end end -fun find-primes-up-to-10(): - check "find primes up to 10": - primes(10) is [list:2, 3, 5, 7] - end +check "find primes up to 10": + primes(10) is [list:2, 3, 5, 7] end -fun limit-is-prime(): - check "limit is prime": - primes(13) is [list:2, 3, 5, 7, 11, 13] - end +check "limit is prime": + primes(13) is [list:2, 3, 5, 7, 11, 13] end -fun find-primes-up-to-1000(): - check "find primes up to 1000": - primes(1000) is [list: - 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, - 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, - 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, - 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, - 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, - 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, - 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, - 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, - 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, - 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, - 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, - 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997 - ] - end +check "find primes up to 1000": + primes(1000) is [list: + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, + 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, + 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, + 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, + 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, + 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, + 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, + 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, + 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, + 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, + 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, + 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997 + ] end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(no-primes-under-two, true), - test(find-first-prime, false), - test(find-primes-up-to-10, false), - test(limit-is-prime, false), - test(find-primes-up-to-1000, false), -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/sieve/sieve.arr b/exercises/practice/sieve/sieve.arr index 5c0d1335..2f09e834 100644 --- a/exercises/practice/sieve/sieve.arr +++ b/exercises/practice/sieve/sieve.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: primes end diff --git a/exercises/practice/simple-linked-list/.meta/example.arr b/exercises/practice/simple-linked-list/.meta/example.arr index c1aca337..c6e127ac 100644 --- a/exercises/practice/simple-linked-list/.meta/example.arr +++ b/exercises/practice/simple-linked-list/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * @@ -34,4 +34,4 @@ sharing: lam(elt, acc): acc.push(elt) end, [list: ]) end -end \ No newline at end of file +end diff --git a/exercises/practice/simple-linked-list/simple-linked-list-test.arr b/exercises/practice/simple-linked-list/simple-linked-list-test.arr index 16d83487..196ad1c6 100644 --- a/exercises/practice/simple-linked-list/simple-linked-list-test.arr +++ b/exercises/practice/simple-linked-list/simple-linked-list-test.arr @@ -1,179 +1,114 @@ -use context essentials2020 +use context starter2024 include file("simple-linked-list.arr") # No canonical data available for this exercise so these have been ported from Python and F# -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +check "empty list has length zero": + empty-list.length() is 0 +end + +check "singleton list has length one": + linked-list(1, empty-list).length() is 1 +end + +check "non-empty list has correct length": + result = empty-list + ^ linked-list(3, _) + ^ linked-list(2, _) + ^ linked-list(1, _) + + result.length() is 3 +end + +check "singleton list has head": + linked-list(1, empty-list).get-head() is 1 +end + +check "non-empty list has correct head": + result = empty-list + ^ linked-list(1, _) + ^ linked-list(2, _) + + result.get-head() is 2 +end + +check "can push to non-empty list": + result = empty-list + ^ linked-list(3, _) + ^ linked-list(2, _) + ^ linked-list(1, _) + + result.push(4).length() is 4 +end + +check "pushing to empty list changes head": + result = empty-list.push(5) + + result.length() is 1 + result.get-head() is 5 +end -fun empty-list-length-zero(): - check "empty list has length zero": - empty-list.length() is 0 - end +check "can access second element in list": + result = empty-list + ^ linked-list(3, _) + ^ linked-list(4, _) + ^ linked-list(5, _) + + result.get-tail().get-head() is 4 end -fun singleton-has-length-one(): - check "singleton list has length one": - linked-list(1, empty-list).length() is 1 - end +check "test singleton list head has no tail": + linked-list(1, empty-list).get-tail() is empty-list end -fun non-empty-list-has-length(): - check "non-empty list has correct length": - result = empty-list - ^ linked-list(3, _) - ^ linked-list(2, _) - ^ linked-list(1, _) +check "non-empty list traverse": + my-list = range(0, 11).foldl( + lam(elt, acc): + acc.push(elt) + end, + empty-list) + + traversed = range(-10, 0).foldl( + lam(n, acc) block: + acc.get-head() is num-abs(n) + acc.get-tail() + end, + my-list) + + traversed.get-tail() is empty-list +end - result.length() is 3 - end +check "empty linked list to list is empty": + empty-list.to-list() is [list: ] end -fun singleton-has-head(): - check "singleton list has head": - linked-list(1, empty-list).get-head() is 1 - end +check "singleton linked list to list with single element": + linked-list(1, empty-list).to-list() is [list: 1] end -fun non-empty-list-has-head(): - check "non-empty list has correct head": - result = empty-list - ^ linked-list(1, _) - ^ linked-list(2, _) +check "non-empty linked list to list is list with all elements": + result = empty-list + ^ linked-list(3, _) + ^ linked-list(2, _) + ^ linked-list(1, _) - result.get-head() is 2 - end + result.to-list() is [list: 3, 2, 1] end -fun push-to-non-empty-list(): - check "can push to non-empty list": - result = empty-list - ^ linked-list(3, _) - ^ linked-list(2, _) - ^ linked-list(1, _) - - result.push(4).length() is 4 - end +check "reversed empty list is empty list": + empty-list.reversed().to-list() is [list: ] end -fun push-changes-empty-list-head(): - check "pushing to empty list changes head": - result = empty-list.push(5) - - result.length() is 1 - result.get-head() is 5 - end +check "reversed singleton list is same list": + linked-list(1, empty-list).reversed() is linked-list(1, empty-list) end -fun access-second-element(): - check "can access second element in list": - result = empty-list - ^ linked-list(3, _) - ^ linked-list(4, _) - ^ linked-list(5, _) - - result.get-tail().get-head() is 4 - end -end - -fun singleton-has-no-tail(): - check "test singleton list head has no tail": - linked-list(1, empty-list).get-tail() is empty-list - end -end - -fun non-empty-list-traverse(): - check "non-empty list traverse": - my-list = range(0, 11).foldl( - lam(elt, acc): - acc.push(elt) - end, - empty-list) - - traversed = range(-10, 0).foldl( - lam(n, acc) block: - acc.get-head() is num-abs(n) - acc.get-tail() - end, - my-list) - - traversed.get-tail() is empty-list - end -end - -fun empty-linked-list-is-empty-list(): - check "empty linked list to list is empty": - empty-list.to-list() is [list: ] - end -end - -fun singleton-is-list-with-single-element(): - check "singleton linked list to list with single element": - linked-list(1, empty-list).to-list() is [list: 1] - end -end - -fun non-empty-list-is-list-with-all-elements(): - check "non-empty linked list to list is list with all elements": - result = empty-list - ^ linked-list(3, _) - ^ linked-list(2, _) - ^ linked-list(1, _) - - result.to-list() is [list: 3, 2, 1] - end -end - -fun reversed-empty-list-is-empty-list(): - check "reversed empty list is empty list": - empty-list.reversed().to-list() is [list: ] - end -end - -fun reversed-singleton-list-is-same-list(): - check "reversed singleton list is same list": - linked-list(1, empty-list).reversed() is linked-list(1, empty-list) - end -end - -fun reverse-non-empty-list(): - check "reverse non-empty list": - result = empty-list - ^ linked-list(3, _) - ^ linked-list(2, _) - ^ linked-list(1, _) - - result.reversed().to-list() is [list: 1, 2, 3] - end -end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(empty-list-length-zero, true), - test(singleton-has-length-one, false), - test(non-empty-list-has-length, false), - test(singleton-has-head, false), - test(non-empty-list-has-head, false), - test(push-to-non-empty-list, false), - test(push-changes-empty-list-head, false), - test(access-second-element, false), - test(singleton-has-no-tail, false), - test(non-empty-list-traverse, false), - test(empty-linked-list-is-empty-list, false), - test(singleton-is-list-with-single-element, false), - test(non-empty-list-is-list-with-all-elements, false), - test(reversed-empty-list-is-empty-list, false), - test(reversed-singleton-list-is-same-list, false), - test(reverse-non-empty-list, false) -].each(lam(t): when t.active: t.run() end end) \ No newline at end of file +check "reverse non-empty list": + result = empty-list + ^ linked-list(3, _) + ^ linked-list(2, _) + ^ linked-list(1, _) + + result.reversed().to-list() is [list: 1, 2, 3] +end diff --git a/exercises/practice/simple-linked-list/simple-linked-list.arr b/exercises/practice/simple-linked-list/simple-linked-list.arr index da37512a..65d69db2 100644 --- a/exercises/practice/simple-linked-list/simple-linked-list.arr +++ b/exercises/practice/simple-linked-list/simple-linked-list.arr @@ -1,7 +1,7 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide-types * data LinkedList: ... # Replace the dots with your implementation -end \ No newline at end of file +end diff --git a/exercises/practice/space-age/.meta/example.arr b/exercises/practice/space-age/.meta/example.arr index 4c599cfc..4ac5d49c 100644 --- a/exercises/practice/space-age/.meta/example.arr +++ b/exercises/practice/space-age/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: on-planet end diff --git a/exercises/practice/space-age/space-age-test.arr b/exercises/practice/space-age/space-age-test.arr index 8ecf54a4..9d069329 100644 --- a/exercises/practice/space-age/space-age-test.arr +++ b/exercises/practice/space-age/space-age-test.arr @@ -1,13 +1,7 @@ -use context essentials2020 +use context starter2024 include file("space-age.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - fun around(delta :: Number) -> (Number, Number -> Boolean): doc: "provides a predicate that returns true if the absolute values of two numbers are less than or equal to the specified delta" lam(actual, target): @@ -15,76 +9,38 @@ fun around(delta :: Number) -> (Number, Number -> Boolean): end end -fun age-on-earth(): - check "age on Earth": - on-planet("Earth", 1000000000) is%(around(0.01)) 31.69 - end +check "age on Earth": + on-planet("Earth", 1000000000) is%(around(0.01)) 31.69 end -fun age-on-mercury(): - check "age on Mercury": - on-planet("Mercury", 2134835688) is%(around(0.01)) 280.88 - end +check "age on Mercury": + on-planet("Mercury", 2134835688) is%(around(0.01)) 280.88 end -fun age-on-venus(): - check "age on Venus": - on-planet("Venus", 189839836) is%(around(0.01)) 9.78 - end +check "age on Venus": + on-planet("Venus", 189839836) is%(around(0.01)) 9.78 end -fun age-on-mars(): - check "age on Mars": - on-planet("Mars", 2129871239) is%(around(0.01)) 35.88 - end +check "age on Mars": + on-planet("Mars", 2129871239) is%(around(0.01)) 35.88 end -fun age-on-jupiter(): - check "age on Jupiter": - on-planet("Jupiter", 901876382) is%(around(0.01)) 2.41 - end +check "age on Jupiter": + on-planet("Jupiter", 901876382) is%(around(0.01)) 2.41 end -fun age-on-saturn(): - check "age on Saturn": - on-planet("Saturn", 2000000000) is%(around(0.01)) 2.15 - end +check "age on Saturn": + on-planet("Saturn", 2000000000) is%(around(0.01)) 2.15 end -fun age-on-uranus(): - check "age on Uranus": - on-planet("Uranus", 1210123456) is%(around(0.01)) 0.46 - end +check "age on Uranus": + on-planet("Uranus", 1210123456) is%(around(0.01)) 0.46 end -fun age-on-neptune(): - check "age on Neptune": - on-planet("Neptune", 1821023456) is%(around(0.01)) 0.35 - end +check "age on Neptune": + on-planet("Neptune", 1821023456) is%(around(0.01)) 0.35 end -fun invalid-planet-causes-error(): - check "invalid planet causes error": - on-planet("Sun", 680804807) raises "not a planet" - end +check "invalid planet causes error": + on-planet("Sun", 680804807) raises "not a planet" end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(age-on-earth, true), - test(age-on-mercury, false), - test(age-on-venus, false), - test(age-on-mars, false), - test(age-on-jupiter, false), - test(age-on-saturn, false), - test(age-on-uranus, false), - test(age-on-neptune, false), - test(invalid-planet-causes-error, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/space-age/space-age.arr b/exercises/practice/space-age/space-age.arr index ecb5f829..09ee2148 100644 --- a/exercises/practice/space-age/space-age.arr +++ b/exercises/practice/space-age/space-age.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: on-planet end diff --git a/exercises/practice/square-root/.meta/example.arr b/exercises/practice/square-root/.meta/example.arr index 03176a9f..f197a65e 100644 --- a/exercises/practice/square-root/.meta/example.arr +++ b/exercises/practice/square-root/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: square-root end diff --git a/exercises/practice/square-root/square-root-test.arr b/exercises/practice/square-root/square-root-test.arr index 05a4f3a5..da83fe7d 100644 --- a/exercises/practice/square-root/square-root-test.arr +++ b/exercises/practice/square-root/square-root-test.arr @@ -1,62 +1,27 @@ -use context essentials2020 +use context starter2024 include file("square-root.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun root-of-one(): - check "root of 1": - square-root(1) is 1 - end +check "root of 1": + square-root(1) is 1 end -fun root-of-four(): - check "root of 4": - square-root(4) is 2 - end +check "root of 4": + square-root(4) is 2 end -fun root-of-twenty-five(): - check "root of 25": - square-root(25) is 5 - end +check "root of 25": + square-root(25) is 5 end -fun root-of-eighty-one(): - check "root of 81": - square-root(81) is 9 - end +check "root of 81": + square-root(81) is 9 end -fun root-of-one-hundred-ninety-six(): - check "root of 196": - square-root(196) is 14 - end +check "root of 196": + square-root(196) is 14 end -fun root-of-sixty-five-thousand-twenty-five(): - check "root of 65025": - square-root(65025) is 255 - end +check "root of 65025": + square-root(65025) is 255 end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(root-of-one, true), - test(root-of-four, false), - test(root-of-twenty-five, false), - test(root-of-eighty-one, false), - test(root-of-one-hundred-ninety-six, false), - test(root-of-sixty-five-thousand-twenty-five, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/square-root/square-root.arr b/exercises/practice/square-root/square-root.arr index 560cbb33..ef522828 100644 --- a/exercises/practice/square-root/square-root.arr +++ b/exercises/practice/square-root/square-root.arr @@ -1,7 +1,7 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: square-root end fun square-root(number): raise("Please implement the square-root function") -end \ No newline at end of file +end diff --git a/exercises/practice/strain/.meta/example.arr b/exercises/practice/strain/.meta/example.arr index 02f8e256..88c14c7e 100644 --- a/exercises/practice/strain/.meta/example.arr +++ b/exercises/practice/strain/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: keep, discard end diff --git a/exercises/practice/strain/strain-test.arr b/exercises/practice/strain/strain-test.arr index efd4eada..0f057ba6 100644 --- a/exercises/practice/strain/strain-test.arr +++ b/exercises/practice/strain/strain-test.arr @@ -1,199 +1,140 @@ -use context essentials2020 +use context starter2024 include file("strain.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# +check "keep on empty list returns empty list": + input = [list: ] + predicate = lam(elt): true end + expected = [list: ] -fun keep-on-empty-list-returns-empty-list(): - check "keep on empty list returns empty list": - input = [list: ] - predicate = lam(elt): true end - expected = [list: ] - - keep(input, predicate) is expected - end + keep(input, predicate) is expected end -fun keeps-everything(): - check "keeps everything": - input = [list: 1, 3, 5] - predicate = lam(elt): true end - expected = [list: 1, 3, 5] +check "keeps everything": + input = [list: 1, 3, 5] + predicate = lam(elt): true end + expected = [list: 1, 3, 5] - keep(input, predicate) is expected - end + keep(input, predicate) is expected end -fun keeps-nothing(): - check "keeps nothing": - input = [list: 1, 3, 5] - predicate = lam(elt): false end - expected = [list: ] +check "keeps nothing": + input = [list: 1, 3, 5] + predicate = lam(elt): false end + expected = [list: ] - keep(input, predicate) is expected - end + keep(input, predicate) is expected end -fun keeps-edges(): - check "keeps first and last": - input = [list: 1, 2, 3] - predicate = lam(elt): num-modulo(elt, 2) == 1 end - expected = [list: 1, 3] +check "keeps first and last": + input = [list: 1, 2, 3] + predicate = lam(elt): num-modulo(elt, 2) == 1 end + expected = [list: 1, 3] - keep(input, predicate) is expected - end + keep(input, predicate) is expected end -fun keeps-middle(): - check "keeps neither first nor last": - input = [list: 1, 2, 3] - predicate = lam(elt): num-modulo(elt, 2) == 0 end - expected = [list: 2] +check "keeps neither first nor last": + input = [list: 1, 2, 3] + predicate = lam(elt): num-modulo(elt, 2) == 0 end + expected = [list: 2] - keep(input, predicate) is expected - end + keep(input, predicate) is expected end -fun keeps-strings(): - check "keeps strings": - input = [list: "apple", "zebra", "banana", "zombies", "cherimoya", "zealot"] - predicate = lam(elt): string-char-at(elt, 0) ^ string-equal(_, "z") end - expected = [list: "zebra", "zombies", "zealot"] +check "keeps strings": + input = [list: "apple", "zebra", "banana", "zombies", "cherimoya", "zealot"] + predicate = lam(elt): string-char-at(elt, 0) ^ string-equal(_, "z") end + expected = [list: "zebra", "zombies", "zealot"] - keep(input, predicate) is expected - end + keep(input, predicate) is expected end -fun keeps-lists(): - check "keeps lists": - input = [list: - [list: 1, 2, 3], - [list: 5, 5, 5], - [list: 5, 1, 2], - [list: 2, 1, 2], - [list: 1, 5, 2], - [list: 2, 2, 1], - [list: 1, 2, 5]] - - predicate = lam(elt): elt.member(5) end - - expected = [list: - [list: 5, 5, 5], - [list: 5, 1, 2], - [list: 1, 5, 2], - [list: 1, 2, 5]] - - keep(input, predicate) is expected - end +check "keeps lists": + input = [list: + [list: 1, 2, 3], + [list: 5, 5, 5], + [list: 5, 1, 2], + [list: 2, 1, 2], + [list: 1, 5, 2], + [list: 2, 2, 1], + [list: 1, 2, 5]] + + predicate = lam(elt): elt.member(5) end + + expected = [list: + [list: 5, 5, 5], + [list: 5, 1, 2], + [list: 1, 5, 2], + [list: 1, 2, 5]] + + keep(input, predicate) is expected end -fun discard-on-empty-list-returns-empty-list(): - check "discard on empty list returns empty list": - input = [list: ] - predicate = lam(elt): true end - expected = [list: ] +check "discard on empty list returns empty list": + input = [list: ] + predicate = lam(elt): true end + expected = [list: ] - discard(input, predicate) is expected - end + discard(input, predicate) is expected end -fun discards-everything(): - check "discards everything": - input = [list: 1, 3, 5] - predicate = lam(elt): true end - expected = [list: ] +check "discards everything": + input = [list: 1, 3, 5] + predicate = lam(elt): true end + expected = [list: ] - discard(input, predicate) is expected - end + discard(input, predicate) is expected end -fun discards-nothing(): - check "discards nothing": - input = [list: 1, 3, 5] - predicate = lam(elt): false end - expected = [list: 1, 3, 5] +check "discards nothing": + input = [list: 1, 3, 5] + predicate = lam(elt): false end + expected = [list: 1, 3, 5] - discard(input, predicate) is expected - end + discard(input, predicate) is expected end -fun discards-edges(): - check "discards first and last": - input = [list: 1, 2, 3] - predicate = lam(elt): num-modulo(elt, 2) == 1 end - expected = [list: 2] +check "discards first and last": + input = [list: 1, 2, 3] + predicate = lam(elt): num-modulo(elt, 2) == 1 end + expected = [list: 2] - discard(input, predicate) is expected - end + discard(input, predicate) is expected end -fun discards-middle(): - check "discards neither first nor last": - input = [list: 1, 2, 3] - predicate = lam(elt): num-modulo(elt, 2) == 0 end - expected = [list: 1, 3] +check "discards neither first nor last": + input = [list: 1, 2, 3] + predicate = lam(elt): num-modulo(elt, 2) == 0 end + expected = [list: 1, 3] - discard(input, predicate) is expected - end + discard(input, predicate) is expected end -fun discards-strings(): - check "discards strings": - input = [list: "apple", "zebra", "banana", "zombies", "cherimoya", "zealot"] - predicate = lam(elt): string-char-at(elt, 0) ^ string-equal(_, "z") end - expected = [list: "apple", "banana", "cherimoya"] +check "discards strings": + input = [list: "apple", "zebra", "banana", "zombies", "cherimoya", "zealot"] + predicate = lam(elt): string-char-at(elt, 0) ^ string-equal(_, "z") end + expected = [list: "apple", "banana", "cherimoya"] - discard(input, predicate) is expected - end + discard(input, predicate) is expected end -fun discards-lists(): - check "discards lists": - input = [list: - [list: 1, 2, 3], - [list: 5, 5, 5], - [list: 5, 1, 2], - [list: 2, 1, 2], - [list: 1, 5, 2], - [list: 2, 2, 1], - [list: 1, 2, 5]] - - predicate = lam(elt): elt.member(5) end - - expected = [list: - [list: 1, 2, 3], - [list: 2, 1, 2], - [list: 2, 2, 1]] - - discard(input, predicate) is expected - end -end +check "discards lists": + input = [list: + [list: 1, 2, 3], + [list: 5, 5, 5], + [list: 5, 1, 2], + [list: 2, 1, 2], + [list: 1, 5, 2], + [list: 2, 2, 1], + [list: 1, 2, 5]] + + predicate = lam(elt): elt.member(5) end -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(keep-on-empty-list-returns-empty-list, true), - test(keeps-everything, false), - test(keeps-nothing, false), - test(keeps-edges, false), - test(keeps-middle, false), - test(keeps-strings, false), - test(keeps-lists, false), - test(discard-on-empty-list-returns-empty-list, false), - test(discards-everything, false), - test(discards-nothing, false), - test(discards-edges, false), - test(discards-middle, false), - test(discards-strings, false), - test(discards-lists, false) -].each(lam(t): when t.active: t.run() end end) + expected = [list: + [list: 1, 2, 3], + [list: 2, 1, 2], + [list: 2, 2, 1]] + + discard(input, predicate) is expected +end diff --git a/exercises/practice/strain/strain.arr b/exercises/practice/strain/strain.arr index 704390d8..547f2d62 100644 --- a/exercises/practice/strain/strain.arr +++ b/exercises/practice/strain/strain.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: keep, discard end diff --git a/exercises/practice/triangle/.meta/example.arr b/exercises/practice/triangle/.meta/example.arr index b6cff924..32c7820d 100644 --- a/exercises/practice/triangle/.meta/example.arr +++ b/exercises/practice/triangle/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: equilateral, isosceles, scalene end diff --git a/exercises/practice/triangle/triangle-test.arr b/exercises/practice/triangle/triangle-test.arr index 590e7416..4833f7e9 100644 --- a/exercises/practice/triangle/triangle-test.arr +++ b/exercises/practice/triangle/triangle-test.arr @@ -1,167 +1,87 @@ -use context essentials2020 +use context starter2024 include file("triangle.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun equilateral-all-equal-sides(): - check "equilateral triangle -> all sides are equal": - equilateral([list: 2, 2, 2]) is true - end +check "equilateral triangle -> all sides are equal": + equilateral([list: 2, 2, 2]) is true end -fun equilateral-any-unequal-side(): - check "equilateral triangle -> any side is unequal": - equilateral([list: 2, 3, 2]) is false - end +check "equilateral triangle -> any side is unequal": + equilateral([list: 2, 3, 2]) is false end -fun equilateral-no-equal-sides(): - check "equilateral triangle -> no sides are equal": - equilateral([list: 5, 4, 6]) is false - end +check "equilateral triangle -> no sides are equal": + equilateral([list: 5, 4, 6]) is false end -fun equilateral-all-zero-sides(): - check "equilateral triangle -> all zero sides is not a triangle": - equilateral([list: 0, 0, 0]) is false - end +check "equilateral triangle -> all zero sides is not a triangle": + equilateral([list: 0, 0, 0]) is false end -fun equilateral-decimal-sides(): - check "equilateral triangle -> sides may be decimals": - equilateral([list: 0.5, 0.5, 0.5]) is true - end +check "equilateral triangle -> sides may be decimals": + equilateral([list: 0.5, 0.5, 0.5]) is true end -fun isosceles-second-third-equal-sides(): - check "isosceles triangle -> last two sides are equal": - isosceles([list: 3, 4, 4]) is true - end +check "isosceles triangle -> last two sides are equal": + isosceles([list: 3, 4, 4]) is true end -fun isosceles-first-second-equal-sides(): - check "isosceles triangle -> first two sides are equal": - isosceles([list: 4, 4, 3]) is true - end +check "isosceles triangle -> first two sides are equal": + isosceles([list: 4, 4, 3]) is true end -fun isosceles-first-third-equal-sides(): - check "isosceles triangle -> first and last sides are equal": - isosceles([list: 4, 3, 4]) is true - end +check "isosceles triangle -> first and last sides are equal": + isosceles([list: 4, 3, 4]) is true end -fun isosceles-can-be-equilateral(): - check "isosceles triangle -> equilateral triangles are also isosceles": - isosceles([list: 4, 4, 4]) is true - end +check "isosceles triangle -> equilateral triangles are also isosceles": + isosceles([list: 4, 4, 4]) is true end -fun isosceles-no-equal-sides(): - check "isosceles triangle -> no sides are equal": - isosceles([list: 2, 3, 4]) is false - end +check "isosceles triangle -> no sides are equal": + isosceles([list: 2, 3, 4]) is false end -fun isosceles-triangle-inequality-first(): - check "isosceles triangle -> first triangle inequality violation": - isosceles([list: 1, 1, 3]) is false - end +check "isosceles triangle -> first triangle inequality violation": + isosceles([list: 1, 1, 3]) is false end -fun isosceles-triangle-inequality-second(): - check "isosceles triangle -> second triangle inequality violation": - isosceles([list: 1, 3, 1]) is false - end +check "isosceles triangle -> second triangle inequality violation": + isosceles([list: 1, 3, 1]) is false end -fun isosceles-triangle-inequality-third(): - check "isosceles triangle -> third triangle inequality violation": - isosceles([list: 3, 1, 1]) is false - end +check "isosceles triangle -> third triangle inequality violation": + isosceles([list: 3, 1, 1]) is false end -fun isosceles-decimal-sides(): - check "isosceles triangle -> sides may be decimasl": - isosceles([list: 0.5, 0.4, 0.5]) is true - end +check "isosceles triangle -> sides may be decimasl": + isosceles([list: 0.5, 0.4, 0.5]) is true end -fun scalene-no-equal-sides(): - check "scalene triangle -> no sides are equal": - scalene([list: 5, 4, 6]) is true - end +check "scalene triangle -> no sides are equal": + scalene([list: 5, 4, 6]) is true end -fun scalene-all-equal-sides(): - check "scalene triangle -> all sides are equal": - scalene([list: 4, 4, 4]) is false - end +check "scalene triangle -> all sides are equal": + scalene([list: 4, 4, 4]) is false end -fun scalene-first-second-equal-sides(): - check "scalene triangle -> first and second sides are equal": - scalene([list: 4, 4, 3]) is false - end +check "scalene triangle -> first and second sides are equal": + scalene([list: 4, 4, 3]) is false end -fun scalene-first-third-equal-sides(): - check "scalene triangle -> first and third sides are equal": - scalene([list: 3, 4, 3]) is false - end +check "scalene triangle -> first and third sides are equal": + scalene([list: 3, 4, 3]) is false end -fun scalene-second-third-equal-sides(): - check "scalene triangle -> second and third sides are equal": - scalene([list: 4, 3, 3]) is false - end +check "scalene triangle -> second and third sides are equal": + scalene([list: 4, 3, 3]) is false end -fun scalene-triangle-inequality(): - check "scalene triangle -> may not violate triangle inequality": - scalene([list: 7, 3, 2]) is false - end +check "scalene triangle -> may not violate triangle inequality": + scalene([list: 7, 3, 2]) is false end -fun scalene-decimal-sides(): - check "scalene triangle -> sides may be decimals": - scalene([list: 0.5, 0.4, 0.6]) is true - end +check "scalene triangle -> sides may be decimals": + scalene([list: 0.5, 0.4, 0.6]) is true end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(equilateral-all-equal-sides, true), - test(equilateral-any-unequal-side, false), - test(equilateral-no-equal-sides, false), - test(equilateral-all-zero-sides, false), - test(equilateral-decimal-sides, false), - test(isosceles-second-third-equal-sides, false), - test(isosceles-first-second-equal-sides, false), - test(isosceles-first-third-equal-sides, false), - test(isosceles-can-be-equilateral, false), - test(isosceles-no-equal-sides, false), - test(isosceles-triangle-inequality-first, false), - test(isosceles-triangle-inequality-second, false), - test(isosceles-triangle-inequality-third, false), - test(isosceles-decimal-sides, false), - test(scalene-no-equal-sides, false), - test(scalene-all-equal-sides, false), - test(scalene-first-second-equal-sides, false), - test(scalene-first-third-equal-sides, false), - test(scalene-second-third-equal-sides, false), - test(scalene-triangle-inequality, false), - test(scalene-decimal-sides, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/triangle/triangle.arr b/exercises/practice/triangle/triangle.arr index 948e4403..802a4c3c 100644 --- a/exercises/practice/triangle/triangle.arr +++ b/exercises/practice/triangle/triangle.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: equilateral, isosceles, scalene end diff --git a/exercises/practice/two-fer/.meta/example.arr b/exercises/practice/two-fer/.meta/example.arr index 7d1fde3c..2823a86a 100644 --- a/exercises/practice/two-fer/.meta/example.arr +++ b/exercises/practice/two-fer/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: two-fer end diff --git a/exercises/practice/two-fer/two-fer-test.arr b/exercises/practice/two-fer/two-fer-test.arr index 8039690a..542ed7fb 100644 --- a/exercises/practice/two-fer/two-fer-test.arr +++ b/exercises/practice/two-fer/two-fer-test.arr @@ -1,41 +1,15 @@ -use context essentials2020 +use context starter2024 include file("two-fer.arr") -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun no-name-given(): - check "no name given": - two-fer("") is "One for you, one for me." - end +check "no name given": + two-fer("") is "One for you, one for me." end -fun a-name-given(): - check "a name given": - two-fer("Alice") is "One for Alice, one for me." - end +check "a name given": + two-fer("Alice") is "One for Alice, one for me." end -fun another-name-given(): - check "another name given": - two-fer("Bob") is "One for Bob, one for me." - end +check "another name given": + two-fer("Bob") is "One for Bob, one for me." end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(no-name-given, true), - test(a-name-given, false), - test(another-name-given, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/two-fer/two-fer.arr b/exercises/practice/two-fer/two-fer.arr index 1328fe22..77b627e2 100644 --- a/exercises/practice/two-fer/two-fer.arr +++ b/exercises/practice/two-fer/two-fer.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: two-fer end diff --git a/exercises/practice/word-count/.meta/example.arr b/exercises/practice/word-count/.meta/example.arr index e99279d1..df854ccc 100644 --- a/exercises/practice/word-count/.meta/example.arr +++ b/exercises/practice/word-count/.meta/example.arr @@ -1,4 +1,4 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: word-count end @@ -57,4 +57,4 @@ fun word-count(phrase): end end, [string-dict: ]) -end \ No newline at end of file +end diff --git a/exercises/practice/word-count/word-count-test.arr b/exercises/practice/word-count/word-count-test.arr index a6cde28c..8957dd01 100644 --- a/exercises/practice/word-count/word-count-test.arr +++ b/exercises/practice/word-count/word-count-test.arr @@ -1,189 +1,130 @@ -use context essentials2020 +use context starter2024 include file("word-count.arr") include string-dict -#| - When working offline, all tests except the first one are skipped by default. - Once you get the first test running, unskip the next one until all tests pass locally. - Check the block comment below for further details. -|# - -fun count-one-word(): - check "count one word": - input = "word" - expected = [string-dict: "word", 1] - - word-count(input) is expected - end +check "count one word": + input = "word" + expected = [string-dict: "word", 1] + + word-count(input) is expected end -fun count-one-of-each-word(): - check "count one of each word": - input = "one of each" - expected = [string-dict: "one", 1, "of", 1, "each", 1] - - word-count(input) is expected - end +check "count one of each word": + input = "one of each" + expected = [string-dict: "one", 1, "of", 1, "each", 1] + + word-count(input) is expected end -fun multiple-occurences-of-word(): - check "multiple occurrences of a word": - input = "one fish two fish red fish blue fish" - expected = [string-dict: "one", 1, "fish", 4, "two", 1, "red", 1, "blue", 1] - - word-count(input) is expected - end +check "multiple occurrences of a word": + input = "one fish two fish red fish blue fish" + expected = [string-dict: "one", 1, "fish", 4, "two", 1, "red", 1, "blue", 1] + + word-count(input) is expected end -fun handle-cramped-lists(): - check "handles cramped lists": - input = "one,two,three" - expected = [string-dict: "one", 1, "two", 1, "three", 1] - - word-count(input) is expected - end +check "handles cramped lists": + input = "one,two,three" + expected = [string-dict: "one", 1, "two", 1, "three", 1] + + word-count(input) is expected end -fun handle-expanded-lists(): - check "handles expanded lists": - input = "one,\ntwo,\nthree" - expected = [string-dict: "one", 1, "two", 1, "three", 1] - - word-count(input) is expected - end +check "handles expanded lists": + input = "one,\ntwo,\nthree" + expected = [string-dict: "one", 1, "two", 1, "three", 1] + + word-count(input) is expected end -fun ignore-punctuation(): - check "ignore punctuation": - input = "car: carpet as java: javascript!!&@$%^&" - expected = [string-dict: - "car", 1, - "carpet", 1, - "as", 1, - "java", 1, - "javascript", 1] - - word-count(input) is expected - end +check "ignore punctuation": + input = "car: carpet as java: javascript!!&@$%^&" + expected = [string-dict: + "car", 1, + "carpet", 1, + "as", 1, + "java", 1, + "javascript", 1] + + word-count(input) is expected end -fun include-numbers(): - check "include numbers": - input = "testing, 1, 2 testing" - expected = [string-dict: "testing", 2, "1", 1, "2", 1] - - word-count(input) is expected - end +check "include numbers": + input = "testing, 1, 2 testing" + expected = [string-dict: "testing", 2, "1", 1, "2", 1] + + word-count(input) is expected end -fun normalize-case(): - check "normalize case": - input = "go Go GO Stop stop" - expected = [string-dict: "go", 3, "stop", 2] - - word-count(input) is expected - end +check "normalize case": + input = "go Go GO Stop stop" + expected = [string-dict: "go", 3, "stop", 2] + + word-count(input) is expected end -fun with-apostrophes(): - check "with apostrophes": - input = "'First: don't laugh. Then: don't cry. You're getting it.'" - expected = [string-dict: - "first", 1, - "don't", 2, - "laugh", 1, - "then", 1, - "cry", 1, - "you're", 1, - "getting", 1, - "it", 1] - - word-count(input) is expected - end +check "with apostrophes": + input = "'First: don't laugh. Then: don't cry. You're getting it.'" + expected = [string-dict: + "first", 1, + "don't", 2, + "laugh", 1, + "then", 1, + "cry", 1, + "you're", 1, + "getting", 1, + "it", 1] + + word-count(input) is expected end -fun with-quotations(): - check "with quotations": - input = "Joe can't tell between 'large' and large." - expected = [string-dict: - "joe", 1, - "can't", 1, - "tell", 1, - "between", 1, - "large", 2, - "and", 1] - - word-count(input) is expected - end +check "with quotations": + input = "Joe can't tell between 'large' and large." + expected = [string-dict: + "joe", 1, + "can't", 1, + "tell", 1, + "between", 1, + "large", 2, + "and", 1] + + word-count(input) is expected end -fun substrings-from-the-beginning(): - check "substrings from the beginning": - input = "Joe can't tell between app, apple and a." - expected = [string-dict: - "joe", 1, - "can't", 1, - "tell", 1, - "between", 1, - "app", 1, - "apple", 1, - "and", 1, - "a", 1] - - word-count(input) is expected - end +check "substrings from the beginning": + input = "Joe can't tell between app, apple and a." + expected = [string-dict: + "joe", 1, + "can't", 1, + "tell", 1, + "between", 1, + "app", 1, + "apple", 1, + "and", 1, + "a", 1] + + word-count(input) is expected end -fun multiple-spaces-not-a-word(): - check "multiple spaces not detected as a word": - input = " multiple whitespaces" - expected = [string-dict: "multiple", 1, "whitespaces", 1] - - word-count(input) is expected - end +check "multiple spaces not detected as a word": + input = " multiple whitespaces" + expected = [string-dict: "multiple", 1, "whitespaces", 1] + + word-count(input) is expected end -fun alternating-word-separators-not-a-word(): - check "alternating word separators not detected as a word": - input = ",\n,one,\n ,two \n 'three'" - expected = [string-dict: "one", 1, "two", 1, "three", 1] - - word-count(input) is expected - end +check "alternating word separators not detected as a word": + input = ",\n,one,\n ,two \n 'three'" + expected = [string-dict: "one", 1, "two", 1, "three", 1] + + word-count(input) is expected end -fun quotation-for-word-with-apostrophe(): - check "quotation for word with apostrophe": - input = "can, can't, 'can't'" - expected = [string-dict: "can", 1, "can't", 2] +check "quotation for word with apostrophe": + input = "can, can't, 'can't'" + expected = [string-dict: "can", 1, "can't", 2] - word-count(input) is expected - end + word-count(input) is expected end - -#| - Code to run each test. Each line corresponds to a test above and whether it should be run. - To mark a test to be run, replace `false` with `true` on that same line after the comma. - test(test-a, true) will be run. test(test-a, false) will be skipped. -|# - -data TestRun: test(run, active) end - -[list: - test(count-one-word, true), - test(count-one-of-each-word, false), - test(multiple-occurences-of-word, false), - test(handle-cramped-lists, false), - test(handle-expanded-lists, false), - test(ignore-punctuation, false), - test(include-numbers, false), - test(normalize-case, false), - test(with-apostrophes, false), - test(with-quotations, false), - test(substrings-from-the-beginning, false), - test(multiple-spaces-not-a-word, false), - test(alternating-word-separators-not-a-word, false), - test(quotation-for-word-with-apostrophe, false) -].each(lam(t): when t.active: t.run() end end) diff --git a/exercises/practice/word-count/word-count.arr b/exercises/practice/word-count/word-count.arr index 67795327..2f47a44a 100644 --- a/exercises/practice/word-count/word-count.arr +++ b/exercises/practice/word-count/word-count.arr @@ -1,7 +1,7 @@ -use context essentials2020 # Don't delete this line when using Pyret on Exercism +use context starter2024 provide: word-count end fun word-count(phrase): raise("please implement the word-count function") -end \ No newline at end of file +end diff --git a/exercises/shared/.docs/tests.md b/exercises/shared/.docs/tests.md index 9162ed86..15ca76a7 100644 --- a/exercises/shared/.docs/tests.md +++ b/exercises/shared/.docs/tests.md @@ -13,15 +13,5 @@ Cleaning up and generating standalone... Looks shipshape, all 9 tests passed, mate! ``` -Windows - -```powershell -PS C:\Users\foobar> cd {path\to\exercise-folder-location} -PS C:\Users\foobar\Exercism\pyret\exercise> pyret {exercise-test.arr} -2/2 modules compiled ({exercise-test.arr}) -Cleaning up and generating standalone... -Looks shipshape, all 9 tests passed, mate! -``` - [testing-docs]: https://pyret.org/docs/latest/testing.html [pyret-npm]: https://www.npmjs.com/package/pyret-npm diff --git a/package-lock.json b/package-lock.json index ccb88b39..72777e35 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,13 +7,26 @@ "name": "@exercism/pyret", "license": "MIT", "dependencies": { - "pyret-npm": "^0.0.27" + "pyret-npm": "^0.0.90" } }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "license": "MIT" + }, + "node_modules/@types/geojson": { + "version": "7946.0.16", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz", + "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", + "license": "MIT" + }, "node_modules/ansi-regex": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "license": "MIT", "engines": { "node": ">=4" } @@ -22,6 +35,7 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "license": "MIT", "dependencies": { "color-convert": "^1.9.0" }, @@ -33,19 +47,97 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==", + "license": "MIT", "engines": { "node": ">=6" } }, + "node_modules/ascii-table": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/ascii-table/-/ascii-table-0.0.9.tgz", + "integrity": "sha512-xpkr6sCDIYTPqzvjG8M3ncw1YOTaloWZOyrUmicoEifBEKzQzt+ooUpRpQ/AbOoJfO/p2ZKiyp79qHThzJDulQ==", + "license": "MIT" + }, "node_modules/async-limiter": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/canvas": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/canvas/-/canvas-3.2.2.tgz", + "integrity": "sha512-duEt4h1HHu9sJZyVKfLRXR6tsKPY7cEELzxSRJkwddOXYvQT3P/+es98SV384JA0zMOZ5s+9gatnGfM6sL4Drg==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-addon-api": "^7.0.0", + "prebuild-install": "^7.1.3" + }, + "engines": { + "node": "^18.12.0 || >= 20.9.0" + } }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "license": "MIT", "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -55,10 +147,17 @@ "node": ">=4" } }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "license": "ISC" + }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "license": "MIT", "dependencies": { "color-name": "1.1.3" } @@ -66,12 +165,14 @@ "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "license": "MIT" }, "node_modules/command-line-args": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz", "integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==", + "license": "MIT", "dependencies": { "array-back": "^3.1.0", "find-replace": "^3.0.0", @@ -86,6 +187,7 @@ "version": "5.0.5", "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-5.0.5.tgz", "integrity": "sha512-d8NrGylA5oCXSbGoKz05FkehDAzSmIm4K03S5VDh4d5lZAtTWfc3D1RuETtuQCn8129nYfJfDdF7P/lwcz1BlA==", + "license": "MIT", "dependencies": { "array-back": "^2.0.0", "chalk": "^2.4.1", @@ -100,6 +202,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", + "license": "MIT", "dependencies": { "typical": "^2.6.1" }, @@ -110,28 +213,328 @@ "node_modules/command-line-usage/node_modules/typical": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha512-ofhi8kjIje6npGozTip9Fr8iecmYfEbS06i0JnIg+rh51KakryWF4+jX8lLKZVhy6N+ID45WYSFCxPOdTWCzNg==" + "integrity": "sha512-ofhi8kjIje6npGozTip9Fr8iecmYfEbS06i0JnIg+rh51KakryWF4+jX8lLKZVhy6N+ID45WYSFCxPOdTWCzNg==", + "license": "MIT" + }, + "node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "license": "ISC", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-delaunay": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.4.tgz", + "integrity": "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==", + "license": "ISC", + "dependencies": { + "delaunator": "5" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dsv": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-3.0.1.tgz", + "integrity": "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==", + "license": "ISC", + "dependencies": { + "commander": "7", + "iconv-lite": "0.6", + "rw": "1" + }, + "bin": { + "csv2json": "bin/dsv2json.js", + "csv2tsv": "bin/dsv2dsv.js", + "dsv2dsv": "bin/dsv2dsv.js", + "dsv2json": "bin/dsv2json.js", + "json2csv": "bin/json2dsv.js", + "json2dsv": "bin/json2dsv.js", + "json2tsv": "bin/json2dsv.js", + "tsv2csv": "bin/dsv2dsv.js", + "tsv2json": "bin/dsv2json.js" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-force": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz", + "integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==", + "license": "ISC", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-quadtree": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz", + "integrity": "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-geo": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.1.tgz", + "integrity": "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q==", + "license": "ISC", + "dependencies": { + "d3-array": "2.5.0 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-geo-projection": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/d3-geo-projection/-/d3-geo-projection-4.0.0.tgz", + "integrity": "sha512-p0bK60CEzph1iqmnxut7d/1kyTmm3UWtPlwdkM31AU+LW+BXazd5zJdoCn7VFxNCHXRngPHRnsNn5uGjLRGndg==", + "license": "ISC", + "dependencies": { + "commander": "7", + "d3-array": "1 - 3", + "d3-geo": "1.12.0 - 3" + }, + "bin": { + "geo2svg": "bin/geo2svg.js", + "geograticule": "bin/geograticule.js", + "geoproject": "bin/geoproject.js", + "geoquantize": "bin/geoquantize.js", + "geostitch": "bin/geostitch.js" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-quadtree": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", + "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "license": "ISC", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale-chromatic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz", + "integrity": "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3", + "d3-interpolate": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "license": "ISC", + "dependencies": { + "d3-path": "^3.1.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "license": "ISC", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "license": "ISC", + "dependencies": { + "d3-time": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "license": "MIT", "engines": { "node": ">=4.0.0" } }, + "node_modules/delaunator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.1.0.tgz", + "integrity": "sha512-AGrQ4QSgssa1NGmWmLPqN5NY2KajF5MqxetNEO+o0n3ZwZZeTmt7bBnvzHWrmkZFxGgr4HdyFgelzgi06otLuQ==", + "license": "ISC", + "dependencies": { + "robust-predicates": "^3.0.2" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", "engines": { "node": ">=0.8.0" } }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "license": "(MIT OR WTFPL)", + "engines": { + "node": ">=6" + } + }, "node_modules/find-replace": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==", + "license": "MIT", "dependencies": { "array-back": "^3.0.1" }, @@ -139,28 +542,145 @@ "node": ">=4.0.0" } }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "license": "MIT" + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "license": "MIT" + }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "license": "MIT", "engines": { "node": ">=4" } }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "license": "ISC" + }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/lodash.camelcase": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "license": "MIT" }, "node_modules/lodash.padend": { "version": "4.6.1", "resolved": "https://registry.npmjs.org/lodash.padend/-/lodash.padend-4.6.1.tgz", - "integrity": "sha512-sOQs2aqGpbl27tmCS1QNZA09Uqp01ZzWfDUoD+xzTii0E7dSQfRKcRetFwa+uXaxaqL+TKm7CgD2JdKP7aZBSw==" + "integrity": "sha512-sOQs2aqGpbl27tmCS1QNZA09Uqp01ZzWfDUoD+xzTii0E7dSQfRKcRetFwa+uXaxaqL+TKm7CgD2JdKP7aZBSw==", + "license": "MIT" + }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/minimist": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -169,6 +689,7 @@ "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "license": "MIT", "dependencies": { "minimist": "^1.2.6" }, @@ -176,33 +697,275 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "license": "MIT" + }, + "node_modules/napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", + "license": "MIT" + }, + "node_modules/node-abi": { + "version": "3.89.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.89.0.tgz", + "integrity": "sha512-6u9UwL0HlAl21+agMN3YAMXcKByMqwGx+pq+P76vii5f7hTPtKDp08/H9py6DY+cfDw7kQNTGEj/rly3IgbNQA==", + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-addon-api": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", + "license": "MIT" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "license": "MIT" + }, + "node_modules/prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "deprecated": "No longer maintained. Please contact the author of the relevant native addon; alternatives are available.", + "license": "MIT", + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pump": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", + "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "node_modules/pyret-npm": { - "version": "0.0.27", - "resolved": "https://registry.npmjs.org/pyret-npm/-/pyret-npm-0.0.27.tgz", - "integrity": "sha512-fpphKd/OKnoXdSMkKVkL2UHxjDjqlREHAmHX0Wp/qnYxlwiEzIP7Ai72m7TZpy4PfN9K+uGlUredIEBH6zXCAQ==", + "version": "0.0.90", + "resolved": "https://registry.npmjs.org/pyret-npm/-/pyret-npm-0.0.90.tgz", + "integrity": "sha512-1qpmlR5cb9d8fjfv8ma0a+jUH8U+UPoxYMyqPmn0UvRPI4X56OGxuvSLDxh1Qz5+4sRb5AxNK+jNly8YJ/Arvw==", + "license": "Apache-2.0", "dependencies": { + "ascii-table": "^0.0.9", + "canvas": "^3.1.0", "command-line-args": "^5.0.2", "command-line-usage": "^5.0.5", "mkdirp": "^0.5.1", + "resolve": "^1.22.10", "strip-ansi": "^4.0.0", + "vega": "^6.1.2", "ws": "^5.2.1" }, "bin": { "pyret": "pyret.js" } }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/reduce-flatten": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-1.0.1.tgz", "integrity": "sha512-j5WfFJfc9CoXv/WbwVLHq74i/hdTUpy+iNC534LxczMRP67vJeK3V9JOdnL0N1cIRbn9mYhE2yVjvvKXDxvNXQ==", + "license": "MIT", "engines": { "node": ">=0.10.0" } }, + "node_modules/resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/robust-predicates": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.3.tgz", + "integrity": "sha512-NS3levdsRIUOmiJ8FZWCP7LG3QpJyrs/TE0Zpf1yvZu8cAJJ6QMW92H1c7kWpdIHo8RvmLxN/o2JXTKHp74lUA==", + "license": "Unlicense" + }, + "node_modules/rw": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", + "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==", + "license": "BSD-3-Clause" + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "license": "MIT", "dependencies": { "ansi-regex": "^3.0.0" }, @@ -210,10 +973,20 @@ "node": ">=4" } }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "license": "MIT", "dependencies": { "has-flag": "^3.0.0" }, @@ -221,10 +994,23 @@ "node": ">=4" } }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/table-layout": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-0.4.5.tgz", "integrity": "sha512-zTvf0mcggrGeTe/2jJ6ECkJHAQPIYEwDoqsiqBjI24mvRmQbInK5jq33fyypaCBxX08hMkfmdOqj6haT33EqWw==", + "license": "MIT", "dependencies": { "array-back": "^2.0.0", "deep-extend": "~0.6.0", @@ -240,6 +1026,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", + "license": "MIT", "dependencies": { "typical": "^2.6.1" }, @@ -250,20 +1037,465 @@ "node_modules/table-layout/node_modules/typical": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha512-ofhi8kjIje6npGozTip9Fr8iecmYfEbS06i0JnIg+rh51KakryWF4+jX8lLKZVhy6N+ID45WYSFCxPOdTWCzNg==" + "integrity": "sha512-ofhi8kjIje6npGozTip9Fr8iecmYfEbS06i0JnIg+rh51KakryWF4+jX8lLKZVhy6N+ID45WYSFCxPOdTWCzNg==", + "license": "MIT" + }, + "node_modules/tar-fs": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", + "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/topojson-client": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/topojson-client/-/topojson-client-3.1.0.tgz", + "integrity": "sha512-605uxS6bcYxGXw9qi62XyrV6Q3xwbndjachmNxu8HWTtVPxZfEJN9fd/SZS1Q54Sn2y0TMyMxFj/cJINqGHrKw==", + "license": "ISC", + "dependencies": { + "commander": "2" + }, + "bin": { + "topo2geo": "bin/topo2geo", + "topomerge": "bin/topomerge", + "topoquantize": "bin/topoquantize" + } + }, + "node_modules/topojson-client/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } }, "node_modules/typical": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", + "license": "MIT", "engines": { "node": ">=8" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/vega": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/vega/-/vega-6.2.0.tgz", + "integrity": "sha512-BIwalIcEGysJdQDjeVUmMWB3e50jPDNAMfLJscjEvpunU9bSt7X1OYnQxkg3uBwuRRI4nWfFZO9uIW910nLeGw==", + "license": "BSD-3-Clause", + "dependencies": { + "vega-crossfilter": "~5.1.0", + "vega-dataflow": "~6.1.0", + "vega-encode": "~5.1.0", + "vega-event-selector": "~4.0.0", + "vega-expression": "~6.1.0", + "vega-force": "~5.1.0", + "vega-format": "~2.1.0", + "vega-functions": "~6.1.0", + "vega-geo": "~5.1.0", + "vega-hierarchy": "~5.1.0", + "vega-label": "~2.1.0", + "vega-loader": "~5.1.0", + "vega-parser": "~7.1.0", + "vega-projection": "~2.1.0", + "vega-regression": "~2.1.0", + "vega-runtime": "~7.1.0", + "vega-scale": "~8.1.0", + "vega-scenegraph": "~5.1.0", + "vega-statistics": "~2.0.0", + "vega-time": "~3.1.0", + "vega-transforms": "~5.1.0", + "vega-typings": "~2.1.0", + "vega-util": "~2.1.0", + "vega-view": "~6.1.0", + "vega-view-transforms": "~5.1.0", + "vega-voronoi": "~5.1.0", + "vega-wordcloud": "~5.1.0" + }, + "funding": { + "url": "https://app.hubspot.com/payments/GyPC972GD9Rt" + } + }, + "node_modules/vega-canvas": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/vega-canvas/-/vega-canvas-2.0.0.tgz", + "integrity": "sha512-9x+4TTw/USYST5nx4yN272sy9WcqSRjAR0tkQYZJ4cQIeon7uVsnohvoPQK1JZu7K1QXGUqzj08z0u/UegBVMA==", + "license": "BSD-3-Clause" + }, + "node_modules/vega-crossfilter": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-crossfilter/-/vega-crossfilter-5.1.0.tgz", + "integrity": "sha512-EmVhfP3p6AM7o/lPan/QAoqjblI19BxWUlvl2TSs0xjQd8KbaYYbS4Ixt3cmEvl0QjRdBMF6CdJJ/cy9DTS4Fw==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "vega-dataflow": "^6.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-dataflow": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/vega-dataflow/-/vega-dataflow-6.1.0.tgz", + "integrity": "sha512-JxumGlODtFbzoQ4c/jQK8Tb/68ih0lrexlCozcMfTAwQ12XhTqCvlafh7MAKKTMBizjOfaQTHm4Jkyb1H5CfyQ==", + "license": "BSD-3-Clause", + "dependencies": { + "vega-format": "^2.1.0", + "vega-loader": "^5.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-encode": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-encode/-/vega-encode-5.1.0.tgz", + "integrity": "sha512-q26oI7B+MBQYcTQcr5/c1AMsX3FvjZLQOBi7yI0vV+GEn93fElDgvhQiYrgeYSD4Exi/jBPeUXuN6p4bLz16kA==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "d3-interpolate": "^3.0.1", + "vega-dataflow": "^6.1.0", + "vega-scale": "^8.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-event-selector": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/vega-event-selector/-/vega-event-selector-4.0.0.tgz", + "integrity": "sha512-CcWF4m4KL/al1Oa5qSzZ5R776q8lRxCj3IafCHs5xipoEHrkgu1BWa7F/IH5HrDNXeIDnqOpSV1pFsAWRak4gQ==", + "license": "BSD-3-Clause" + }, + "node_modules/vega-expression": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/vega-expression/-/vega-expression-6.1.0.tgz", + "integrity": "sha512-hHgNx/fQ1Vn1u6vHSamH7lRMsOa/yQeHGGcWVmh8fZafLdwdhCM91kZD9p7+AleNpgwiwzfGogtpATFaMmDFYg==", + "license": "BSD-3-Clause", + "dependencies": { + "@types/estree": "^1.0.8", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-force": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-force/-/vega-force-5.1.0.tgz", + "integrity": "sha512-wdnchOSeXpF9Xx8Yp0s6Do9F7YkFeOn/E/nENtsI7NOcyHpICJ5+UkgjUo9QaQ/Yu+dIDU+sP/4NXsUtq6SMaQ==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-force": "^3.0.0", + "vega-dataflow": "^6.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-format": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-format/-/vega-format-2.1.0.tgz", + "integrity": "sha512-i9Ht33IgqG36+S1gFDpAiKvXCPz+q+1vDhDGKK8YsgMxGOG4PzinKakI66xd7SdV4q97FgpR7odAXqtDN2wKqw==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "d3-format": "^3.1.0", + "d3-time-format": "^4.1.0", + "vega-time": "^3.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-functions": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/vega-functions/-/vega-functions-6.1.1.tgz", + "integrity": "sha512-Due6jP0y0FfsGMTrHnzUGnEwXPu7VwE+9relfo+LjL/tRPYnnKqwWvzt7n9JkeBuZqjkgYjMzm/WucNn6Hkw5A==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "d3-color": "^3.1.0", + "d3-geo": "^3.1.1", + "vega-dataflow": "^6.1.0", + "vega-expression": "^6.1.0", + "vega-scale": "^8.1.0", + "vega-scenegraph": "^5.1.0", + "vega-selections": "^6.1.0", + "vega-statistics": "^2.0.0", + "vega-time": "^3.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-geo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-geo/-/vega-geo-5.1.0.tgz", + "integrity": "sha512-H8aBBHfthc3rzDbz/Th18+Nvp00J73q3uXGAPDQqizioDm/CoXCK8cX4pMePydBY9S6ikBiGJrLKFDa80wI20g==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "d3-color": "^3.1.0", + "d3-geo": "^3.1.1", + "vega-canvas": "^2.0.0", + "vega-dataflow": "^6.1.0", + "vega-projection": "^2.1.0", + "vega-statistics": "^2.0.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-hierarchy": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-hierarchy/-/vega-hierarchy-5.1.0.tgz", + "integrity": "sha512-rZlU8QJNETlB6o73lGCPybZtw2fBBsRIRuFE77aCLFHdGsh6wIifhplVarqE9icBqjUHRRUOmcEYfzwVIPr65g==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-hierarchy": "^3.1.2", + "vega-dataflow": "^6.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-label": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-label/-/vega-label-2.1.0.tgz", + "integrity": "sha512-/hgf+zoA3FViDBehrQT42Lta3t8In6YwtMnwjYlh72zNn1p3c7E3YUBwqmAqTM1x+tudgzMRGLYig+bX1ewZxQ==", + "license": "BSD-3-Clause", + "dependencies": { + "vega-canvas": "^2.0.0", + "vega-dataflow": "^6.1.0", + "vega-scenegraph": "^5.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-loader": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-loader/-/vega-loader-5.1.0.tgz", + "integrity": "sha512-GaY3BdSPbPNdtrBz8SYUBNmNd8mdPc3mtdZfdkFazQ0RD9m+Toz5oR8fKnTamNSk9fRTJX0Lp3uEqxrAlQVreg==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-dsv": "^3.0.1", + "topojson-client": "^3.1.0", + "vega-format": "^2.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-parser": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/vega-parser/-/vega-parser-7.1.0.tgz", + "integrity": "sha512-g0lrYxtmYVW8G6yXpIS4J3Uxt9OUSkc0bLu5afoYDo4rZmoOOdll3x3ebActp5LHPW+usZIE+p5nukRS2vEc7Q==", + "license": "BSD-3-Clause", + "dependencies": { + "vega-dataflow": "^6.1.0", + "vega-event-selector": "^4.0.0", + "vega-functions": "^6.1.0", + "vega-scale": "^8.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-projection": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-projection/-/vega-projection-2.1.0.tgz", + "integrity": "sha512-EjRjVSoMR5ibrU7q8LaOQKP327NcOAM1+eZ+NO4ANvvAutwmbNVTmfA1VpPH+AD0AlBYc39ND/wnRk7SieDiXA==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-geo": "^3.1.1", + "d3-geo-projection": "^4.0.0", + "vega-scale": "^8.1.0" + } + }, + "node_modules/vega-regression": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-regression/-/vega-regression-2.1.0.tgz", + "integrity": "sha512-HzC7MuoEwG1rIxRaNTqgcaYF03z/ZxYkQR2D5BN0N45kLnHY1HJXiEcZkcffTsqXdspLjn47yLi44UoCwF5fxQ==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "vega-dataflow": "^6.1.0", + "vega-statistics": "^2.0.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-runtime": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/vega-runtime/-/vega-runtime-7.1.0.tgz", + "integrity": "sha512-mItI+WHimyEcZlZrQ/zYR3LwHVeyHCWwp7MKaBjkU8EwkSxEEGVceyGUY9X2YuJLiOgkLz/6juYDbMv60pfwYA==", + "license": "BSD-3-Clause", + "dependencies": { + "vega-dataflow": "^6.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-scale": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/vega-scale/-/vega-scale-8.1.0.tgz", + "integrity": "sha512-VEgDuEcOec8+C8+FzLcnAmcXrv2gAJKqQifCdQhkgnsLa978vYUgVfCut/mBSMMHbH8wlUV1D0fKZTjRukA1+A==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "d3-interpolate": "^3.0.1", + "d3-scale": "^4.0.2", + "d3-scale-chromatic": "^3.1.0", + "vega-time": "^3.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-scenegraph": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-scenegraph/-/vega-scenegraph-5.1.0.tgz", + "integrity": "sha512-4gA89CFIxkZX+4Nvl8SZF2MBOqnlj9J5zgdPh/HPx+JOwtzSlUqIhxFpFj7GWYfwzr/PyZnguBLPihPw1Og/cA==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-path": "^3.1.0", + "d3-shape": "^3.2.0", + "vega-canvas": "^2.0.0", + "vega-loader": "^5.1.0", + "vega-scale": "^8.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-selections": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/vega-selections/-/vega-selections-6.1.2.tgz", + "integrity": "sha512-xJ+V4qdd46nk2RBdwIRrQm2iSTMHdlu/omhLz1pqRL3jZDrkqNBXimrisci2kIKpH2WBpA1YVagwuZEKBmF2Qw==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "3.2.4", + "vega-expression": "^6.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-statistics": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/vega-statistics/-/vega-statistics-2.0.0.tgz", + "integrity": "sha512-dGPfDXnBlgXbZF3oxtkb8JfeRXd5TYHx25Z/tIoaa9jWua4Vf/AoW2wwh8J1qmMy8J03/29aowkp1yk4DOPazQ==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4" + } + }, + "node_modules/vega-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/vega-time/-/vega-time-3.1.0.tgz", + "integrity": "sha512-G93mWzPwNa6UYQRkr8Ujur9uqxbBDjDT/WpXjbDY0yygdSkRT+zXF+Sb4gjhW0nPaqdiwkn0R6kZcSPMj1bMNA==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "d3-time": "^3.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-transforms": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-transforms/-/vega-transforms-5.1.0.tgz", + "integrity": "sha512-mj/sO2tSuzzpiXX8JSl4DDlhEmVwM/46MTAzTNQUQzJPMI/n4ChCjr/SdEbfEyzlD4DPm1bjohZGjLc010yuMg==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "vega-dataflow": "^6.1.0", + "vega-statistics": "^2.0.0", + "vega-time": "^3.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-typings": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-typings/-/vega-typings-2.1.0.tgz", + "integrity": "sha512-zdis4Fg4gv37yEvTTSZEVMNhp8hwyEl7GZ4X4HHddRVRKxWFsbyKvZx/YW5Z9Ox4sjxVA2qHzEbod4Fdx+SEJA==", + "license": "BSD-3-Clause", + "dependencies": { + "@types/geojson": "7946.0.16", + "vega-event-selector": "^4.0.0", + "vega-expression": "^6.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-util": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-util/-/vega-util-2.1.0.tgz", + "integrity": "sha512-PGfp0m0QCufDmcxKJCWQy4Ov23FoF8DSXmoJwSezi3itQaa2hbxK0+xwsTMP2vy4PR16Pu25HMzgMwXVW1+33w==", + "license": "BSD-3-Clause" + }, + "node_modules/vega-view": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/vega-view/-/vega-view-6.1.0.tgz", + "integrity": "sha512-hmHDm/zC65lb23mb9Tr9Gx0wkxP0TMS31LpMPYxIZpvInxvUn7TYitkOtz1elr63k2YZrgmF7ztdGyQ4iCQ5fQ==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "d3-timer": "^3.0.1", + "vega-dataflow": "^6.1.0", + "vega-format": "^2.1.0", + "vega-functions": "^6.1.0", + "vega-runtime": "^7.1.0", + "vega-scenegraph": "^5.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-view-transforms": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-view-transforms/-/vega-view-transforms-5.1.0.tgz", + "integrity": "sha512-fpigh/xn/32t+An1ShoY3MLeGzNdlbAp2+HvFKzPpmpMTZqJEWkk/J/wHU7Swyc28Ta7W1z3fO+8dZkOYO5TWQ==", + "license": "BSD-3-Clause", + "dependencies": { + "vega-dataflow": "^6.1.0", + "vega-scenegraph": "^5.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-voronoi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-voronoi/-/vega-voronoi-5.1.0.tgz", + "integrity": "sha512-uKdsoR9x60mz7eYtVG+NhlkdQXeVdMr6jHNAHxs+W+i6kawkUp5S9jp1xf1FmW/uZvtO1eqinHQNwATcDRsiUg==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-delaunay": "^6.0.4", + "vega-dataflow": "^6.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-wordcloud": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-wordcloud/-/vega-wordcloud-5.1.0.tgz", + "integrity": "sha512-sSdNmT8y2D7xXhM2h76dKyaYn3PA4eV49WUUkfYfqHz/vpcu10GSAoFxLhQQTkbZXR+q5ZB63tFUow9W2IFo6g==", + "license": "BSD-3-Clause", + "dependencies": { + "vega-canvas": "^2.0.0", + "vega-dataflow": "^6.1.0", + "vega-scale": "^8.1.0", + "vega-statistics": "^2.0.0", + "vega-util": "^2.1.0" + } + }, "node_modules/wordwrapjs": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-3.0.0.tgz", "integrity": "sha512-mO8XtqyPvykVCsrwj5MlOVWvSnCdT+C+QVbm6blradR7JExAhbkZ7hZ9A+9NUtwzSqrlUo9a67ws0EiILrvRpw==", + "license": "MIT", "dependencies": { "reduce-flatten": "^1.0.1", "typical": "^2.6.1" @@ -275,12 +1507,20 @@ "node_modules/wordwrapjs/node_modules/typical": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha512-ofhi8kjIje6npGozTip9Fr8iecmYfEbS06i0JnIg+rh51KakryWF4+jX8lLKZVhy6N+ID45WYSFCxPOdTWCzNg==" + "integrity": "sha512-ofhi8kjIje6npGozTip9Fr8iecmYfEbS06i0JnIg+rh51KakryWF4+jX8lLKZVhy6N+ID45WYSFCxPOdTWCzNg==", + "license": "MIT" + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" }, "node_modules/ws": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.3.tgz", - "integrity": "sha512-jZArVERrMsKUatIdnLzqvcfydI85dvd/Fp1u/VOpfdDWQ4c9qWXe+VIeAbQ5FrDwciAkr+lzofXLz3Kuf26AOA==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.4.tgz", + "integrity": "sha512-fFCejsuC8f9kOSu9FYaOw8CdO68O3h5v0lg4p74o8JqWpwTf9tniOD+nOB78aWoVSS6WptVUmDrp/KPsMVBWFQ==", + "license": "MIT", "dependencies": { "async-limiter": "~1.0.0" } diff --git a/package.json b/package.json index 2c9d116c..a82f1dc5 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,6 @@ "url": "https://github.com/exercism/pyret" }, "dependencies": { - "pyret-npm": "^0.0.27" + "pyret-npm": "^0.0.90" } }