From 2ee265cf2797882a64baa548cbe8bf15a4d5ef34 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Sat, 4 Jan 2025 20:22:51 +0100 Subject: [PATCH] all the fixes --- bin/add-exercise | 6 +- bin/generate_tests.py | 5 +- config/generator_macros.j2 | 6 +- .../practice/accumulate/.meta/template.j2 | 4 +- .../practice/accumulate/accumulate-test.roc | 6 +- exercises/practice/acronym/.meta/template.j2 | 2 +- exercises/practice/acronym/acronym-test.roc | 8 +- .../practice/affine-cipher/.meta/template.j2 | 2 +- .../affine-cipher/affine-cipher-test.roc | 8 +- .../practice/all-your-base/.meta/template.j2 | 6 +- .../all-your-base/all-your-base-test.roc | 9 +- .../practice/allergies/.meta/template.j2 | 4 +- .../practice/allergies/allergies-test.roc | 90 ++--- .../practice/alphametics/.meta/template.j2 | 4 +- .../practice/alphametics/alphametics-test.roc | 8 +- exercises/practice/anagram/.meta/template.j2 | 4 +- exercises/practice/anagram/anagram-test.roc | 44 +-- .../armstrong-numbers/.meta/template.j2 | 2 +- .../armstrong-numbers-test.roc | 8 +- .../practice/atbash-cipher/.meta/template.j2 | 2 +- .../atbash-cipher/atbash-cipher-test.roc | 8 +- .../binary-search-tree-test.roc | 40 ++- .../practice/binary-search/.meta/template.j2 | 4 +- .../binary-search/binary-search-test.roc | 8 +- exercises/practice/binary/.meta/template.j2 | 4 +- exercises/practice/binary/binary-test.roc | 8 +- exercises/practice/bob/.meta/template.j2 | 2 +- exercises/practice/bob/bob-test.roc | 8 +- exercises/practice/bowling/.meta/template.j2 | 8 +- exercises/practice/bowling/bowling-test.roc | 170 ++++----- exercises/practice/change/.meta/template.j2 | 4 +- exercises/practice/change/change-test.roc | 8 +- .../circular-buffer/.meta/Example.roc | 4 +- .../circular-buffer/.meta/template.j2 | 12 +- .../circular-buffer/CircularBuffer.roc | 6 +- .../circular-buffer/circular-buffer-test.roc | 336 +++++++++--------- exercises/practice/clock/.meta/template.j2 | 2 +- exercises/practice/clock/clock-test.roc | 8 +- .../collatz-conjecture/.meta/template.j2 | 2 +- .../collatz-conjecture-test.roc | 8 +- .../complex-numbers/complex-numbers-test.roc | 8 +- exercises/practice/connect/.meta/template.j2 | 4 +- exercises/practice/connect/connect-test.roc | 8 +- .../practice/crypto-square/.meta/template.j2 | 4 +- .../crypto-square/crypto-square-test.roc | 8 +- .../practice/custom-set/.meta/template.j2 | 4 +- .../practice/custom-set/custom-set-test.roc | 284 +++++++-------- exercises/practice/darts/.meta/template.j2 | 2 +- exercises/practice/darts/darts-test.roc | 8 +- exercises/practice/diamond/.meta/template.j2 | 4 +- exercises/practice/diamond/diamond-test.roc | 8 +- .../difference-of-squares/.meta/config.json | 2 +- .../difference-of-squares/.meta/template.j2 | 4 +- .../difference-of-squares-test.roc | 10 +- exercises/practice/dominoes/dominoes-test.roc | 8 +- .../practice/eliuds-eggs/.meta/template.j2 | 4 +- .../practice/eliuds-eggs/eliuds-eggs-test.roc | 8 +- .../error-handling/error-handling-test.roc | 6 +- exercises/practice/etl/etl-test.roc | 8 +- .../practice/flatten-array/.meta/template.j2 | 4 +- .../flatten-array/flatten-array-test.roc | 8 +- .../practice/food-chain/.meta/template.j2 | 6 +- .../practice/food-chain/food-chain-test.roc | 8 +- exercises/practice/forth/forth-test.roc | 9 +- .../practice/gigasecond/.meta/template.j2 | 2 +- .../practice/gigasecond/gigasecond-test.roc | 8 +- .../practice/go-counting/.meta/template.j2 | 2 +- .../practice/go-counting/go-counting-test.roc | 22 +- exercises/practice/grains/grains-test.roc | 8 +- exercises/practice/grep/.meta/template.j2 | 2 +- exercises/practice/grep/grep-test.roc | 8 +- exercises/practice/hamming/.meta/template.j2 | 4 +- exercises/practice/hamming/hamming-test.roc | 8 +- .../practice/hello-world/hello-world-test.roc | 8 +- .../practice/hexadecimal/hexadecimal-test.roc | 6 +- .../practice/high-scores/.meta/template.j2 | 4 +- .../practice/high-scores/high-scores-test.roc | 8 +- exercises/practice/house/.meta/template.j2 | 4 +- exercises/practice/house/house-test.roc | 8 +- .../practice/isbn-verifier/.meta/template.j2 | 4 +- .../isbn-verifier/isbn-verifier-test.roc | 8 +- exercises/practice/isogram/.meta/template.j2 | 2 +- exercises/practice/isogram/isogram-test.roc | 8 +- .../killer-sudoku-helper-test.roc | 8 +- .../kindergarten-garden/.meta/template.j2 | 2 +- .../kindergarten-garden-test.roc | 8 +- exercises/practice/knapsack/.meta/Example.roc | 10 +- exercises/practice/knapsack/.meta/template.j2 | 6 +- exercises/practice/knapsack/Knapsack.roc | 8 +- exercises/practice/knapsack/knapsack-test.roc | 24 +- .../largest-series-product/.meta/template.j2 | 4 +- .../largest-series-product-test.roc | 8 +- exercises/practice/leap/leap-test.roc | 8 +- exercises/practice/list-ops/.meta/template.j2 | 14 +- exercises/practice/list-ops/list-ops-test.roc | 8 +- exercises/practice/luhn/.meta/template.j2 | 4 +- exercises/practice/luhn/luhn-test.roc | 8 +- .../matching-brackets/.meta/template.j2 | 4 +- .../matching-brackets-test.roc | 8 +- exercises/practice/matrix/.meta/template.j2 | 2 +- exercises/practice/matrix/matrix-test.roc | 8 +- exercises/practice/meetup/.meta/template.j2 | 4 +- exercises/practice/meetup/meetup-test.roc | 8 +- .../practice/micro-blog/.meta/template.j2 | 4 +- .../practice/micro-blog/micro-blog-test.roc | 8 +- .../practice/minesweeper/.meta/template.j2 | 4 +- .../practice/minesweeper/minesweeper-test.roc | 8 +- .../practice/nth-prime/.meta/template.j2 | 4 +- .../practice/nth-prime/nth-prime-test.roc | 8 +- .../nucleotide-count/.meta/template.j2 | 4 +- .../nucleotide-count-test.roc | 8 +- .../practice/ocr-numbers/.meta/template.j2 | 4 +- .../practice/ocr-numbers/ocr-numbers-test.roc | 8 +- exercises/practice/octal/octal-test.roc | 6 +- .../palindrome-products/.meta/template.j2 | 2 +- .../palindrome-products-test.roc | 8 +- exercises/practice/pangram/.meta/template.j2 | 2 +- exercises/practice/pangram/pangram-test.roc | 9 +- .../pascals-triangle-test.roc | 8 +- .../perfect-numbers/.meta/template.j2 | 2 +- .../perfect-numbers/perfect-numbers-test.roc | 8 +- .../practice/phone-number/.meta/template.j2 | 4 +- .../phone-number/phone-number-test.roc | 8 +- .../practice/pig-latin/.meta/template.j2 | 4 +- .../practice/pig-latin/pig-latin-test.roc | 8 +- exercises/practice/poker/.meta/template.j2 | 4 +- exercises/practice/poker/poker-test.roc | 8 +- .../practice/prime-factors/.meta/template.j2 | 4 +- .../prime-factors/prime-factors-test.roc | 8 +- .../protein-translation/.meta/Example.roc | 6 +- .../protein-translation-test.roc | 8 +- exercises/practice/proverb/.meta/template.j2 | 4 +- exercises/practice/proverb/proverb-test.roc | 8 +- .../pythagorean-triplet/.meta/template.j2 | 4 +- .../pythagorean-triplet-test.roc | 8 +- .../queen-attack/queen-attack-test.roc | 64 ++-- .../rail-fence-cipher/.meta/template.j2 | 2 +- .../rail-fence-cipher-test.roc | 8 +- .../practice/raindrops/.meta/template.j2 | 2 +- .../practice/raindrops/raindrops-test.roc | 8 +- .../rational-numbers/.meta/template.j2 | 8 +- .../rational-numbers-test.roc | 8 +- .../practice/rectangles/.meta/template.j2 | 4 +- .../practice/rectangles/rectangles-test.roc | 8 +- .../resistor-color-duo/.meta/template.j2 | 2 +- .../resistor-color-duo-test.roc | 8 +- .../practice/resistor-color/.meta/template.j2 | 4 +- .../resistor-color/resistor-color-test.roc | 8 +- exercises/practice/rest-api/.meta/template.j2 | 2 +- exercises/practice/rest-api/rest-api-test.roc | 28 +- .../practice/reverse-string/.meta/template.j2 | 2 +- .../reverse-string/reverse-string-test.roc | 8 +- .../rna-transcription/.meta/template.j2 | 2 +- .../rna-transcription-test.roc | 8 +- .../robot-simulator/robot-simulator-test.roc | 8 +- .../practice/roman-numerals/.meta/template.j2 | 4 +- .../roman-numerals/roman-numerals-test.roc | 8 +- .../rotational-cipher/.meta/template.j2 | 2 +- .../rotational-cipher-test.roc | 8 +- .../run-length-encoding/.meta/template.j2 | 2 +- .../run-length-encoding-test.roc | 8 +- .../practice/saddle-points/.meta/Example.roc | 43 ++- .../practice/saddle-points/.meta/template.j2 | 4 +- .../practice/saddle-points/SaddlePoints.roc | 8 +- .../saddle-points/saddle-points-test.roc | 28 +- exercises/practice/say/.meta/template.j2 | 4 +- exercises/practice/say/say-test.roc | 8 +- .../practice/scrabble-score/.meta/template.j2 | 4 +- .../scrabble-score/scrabble-score-test.roc | 8 +- .../secret-handshake/.meta/template.j2 | 4 +- .../secret-handshake-test.roc | 8 +- exercises/practice/series/.meta/template.j2 | 4 +- exercises/practice/series/series-test.roc | 8 +- .../practice/sgf-parsing/.meta/template.j2 | 4 +- .../practice/sgf-parsing/sgf-parsing-test.roc | 8 +- exercises/practice/sieve/.meta/template.j2 | 4 +- exercises/practice/sieve/sieve-test.roc | 8 +- .../simple-linked-list-test.roc | 8 +- .../practice/space-age/.meta/template.j2 | 4 +- .../practice/space-age/space-age-test.roc | 9 +- .../practice/spiral-matrix/.meta/template.j2 | 4 +- .../spiral-matrix/spiral-matrix-test.roc | 8 +- .../practice/square-root/.meta/template.j2 | 4 +- .../practice/square-root/square-root-test.roc | 8 +- exercises/practice/strain/.meta/template.j2 | 2 +- exercises/practice/strain/strain-test.roc | 8 +- exercises/practice/sublist/.meta/template.j2 | 4 +- exercises/practice/sublist/sublist-test.roc | 8 +- .../sum-of-multiples/.meta/template.j2 | 4 +- .../sum-of-multiples-test.roc | 8 +- .../practice/tournament/.meta/template.j2 | 4 +- .../practice/tournament/tournament-test.roc | 8 +- .../practice/transpose/.meta/template.j2 | 4 +- .../practice/transpose/transpose-test.roc | 8 +- exercises/practice/triangle/.meta/Example.roc | 8 +- exercises/practice/triangle/.meta/template.j2 | 6 +- exercises/practice/triangle/Triangle.roc | 8 +- exercises/practice/triangle/triangle-test.roc | 28 +- .../practice/two-bucket/.meta/Example.roc | 32 +- .../practice/two-bucket/.meta/template.j2 | 14 +- .../practice/two-bucket/two-bucket-test.roc | 90 ++--- exercises/practice/two-fer/.meta/template.j2 | 6 +- exercises/practice/two-fer/two-fer-test.roc | 8 +- .../variable-length-quantity-test.roc | 8 +- .../practice/word-count/.meta/template.j2 | 4 +- .../practice/word-count/word-count-test.roc | 8 +- .../practice/word-search/.meta/template.j2 | 6 +- .../practice/word-search/word-search-test.roc | 8 +- exercises/practice/wordy/.meta/template.j2 | 2 +- exercises/practice/wordy/wordy-test.roc | 8 +- exercises/practice/yacht/.meta/template.j2 | 4 +- exercises/practice/yacht/yacht-test.roc | 8 +- .../practice/zebra-puzzle/.meta/template.j2 | 2 +- .../zebra-puzzle/zebra-puzzle-test.roc | 8 +- 214 files changed, 1375 insertions(+), 1147 deletions(-) diff --git a/bin/add-exercise b/bin/add-exercise index 126def2..26a77c5 100755 --- a/bin/add-exercise +++ b/bin/add-exercise @@ -63,12 +63,12 @@ cat << END_TESTER > "exercises/practice/${slug}/.meta/template.j2" {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["myArg"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["myArg"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} @@ -79,7 +79,7 @@ $(curl --silent "https://raw.githubusercontent.com/exercism/problem-specificatio END_TESTER slug_pascal=$(cd bin && python -c "from generate_tests import to_pascal; print(to_pascal('${slug}'))") -slug_camel=$(cd bin && python -c "from generate_tests import to_camel; print(to_camel('${slug}'))") +slug_camel=$(cd bin && python -c "from generate_tests import to_snake; print(to_snake('${slug}'))") cat << END_TEST > "exercises/practice/${slug}/${slug}-test.roc" # This file will be generated automatically diff --git a/bin/generate_tests.py b/bin/generate_tests.py index e963430..25680fe 100755 --- a/bin/generate_tests.py +++ b/bin/generate_tests.py @@ -67,7 +67,6 @@ logger = logging.getLogger("generator") logger.setLevel(logging.WARN) - def replace_all(string: str, chars: Union[str, List[str]], rep: str) -> str: """ Replace any char in chars with rep, reduce runs and strip terminal ends. @@ -170,9 +169,9 @@ def to_roc_tuple(values: Any): def to_roc_record(obj: Dict[str, Any]): items = [] for key, value in obj.items(): - camel_key = to_camel(key) + snake_key = to_snake(key) roc_value = to_roc(value) - items.append(f"{camel_key}: {roc_value}") + items.append(f"{snake_key}: {roc_value}") return "{ " + ", ".join(items) + " }" diff --git a/config/generator_macros.j2 b/config/generator_macros.j2 index 53a064c..1d2468f 100644 --- a/config/generator_macros.j2 +++ b/config/generator_macros.j2 @@ -17,7 +17,7 @@ {% macro header(imports=[], ignore=[]) -%} -app [main] { +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br" {%- if imports -%} {%- for name in imports -%}, @@ -34,8 +34,10 @@ app [main] { {%- endif %} } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" {%- endmacro %} diff --git a/exercises/practice/accumulate/.meta/template.j2 b/exercises/practice/accumulate/.meta/template.j2 index 94a0823..f28f677 100644 --- a/exercises/practice/accumulate/.meta/template.j2 +++ b/exercises/practice/accumulate/.meta/template.j2 @@ -2,7 +2,7 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% set accumulators = { "(x) => x * x": "\\x ->\n x * x", @@ -14,7 +14,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["list"] | to_roc }} {{ accumulators[case["input"]["accumulator"]] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["list"] | to_roc }} {{ accumulators[case["input"]["accumulator"]] }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/accumulate/accumulate-test.roc b/exercises/practice/accumulate/accumulate-test.roc index 3f89a80..ab36076 100644 --- a/exercises/practice/accumulate/accumulate-test.roc +++ b/exercises/practice/accumulate/accumulate-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/accumulate/canonical-data.json -# File last updated on 2024-09-15 +# File last updated on 2025-01-04 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Accumulate exposing [accumulate] diff --git a/exercises/practice/acronym/.meta/template.j2 b/exercises/practice/acronym/.meta/template.j2 index 44eaee8..6c2dcde 100644 --- a/exercises/practice/acronym/.meta/template.j2 +++ b/exercises/practice/acronym/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [abbreviate] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["phrase"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["phrase"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/acronym/acronym-test.roc b/exercises/practice/acronym/acronym-test.roc index 1244c7d..b52858c 100644 --- a/exercises/practice/acronym/acronym-test.roc +++ b/exercises/practice/acronym/acronym-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/acronym/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Acronym exposing [abbreviate] diff --git a/exercises/practice/affine-cipher/.meta/template.j2 b/exercises/practice/affine-cipher/.meta/template.j2 index 9690a49..efeae89 100644 --- a/exercises/practice/affine-cipher/.meta/template.j2 +++ b/exercises/practice/affine-cipher/.meta/template.j2 @@ -14,7 +14,7 @@ import {{ exercise | to_pascal }} exposing [encode, decode] expect phrase = {{ case["input"]["phrase"] | to_roc }} key = {a: {{ case["input"]["key"]["a"] }}, b: {{ case["input"]["key"]["b"] }}} - result = {{ case["property"] | to_camel }} phrase key + result = {{ case["property"] | to_snake }} phrase key {%- if case["expected"]["error"] %} result |> Result.isErr {%- else %} diff --git a/exercises/practice/affine-cipher/affine-cipher-test.roc b/exercises/practice/affine-cipher/affine-cipher-test.roc index 89850c7..138821d 100644 --- a/exercises/practice/affine-cipher/affine-cipher-test.roc +++ b/exercises/practice/affine-cipher/affine-cipher-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/affine-cipher/canonical-data.json -# File last updated on 2024-10-23 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import AffineCipher exposing [encode, decode] diff --git a/exercises/practice/all-your-base/.meta/template.j2 b/exercises/practice/all-your-base/.meta/template.j2 index a2dcbfb..0ff7930 100644 --- a/exercises/practice/all-your-base/.meta/template.j2 +++ b/exercises/practice/all-your-base/.meta/template.j2 @@ -2,16 +2,16 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} { input_base: {{ case["input"]["input_base"] | to_roc }}, output_base: {{ case["input"]["output_base"] | to_roc }}, digits: {{ case["input"]["digits"] | to_roc }} } + result = {{ case["property"] | to_snake }} { input_base: {{ case["input"]["inputBase"] | to_roc }}, output_base: {{ case["input"]["outputBase"] | to_roc }}, digits: {{ case["input"]["digits"] | to_roc }} } {%- if case["expected"]["error"] %} result |> Result.isErr {%- else %} result == Ok {{ case["expected"] }} {%- endif %} -{% endfor %} +{% endfor %} \ No newline at end of file diff --git a/exercises/practice/all-your-base/all-your-base-test.roc b/exercises/practice/all-your-base/all-your-base-test.roc index 7fc012a..6bc5254 100644 --- a/exercises/practice/all-your-base/all-your-base-test.roc +++ b/exercises/practice/all-your-base/all-your-base-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/all-your-base/canonical-data.json -# File last updated on 2024-09-03 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import AllYourBase exposing [rebase] @@ -94,3 +96,4 @@ expect expect result = rebase { input_base: 10, output_base: 0, digits: [7] } result |> Result.isErr + diff --git a/exercises/practice/allergies/.meta/template.j2 b/exercises/practice/allergies/.meta/template.j2 index 0369bce..79403fa 100644 --- a/exercises/practice/allergies/.meta/template.j2 +++ b/exercises/practice/allergies/.meta/template.j2 @@ -8,7 +8,7 @@ import {{ exercise | to_pascal }} exposing [allergic_to, set] {% for case in outerCase["cases"] %} # {{ outerCase["description"] }} {{ case["description"] | default('') }} expect - {%- if case["property"] == "allergic_to" %} + {%- if case["property"] == "allergicTo" %} result = allergic_to {{ case["input"]["item"] | to_pascal }} {{ case["input"]["score"] | to_roc }} result == {{ case["expected"] | to_roc }} {%- else %} @@ -17,4 +17,4 @@ expect {%- endif %} {% endfor %} -{% endfor %} +{% endfor %} \ No newline at end of file diff --git a/exercises/practice/allergies/allergies-test.roc b/exercises/practice/allergies/allergies-test.roc index b2fcfad..06bda78 100644 --- a/exercises/practice/allergies/allergies-test.roc +++ b/exercises/practice/allergies/allergies-test.roc @@ -1,213 +1,215 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/allergies/canonical-data.json -# File last updated on 2024-09-21 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" -import Allergies exposing [allergicTo, set] +import Allergies exposing [allergic_to, set] # testing for eggs allergy not allergic to anything expect - result = allergicTo Eggs 0 + result = allergic_to Eggs 0 result == Bool.false # testing for eggs allergy allergic only to eggs expect - result = allergicTo Eggs 1 + result = allergic_to Eggs 1 result == Bool.true # testing for eggs allergy allergic to eggs and something else expect - result = allergicTo Eggs 3 + result = allergic_to Eggs 3 result == Bool.true # testing for eggs allergy allergic to something, but not eggs expect - result = allergicTo Eggs 2 + result = allergic_to Eggs 2 result == Bool.false # testing for eggs allergy allergic to everything expect - result = allergicTo Eggs 255 + result = allergic_to Eggs 255 result == Bool.true # testing for peanuts allergy not allergic to anything expect - result = allergicTo Peanuts 0 + result = allergic_to Peanuts 0 result == Bool.false # testing for peanuts allergy allergic only to peanuts expect - result = allergicTo Peanuts 2 + result = allergic_to Peanuts 2 result == Bool.true # testing for peanuts allergy allergic to peanuts and something else expect - result = allergicTo Peanuts 7 + result = allergic_to Peanuts 7 result == Bool.true # testing for peanuts allergy allergic to something, but not peanuts expect - result = allergicTo Peanuts 5 + result = allergic_to Peanuts 5 result == Bool.false # testing for peanuts allergy allergic to everything expect - result = allergicTo Peanuts 255 + result = allergic_to Peanuts 255 result == Bool.true # testing for shellfish allergy not allergic to anything expect - result = allergicTo Shellfish 0 + result = allergic_to Shellfish 0 result == Bool.false # testing for shellfish allergy allergic only to shellfish expect - result = allergicTo Shellfish 4 + result = allergic_to Shellfish 4 result == Bool.true # testing for shellfish allergy allergic to shellfish and something else expect - result = allergicTo Shellfish 14 + result = allergic_to Shellfish 14 result == Bool.true # testing for shellfish allergy allergic to something, but not shellfish expect - result = allergicTo Shellfish 10 + result = allergic_to Shellfish 10 result == Bool.false # testing for shellfish allergy allergic to everything expect - result = allergicTo Shellfish 255 + result = allergic_to Shellfish 255 result == Bool.true # testing for strawberries allergy not allergic to anything expect - result = allergicTo Strawberries 0 + result = allergic_to Strawberries 0 result == Bool.false # testing for strawberries allergy allergic only to strawberries expect - result = allergicTo Strawberries 8 + result = allergic_to Strawberries 8 result == Bool.true # testing for strawberries allergy allergic to strawberries and something else expect - result = allergicTo Strawberries 28 + result = allergic_to Strawberries 28 result == Bool.true # testing for strawberries allergy allergic to something, but not strawberries expect - result = allergicTo Strawberries 20 + result = allergic_to Strawberries 20 result == Bool.false # testing for strawberries allergy allergic to everything expect - result = allergicTo Strawberries 255 + result = allergic_to Strawberries 255 result == Bool.true # testing for tomatoes allergy not allergic to anything expect - result = allergicTo Tomatoes 0 + result = allergic_to Tomatoes 0 result == Bool.false # testing for tomatoes allergy allergic only to tomatoes expect - result = allergicTo Tomatoes 16 + result = allergic_to Tomatoes 16 result == Bool.true # testing for tomatoes allergy allergic to tomatoes and something else expect - result = allergicTo Tomatoes 56 + result = allergic_to Tomatoes 56 result == Bool.true # testing for tomatoes allergy allergic to something, but not tomatoes expect - result = allergicTo Tomatoes 40 + result = allergic_to Tomatoes 40 result == Bool.false # testing for tomatoes allergy allergic to everything expect - result = allergicTo Tomatoes 255 + result = allergic_to Tomatoes 255 result == Bool.true # testing for chocolate allergy not allergic to anything expect - result = allergicTo Chocolate 0 + result = allergic_to Chocolate 0 result == Bool.false # testing for chocolate allergy allergic only to chocolate expect - result = allergicTo Chocolate 32 + result = allergic_to Chocolate 32 result == Bool.true # testing for chocolate allergy allergic to chocolate and something else expect - result = allergicTo Chocolate 112 + result = allergic_to Chocolate 112 result == Bool.true # testing for chocolate allergy allergic to something, but not chocolate expect - result = allergicTo Chocolate 80 + result = allergic_to Chocolate 80 result == Bool.false # testing for chocolate allergy allergic to everything expect - result = allergicTo Chocolate 255 + result = allergic_to Chocolate 255 result == Bool.true # testing for pollen allergy not allergic to anything expect - result = allergicTo Pollen 0 + result = allergic_to Pollen 0 result == Bool.false # testing for pollen allergy allergic only to pollen expect - result = allergicTo Pollen 64 + result = allergic_to Pollen 64 result == Bool.true # testing for pollen allergy allergic to pollen and something else expect - result = allergicTo Pollen 224 + result = allergic_to Pollen 224 result == Bool.true # testing for pollen allergy allergic to something, but not pollen expect - result = allergicTo Pollen 160 + result = allergic_to Pollen 160 result == Bool.false # testing for pollen allergy allergic to everything expect - result = allergicTo Pollen 255 + result = allergic_to Pollen 255 result == Bool.true # testing for cats allergy not allergic to anything expect - result = allergicTo Cats 0 + result = allergic_to Cats 0 result == Bool.false # testing for cats allergy allergic only to cats expect - result = allergicTo Cats 128 + result = allergic_to Cats 128 result == Bool.true # testing for cats allergy allergic to cats and something else expect - result = allergicTo Cats 192 + result = allergic_to Cats 192 result == Bool.true # testing for cats allergy allergic to something, but not cats expect - result = allergicTo Cats 64 + result = allergic_to Cats 64 result == Bool.false # testing for cats allergy allergic to everything expect - result = allergicTo Cats 255 + result = allergic_to Cats 255 result == Bool.true # list when: no allergies diff --git a/exercises/practice/alphametics/.meta/template.j2 b/exercises/practice/alphametics/.meta/template.j2 index 0ed4ebb..3a04728 100644 --- a/exercises/practice/alphametics/.meta/template.j2 +++ b/exercises/practice/alphametics/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["puzzle"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["puzzle"] | to_roc }} {%- if case["expected"] %} Result.withDefault result [] |> Set.fromList == Set.fromList [ {%- for letter, value in case["expected"].items() %} diff --git a/exercises/practice/alphametics/alphametics-test.roc b/exercises/practice/alphametics/alphametics-test.roc index 4e6e7fa..1dfdfe4 100644 --- a/exercises/practice/alphametics/alphametics-test.roc +++ b/exercises/practice/alphametics/alphametics-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/alphametics/canonical-data.json -# File last updated on 2024-09-22 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Alphametics exposing [solve] diff --git a/exercises/practice/anagram/.meta/template.j2 b/exercises/practice/anagram/.meta/template.j2 index dac7a13..89654c9 100644 --- a/exercises/practice/anagram/.meta/template.j2 +++ b/exercises/practice/anagram/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header(imports=["unicode"]) }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["subject"] | to_roc }} {{ case["input"]["candidates"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["subject"] | to_roc }} {{ case["input"]["candidates"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/anagram/anagram-test.roc b/exercises/practice/anagram/anagram-test.roc index 93d7da4..7c3a911 100644 --- a/exercises/practice/anagram/anagram-test.roc +++ b/exercises/practice/anagram/anagram-test.roc @@ -1,98 +1,100 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/anagram/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", unicode: "https://github.com/roc-lang/unicode/releases/download/0.2.0/odvSckHK9LxWLbsrPmo2s6aQ3bn7C3PALyv0ZI1gAu0.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" -import Anagram exposing [findAnagrams] +import Anagram exposing [find_anagrams] # no matches expect - result = findAnagrams "diaper" ["hello", "world", "zombies", "pants"] + result = find_anagrams "diaper" ["hello", "world", "zombies", "pants"] result == [] # detects two anagrams expect - result = findAnagrams "solemn" ["lemons", "cherry", "melons"] + result = find_anagrams "solemn" ["lemons", "cherry", "melons"] result == ["lemons", "melons"] # does not detect anagram subsets expect - result = findAnagrams "good" ["dog", "goody"] + result = find_anagrams "good" ["dog", "goody"] result == [] # detects anagram expect - result = findAnagrams "listen" ["enlists", "google", "inlets", "banana"] + result = find_anagrams "listen" ["enlists", "google", "inlets", "banana"] result == ["inlets"] # detects three anagrams expect - result = findAnagrams "allergy" ["gallery", "ballerina", "regally", "clergy", "largely", "leading"] + result = find_anagrams "allergy" ["gallery", "ballerina", "regally", "clergy", "largely", "leading"] result == ["gallery", "regally", "largely"] # detects multiple anagrams with different case expect - result = findAnagrams "nose" ["Eons", "ONES"] + result = find_anagrams "nose" ["Eons", "ONES"] result == ["Eons", "ONES"] # does not detect non-anagrams with identical checksum expect - result = findAnagrams "mass" ["last"] + result = find_anagrams "mass" ["last"] result == [] # detects anagrams case-insensitively expect - result = findAnagrams "Orchestra" ["cashregister", "Carthorse", "radishes"] + result = find_anagrams "Orchestra" ["cashregister", "Carthorse", "radishes"] result == ["Carthorse"] # detects anagrams using case-insensitive subject expect - result = findAnagrams "Orchestra" ["cashregister", "carthorse", "radishes"] + result = find_anagrams "Orchestra" ["cashregister", "carthorse", "radishes"] result == ["carthorse"] # detects anagrams using case-insensitive possible matches expect - result = findAnagrams "orchestra" ["cashregister", "Carthorse", "radishes"] + result = find_anagrams "orchestra" ["cashregister", "Carthorse", "radishes"] result == ["Carthorse"] # does not detect an anagram if the original word is repeated expect - result = findAnagrams "go" ["goGoGO"] + result = find_anagrams "go" ["goGoGO"] result == [] # anagrams must use all letters exactly once expect - result = findAnagrams "tapper" ["patter"] + result = find_anagrams "tapper" ["patter"] result == [] # words are not anagrams of themselves expect - result = findAnagrams "BANANA" ["BANANA"] + result = find_anagrams "BANANA" ["BANANA"] result == [] # words are not anagrams of themselves even if letter case is partially different expect - result = findAnagrams "BANANA" ["Banana"] + result = find_anagrams "BANANA" ["Banana"] result == [] # words are not anagrams of themselves even if letter case is completely different expect - result = findAnagrams "BANANA" ["banana"] + result = find_anagrams "BANANA" ["banana"] result == [] # words other than themselves can be anagrams expect - result = findAnagrams "LISTEN" ["LISTEN", "Silent"] + result = find_anagrams "LISTEN" ["LISTEN", "Silent"] result == ["Silent"] # different characters may have the same bytes expect - result = findAnagrams "a⬂" ["€a"] + result = find_anagrams "a⬂" ["€a"] result == [] diff --git a/exercises/practice/armstrong-numbers/.meta/template.j2 b/exercises/practice/armstrong-numbers/.meta/template.j2 index 375f65d..e9e4547 100644 --- a/exercises/practice/armstrong-numbers/.meta/template.j2 +++ b/exercises/practice/armstrong-numbers/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [is_armstrong_number] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["number"] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["number"] }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/armstrong-numbers/armstrong-numbers-test.roc b/exercises/practice/armstrong-numbers/armstrong-numbers-test.roc index ffad3d0..3b26e72 100644 --- a/exercises/practice/armstrong-numbers/armstrong-numbers-test.roc +++ b/exercises/practice/armstrong-numbers/armstrong-numbers-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/armstrong-numbers/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import ArmstrongNumbers exposing [is_armstrong_number] diff --git a/exercises/practice/atbash-cipher/.meta/template.j2 b/exercises/practice/atbash-cipher/.meta/template.j2 index c18e2ce..278ded2 100644 --- a/exercises/practice/atbash-cipher/.meta/template.j2 +++ b/exercises/practice/atbash-cipher/.meta/template.j2 @@ -13,7 +13,7 @@ import {{ exercise | to_pascal }} exposing [encode, decode] # {{ case["description"] }} expect phrase = {{ case["input"]["phrase"] | to_roc }} - result = phrase |> {{ case["property"] | to_camel }} + result = phrase |> {{ case["property"] | to_snake }} expected = {{ case["expected"] | to_roc }} result == Ok expected diff --git a/exercises/practice/atbash-cipher/atbash-cipher-test.roc b/exercises/practice/atbash-cipher/atbash-cipher-test.roc index cf87df4..d915daa 100644 --- a/exercises/practice/atbash-cipher/atbash-cipher-test.roc +++ b/exercises/practice/atbash-cipher/atbash-cipher-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/atbash-cipher/canonical-data.json -# File last updated on 2024-10-10 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import AtbashCipher exposing [encode, decode] diff --git a/exercises/practice/binary-search-tree/binary-search-tree-test.roc b/exercises/practice/binary-search-tree/binary-search-tree-test.roc index ebfed05..8a3a0d7 100644 --- a/exercises/practice/binary-search-tree/binary-search-tree-test.roc +++ b/exercises/practice/binary-search-tree/binary-search-tree-test.roc @@ -1,14 +1,16 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/binary-search-tree/canonical-data.json -# File last updated on 2024-10-21 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" -import BinarySearchTree exposing [fromList, toList] +import BinarySearchTree exposing [from_list, to_list] ## ## data is retained @@ -16,7 +18,7 @@ import BinarySearchTree exposing [fromList, toList] expect data = [4] - result = data |> fromList + result = data |> from_list expected = Node { value: 4, left: Nil, @@ -31,7 +33,7 @@ expect # smaller number at left node expect data = [4, 2] - result = data |> fromList + result = data |> from_list expected = Node { value: 4, left: Node { @@ -46,7 +48,7 @@ expect # same number at left node expect data = [4, 4] - result = data |> fromList + result = data |> from_list expected = Node { value: 4, left: Node { @@ -61,7 +63,7 @@ expect # greater number at right node expect data = [4, 5] - result = data |> fromList + result = data |> from_list expected = Node { value: 4, left: Nil, @@ -79,7 +81,7 @@ expect expect data = [4, 2, 6, 1, 3, 5, 7] - result = data |> fromList + result = data |> from_list expected = Node { value: 4, left: Node { @@ -118,40 +120,40 @@ expect # can sort single number expect data = [2] - tree = data |> fromList - result = tree |> toList + tree = data |> from_list + result = tree |> to_list expected = [2] result == expected # can sort if second number is smaller than first expect data = [2, 1] - tree = data |> fromList - result = tree |> toList + tree = data |> from_list + result = tree |> to_list expected = [1, 2] result == expected # can sort if second number is same as first expect data = [2, 2] - tree = data |> fromList - result = tree |> toList + tree = data |> from_list + result = tree |> to_list expected = [2, 2] result == expected # can sort if second number is greater than first expect data = [2, 3] - tree = data |> fromList - result = tree |> toList + tree = data |> from_list + result = tree |> to_list expected = [2, 3] result == expected # can sort complex tree expect data = [2, 1, 3, 6, 7, 5] - tree = data |> fromList - result = tree |> toList + tree = data |> from_list + result = tree |> to_list expected = [1, 2, 3, 5, 6, 7] result == expected diff --git a/exercises/practice/binary-search/.meta/template.j2 b/exercises/practice/binary-search/.meta/template.j2 index c40a570..6f2efbb 100644 --- a/exercises/practice/binary-search/.meta/template.j2 +++ b/exercises/practice/binary-search/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["input"]["array"] | to_roc }} |> {{ case["property"] | to_camel }} {{ case["input"]["value"] }} + result = {{ case["input"]["array"] | to_roc }} |> {{ case["property"] | to_snake }} {{ case["input"]["value"] }} {%- if case["expected"]["error"] %} Result.isErr result {%- else %} diff --git a/exercises/practice/binary-search/binary-search-test.roc b/exercises/practice/binary-search/binary-search-test.roc index 70b0b81..ff92d97 100644 --- a/exercises/practice/binary-search/binary-search-test.roc +++ b/exercises/practice/binary-search/binary-search-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/binary-search/canonical-data.json -# File last updated on 2024-09-03 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import BinarySearch exposing [find] diff --git a/exercises/practice/binary/.meta/template.j2 b/exercises/practice/binary/.meta/template.j2 index ddd8b85..4200998 100644 --- a/exercises/practice/binary/.meta/template.j2 +++ b/exercises/practice/binary/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["binary"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["binary"] | to_roc }} {%- if case["expected"] is not none %} result == Ok {{ case["expected"] | to_roc }} {%- else %} diff --git a/exercises/practice/binary/binary-test.roc b/exercises/practice/binary/binary-test.roc index b254c30..eff70b8 100644 --- a/exercises/practice/binary/binary-test.roc +++ b/exercises/practice/binary/binary-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/binary/canonical-data.json -# File last updated on 2024-09-24 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Binary exposing [decimal] diff --git a/exercises/practice/bob/.meta/template.j2 b/exercises/practice/bob/.meta/template.j2 index 9569992..fe5df14 100644 --- a/exercises/practice/bob/.meta/template.j2 +++ b/exercises/practice/bob/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [response] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["heyBob"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["heyBob"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} \ No newline at end of file diff --git a/exercises/practice/bob/bob-test.roc b/exercises/practice/bob/bob-test.roc index 95bba22..bea0653 100644 --- a/exercises/practice/bob/bob-test.roc +++ b/exercises/practice/bob/bob-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/bob/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Bob exposing [response] diff --git a/exercises/practice/bowling/.meta/template.j2 b/exercises/practice/bowling/.meta/template.j2 index eb8bfa5..d034019 100644 --- a/exercises/practice/bowling/.meta/template.j2 +++ b/exercises/practice/bowling/.meta/template.j2 @@ -21,12 +21,12 @@ replay_game = \rolls -> {% for case in cases -%} # {{ case["description"] }} expect - maybe_game = create { previous_rolls : {{ case["input"]["previous_rolls"] | to_roc }} } + maybe_game = create { previous_rolls : {{ case["input"]["previousRolls"] | to_roc }} } {%- if case["property"] == "score" %} result = maybe_game |> Result.try \game -> score game {%- else %} result = maybe_game |> Result.try \game -> - game |> {{ case["property"] | to_camel }} {{ case["input"]["roll"] }} + game |> {{ case["property"] | to_snake }} {{ case["input"]["roll"] }} {%- endif %} {%- if case["expected"]["error"] %} result |> Result.isErr @@ -37,11 +37,11 @@ expect # should be able to replay this finished game from the start expect - rolls = {{ case["input"]["previous_rolls"] | to_roc }} + rolls = {{ case["input"]["previousRolls"] | to_roc }} result = replay_game rolls result |> Result.isOk {%- endif %} -{% endfor %} +{% endfor %} \ No newline at end of file diff --git a/exercises/practice/bowling/bowling-test.roc b/exercises/practice/bowling/bowling-test.roc index eaf367d..0d020e0 100644 --- a/exercises/practice/bowling/bowling-test.roc +++ b/exercises/practice/bowling/bowling-test.roc @@ -1,327 +1,329 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/bowling/canonical-data.json -# File last updated on 2024-09-23 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Bowling exposing [Game, create, roll, score] -replayGame : List U64 -> Result Game _ -replayGame = \rolls -> - newGame = create? {} +replay_game : List U64 -> Result Game _ +replay_game = \rolls -> + new_game = create? {} rolls - |> List.walkUntil (Ok newGame) \state, pins -> + |> List.walkUntil (Ok new_game) \state, pins -> when state is Ok game -> when game |> roll pins is - Ok updatedGame -> Continue (Ok updatedGame) + Ok updated_game -> Continue (Ok updated_game) Err err -> Break (Err err) Err _ -> crash "Impossible, we don't start or Continue with an Err" # should be able to score a game with all zeros expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } + result = maybe_game |> Result.try \game -> score game result == Ok 0 # should be able to replay this finished game from the start expect rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # should be able to score a game with no strikes or spares expect - maybeGame = create { previousRolls: [3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6] } + result = maybe_game |> Result.try \game -> score game result == Ok 90 # should be able to replay this finished game from the start expect rolls = [3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # a spare followed by zeros is worth ten points expect - maybeGame = create { previousRolls: [6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } + result = maybe_game |> Result.try \game -> score game result == Ok 10 # should be able to replay this finished game from the start expect rolls = [6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # points scored in the roll after a spare are counted twice expect - maybeGame = create { previousRolls: [6, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [6, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } + result = maybe_game |> Result.try \game -> score game result == Ok 16 # should be able to replay this finished game from the start expect rolls = [6, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # consecutive spares each get a one roll bonus expect - maybeGame = create { previousRolls: [5, 5, 3, 7, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [5, 5, 3, 7, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } + result = maybe_game |> Result.try \game -> score game result == Ok 31 # should be able to replay this finished game from the start expect rolls = [5, 5, 3, 7, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # a spare in the last frame gets a one roll bonus that is counted once expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 7] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 7] } + result = maybe_game |> Result.try \game -> score game result == Ok 17 # should be able to replay this finished game from the start expect rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 7] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # a strike earns ten points in a frame with a single roll expect - maybeGame = create { previousRolls: [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } + result = maybe_game |> Result.try \game -> score game result == Ok 10 # should be able to replay this finished game from the start expect rolls = [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # points scored in the two rolls after a strike are counted twice as a bonus expect - maybeGame = create { previousRolls: [10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } + result = maybe_game |> Result.try \game -> score game result == Ok 26 # should be able to replay this finished game from the start expect rolls = [10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # consecutive strikes each get the two roll bonus expect - maybeGame = create { previousRolls: [10, 10, 10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [10, 10, 10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } + result = maybe_game |> Result.try \game -> score game result == Ok 81 # should be able to replay this finished game from the start expect rolls = [10, 10, 10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # a strike in the last frame gets a two roll bonus that is counted once expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 1] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 1] } + result = maybe_game |> Result.try \game -> score game result == Ok 18 # should be able to replay this finished game from the start expect rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 1] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # rolling a spare with the two roll bonus does not get a bonus roll expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 3] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 3] } + result = maybe_game |> Result.try \game -> score game result == Ok 20 # should be able to replay this finished game from the start expect rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 3] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # strikes with the two roll bonus do not get bonus rolls expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10] } + result = maybe_game |> Result.try \game -> score game result == Ok 30 # should be able to replay this finished game from the start expect rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # last two strikes followed by only last bonus with non strike points expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 1] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 1] } + result = maybe_game |> Result.try \game -> score game result == Ok 31 # should be able to replay this finished game from the start expect rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 1] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # a strike with the one roll bonus after a spare in the last frame does not get a bonus expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 10] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 10] } + result = maybe_game |> Result.try \game -> score game result == Ok 20 # should be able to replay this finished game from the start expect rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 10] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # all strikes is a perfect game expect - maybeGame = create { previousRolls: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10] } + result = maybe_game |> Result.try \game -> score game result == Ok 300 # should be able to replay this finished game from the start expect rolls = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # a roll cannot score more than 10 points expect - maybeGame = create { previousRolls: [] } + maybe_game = create { previous_rolls: [] } result = - maybeGame + maybe_game |> Result.try \game -> game |> roll 11 result |> Result.isErr # two rolls in a frame cannot score more than 10 points expect - maybeGame = create { previousRolls: [5] } + maybe_game = create { previous_rolls: [5] } result = - maybeGame + maybe_game |> Result.try \game -> game |> roll 6 result |> Result.isErr # bonus roll after a strike in the last frame cannot score more than 10 points expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10] } + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10] } result = - maybeGame + maybe_game |> Result.try \game -> game |> roll 11 result |> Result.isErr # two bonus rolls after a strike in the last frame cannot score more than 10 points expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5] } + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5] } result = - maybeGame + maybe_game |> Result.try \game -> game |> roll 6 result |> Result.isErr # two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6] } + result = maybe_game |> Result.try \game -> score game result == Ok 26 # should be able to replay this finished game from the start expect rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6] - result = replayGame rolls + result = replay_game rolls result |> Result.isOk # the second bonus rolls after a strike in the last frame cannot be a strike if the first one is not a strike expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6] } + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6] } result = - maybeGame + maybe_game |> Result.try \game -> game |> roll 10 result |> Result.isErr # second bonus roll after a strike in the last frame cannot score more than 10 points expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10] } + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10] } result = - maybeGame + maybe_game |> Result.try \game -> game |> roll 11 result |> Result.isErr # an unstarted game cannot be scored expect - maybeGame = create { previousRolls: [] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [] } + result = maybe_game |> Result.try \game -> score game result |> Result.isErr # an incomplete game cannot be scored expect - maybeGame = create { previousRolls: [0, 0] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [0, 0] } + result = maybe_game |> Result.try \game -> score game result |> Result.isErr # cannot roll if game already has ten frames expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } result = - maybeGame + maybe_game |> Result.try \game -> game |> roll 0 result |> Result.isErr # bonus rolls for a strike in the last frame must be rolled before score can be calculated expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10] } + result = maybe_game |> Result.try \game -> score game result |> Result.isErr # both bonus rolls for a strike in the last frame must be rolled before score can be calculated expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10] } + result = maybe_game |> Result.try \game -> score game result |> Result.isErr # bonus roll for a spare in the last frame must be rolled before score can be calculated expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3] } - result = maybeGame |> Result.try \game -> score game + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3] } + result = maybe_game |> Result.try \game -> score game result |> Result.isErr # cannot roll after bonus roll for spare expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 2] } + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 2] } result = - maybeGame + maybe_game |> Result.try \game -> game |> roll 2 result |> Result.isErr # cannot roll after bonus rolls for strike expect - maybeGame = create { previousRolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 3, 2] } + maybe_game = create { previous_rolls: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 3, 2] } result = - maybeGame + maybe_game |> Result.try \game -> game |> roll 2 result |> Result.isErr diff --git a/exercises/practice/change/.meta/template.j2 b/exercises/practice/change/.meta/template.j2 index af476cb..162890a 100644 --- a/exercises/practice/change/.meta/template.j2 +++ b/exercises/practice/change/.meta/template.j2 @@ -2,13 +2,13 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect coins = {{ case["input"]["coins"] | to_roc }} - result = coins |> {{ case["property"] | to_camel }} {{ case["input"]["target"] }} + result = coins |> {{ case["property"] | to_snake }} {{ case["input"]["target"] }} {%- if case["expected"]["error"] %} result |> Result.isErr {%- else %} diff --git a/exercises/practice/change/change-test.roc b/exercises/practice/change/change-test.roc index a8a5954..dda9a9f 100644 --- a/exercises/practice/change/change-test.roc +++ b/exercises/practice/change/change-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/change/canonical-data.json -# File last updated on 2024-10-08 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Change exposing [find_fewest_coins] diff --git a/exercises/practice/circular-buffer/.meta/Example.roc b/exercises/practice/circular-buffer/.meta/Example.roc index dc24518..de88b1a 100644 --- a/exercises/practice/circular-buffer/.meta/Example.roc +++ b/exercises/practice/circular-buffer/.meta/Example.roc @@ -37,5 +37,5 @@ overwrite = \{ data, start, length }, value -> { data: new_data, start, length: length + 1 } clear : CircularBuffer -> CircularBuffer -clear = \CircularBuffer -> - { data: CircularBuffer.data, start: 0, length: 0 } \ No newline at end of file +clear = \circular_buffer -> + { data: circular_buffer.data, start: 0, length: 0 } \ No newline at end of file diff --git a/exercises/practice/circular-buffer/.meta/template.j2 b/exercises/practice/circular-buffer/.meta/template.j2 index 22a309f..e08966a 100644 --- a/exercises/practice/circular-buffer/.meta/template.j2 +++ b/exercises/practice/circular-buffer/.meta/template.j2 @@ -6,7 +6,7 @@ import {{ exercise | to_pascal }} exposing [create, read, write, overwrite, clea {% for case in cases -%} # {{ case["description"] }} -run_operations{{ loop.index }} = +run_operations{{ loop.index }} = \_ -> result = create { capacity: {{ case["input"]["capacity"] }} } {%- for op in case["input"]["operations"] -%} @@ -27,12 +27,12 @@ run_operations{{ loop.index }} = {%- if op["should_succeed"] %} |> read? |> \read_result -> expect read_result.value == {{ op["expected"] }} - read_result.newBuffer + read_result.new_buffer {%- else %} - |> \bufferBeforeRead -> - read_result = bufferBeforeRead |> read + |> \buffer_before_read -> + read_result = buffer_before_read |> read expect read_result == Err BufferEmpty - bufferBeforeRead + buffer_before_read {%- endif %} {%- endif %} {%- endfor %} @@ -40,7 +40,7 @@ run_operations{{ loop.index }} = expect - result = run_operations{{ loop.index }} + result = run_operations{{ loop.index }} {} result |> Result.isOk {% endfor %} diff --git a/exercises/practice/circular-buffer/CircularBuffer.roc b/exercises/practice/circular-buffer/CircularBuffer.roc index 668f047..e0d090a 100644 --- a/exercises/practice/circular-buffer/CircularBuffer.roc +++ b/exercises/practice/circular-buffer/CircularBuffer.roc @@ -6,12 +6,12 @@ create : { capacity : U64 } -> CircularBuffer create = \{ capacity } -> crash "Please implement the 'create' function" -read : CircularBuffer -> Result { newBuffer : CircularBuffer, value : I64 } [BufferEmpty] +read : CircularBuffer -> Result { new_buffer : CircularBuffer, value : I64 } [BufferEmpty] read = \{ data, start, length } -> crash "Please implement the 'read' function" write : CircularBuffer, I64 -> Result CircularBuffer [BufferFull] -write = \circularBuffer, value -> +write = \circular_buffer, value -> crash "Please implement the 'write' function" overwrite : CircularBuffer, I64 -> CircularBuffer @@ -19,5 +19,5 @@ overwrite = \{ data, start, length }, value -> crash "Please implement the 'overwrite' function" clear : CircularBuffer -> CircularBuffer -clear = \circularBuffer -> +clear = \circular_buffer -> crash "Please implement the 'clear' function" diff --git a/exercises/practice/circular-buffer/circular-buffer-test.roc b/exercises/practice/circular-buffer/circular-buffer-test.roc index 74e8f62..de43322 100644 --- a/exercises/practice/circular-buffer/circular-buffer-test.roc +++ b/exercises/practice/circular-buffer/circular-buffer-test.roc @@ -1,288 +1,290 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/circular-buffer/canonical-data.json -# File last updated on 2024-09-15 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import CircularBuffer exposing [create, read, write, overwrite, clear] # reading empty buffer should fail -runOperations1 = +run_operations1 = \_ -> result = create { capacity: 1 } - |> \bufferBeforeRead -> - readResult = bufferBeforeRead |> read - expect readResult == Err BufferEmpty - bufferBeforeRead + |> \buffer_before_read -> + read_result = buffer_before_read |> read + expect read_result == Err BufferEmpty + buffer_before_read Ok result expect - result = runOperations1 + result = run_operations1 {} result |> Result.isOk # can read an item just written -runOperations2 = \_ -> +run_operations2 = \_ -> result = create { capacity: 1 } - |> write? 1 - |> read? - |> \readResult -> - expect readResult.value == 1 - readResult.newBuffer + |> write? 1 + |> read? + |> \read_result -> + expect read_result.value == 1 + read_result.new_buffer Ok result expect - result = runOperations2 {} + result = run_operations2 {} result |> Result.isOk # each item may only be read once -runOperations3 = \_ -> +run_operations3 = \_ -> result = create { capacity: 1 } - |> write? 1 - |> read? - |> \readResult -> - expect readResult.value == 1 - readResult.newBuffer - |> \bufferBeforeRead -> - readResult = bufferBeforeRead |> read - expect readResult == Err BufferEmpty - bufferBeforeRead + |> write? 1 + |> read? + |> \read_result -> + expect read_result.value == 1 + read_result.new_buffer + |> \buffer_before_read -> + read_result = buffer_before_read |> read + expect read_result == Err BufferEmpty + buffer_before_read Ok result expect - result = runOperations3 {} + result = run_operations3 {} result |> Result.isOk # items are read in the order they are written -runOperations4 = \_ -> +run_operations4 = \_ -> result = create { capacity: 2 } - |> write? 1 - |> write? 2 - |> read? - |> \readResult -> - expect readResult.value == 1 - readResult.newBuffer - |> read? - |> \readResult -> - expect readResult.value == 2 - readResult.newBuffer + |> write? 1 + |> write? 2 + |> read? + |> \read_result -> + expect read_result.value == 1 + read_result.new_buffer + |> read? + |> \read_result -> + expect read_result.value == 2 + read_result.new_buffer Ok result expect - result = runOperations4 {} + result = run_operations4 {} result |> Result.isOk # full buffer can't be written to -runOperations5 = \_ -> +run_operations5 = \_ -> result = create { capacity: 1 } - |> write? 1 - |> \bufferBeforeWrite -> - writeResult = bufferBeforeWrite |> write 2 - expect writeResult == Err BufferFull - bufferBeforeWrite + |> write? 1 + |> \buffer_before_write -> + write_result = buffer_before_write |> write 2 + expect write_result == Err BufferFull + buffer_before_write Ok result expect - result = runOperations5 {} + result = run_operations5 {} result |> Result.isOk # a read frees up capacity for another write -runOperations6 = \_ -> +run_operations6 = \_ -> result = create { capacity: 1 } - |> write? 1 - |> read? - |> \readResult -> - expect readResult.value == 1 - readResult.newBuffer - |> write? 2 - |> read? - |> \readResult -> - expect readResult.value == 2 - readResult.newBuffer + |> write? 1 + |> read? + |> \read_result -> + expect read_result.value == 1 + read_result.new_buffer + |> write? 2 + |> read? + |> \read_result -> + expect read_result.value == 2 + read_result.new_buffer Ok result expect - result = runOperations6 {} + result = run_operations6 {} result |> Result.isOk # read position is maintained even across multiple writes -runOperations7 = \_ -> +run_operations7 = \_ -> result = create { capacity: 3 } - |> write? 1 - |> write? 2 - |> read? - |> \readResult -> - expect readResult.value == 1 - readResult.newBuffer - |> write? 3 - |> read? - |> \readResult -> - expect readResult.value == 2 - readResult.newBuffer - |> read? - |> \readResult -> - expect readResult.value == 3 - readResult.newBuffer + |> write? 1 + |> write? 2 + |> read? + |> \read_result -> + expect read_result.value == 1 + read_result.new_buffer + |> write? 3 + |> read? + |> \read_result -> + expect read_result.value == 2 + read_result.new_buffer + |> read? + |> \read_result -> + expect read_result.value == 3 + read_result.new_buffer Ok result expect - result = runOperations7 {} + result = run_operations7 {} result |> Result.isOk # items cleared out of buffer can't be read -runOperations8 = \_ -> +run_operations8 = \_ -> result = create { capacity: 1 } - |> write? 1 - |> clear - |> \bufferBeforeRead -> - readResult = bufferBeforeRead |> read - expect readResult == Err BufferEmpty - bufferBeforeRead + |> write? 1 + |> clear + |> \buffer_before_read -> + read_result = buffer_before_read |> read + expect read_result == Err BufferEmpty + buffer_before_read Ok result expect - result = runOperations8 {} + result = run_operations8 {} result |> Result.isOk # clear frees up capacity for another write -runOperations9 = \_ -> +run_operations9 = \_ -> result = create { capacity: 1 } - |> write? 1 - |> clear - |> write? 2 - |> read? - |> \readResult -> - expect readResult.value == 2 - readResult.newBuffer + |> write? 1 + |> clear + |> write? 2 + |> read? + |> \read_result -> + expect read_result.value == 2 + read_result.new_buffer Ok result expect - result = runOperations9 {} + result = run_operations9 {} result |> Result.isOk # clear does nothing on empty buffer -runOperations10 = \_ -> +run_operations10 = \_ -> result = create { capacity: 1 } - |> clear - |> write? 1 - |> read? - |> \readResult -> - expect readResult.value == 1 - readResult.newBuffer + |> clear + |> write? 1 + |> read? + |> \read_result -> + expect read_result.value == 1 + read_result.new_buffer Ok result expect - result = runOperations10 {} + result = run_operations10 {} result |> Result.isOk # overwrite acts like write on non-full buffer -runOperations11 = \_ -> +run_operations11 = \_ -> result = create { capacity: 2 } - |> write? 1 - |> overwrite 2 - |> read? - |> \readResult -> - expect readResult.value == 1 - readResult.newBuffer - |> read? - |> \readResult -> - expect readResult.value == 2 - readResult.newBuffer + |> write? 1 + |> overwrite 2 + |> read? + |> \read_result -> + expect read_result.value == 1 + read_result.new_buffer + |> read? + |> \read_result -> + expect read_result.value == 2 + read_result.new_buffer Ok result expect - result = runOperations11 {} + result = run_operations11 {} result |> Result.isOk # overwrite replaces the oldest item on full buffer -runOperations12 = \_ -> +run_operations12 = \_ -> result = create { capacity: 2 } - |> write? 1 - |> write? 2 - |> overwrite 3 - |> read? - |> \readResult -> - expect readResult.value == 2 - readResult.newBuffer - |> read? - |> \readResult -> - expect readResult.value == 3 - readResult.newBuffer + |> write? 1 + |> write? 2 + |> overwrite 3 + |> read? + |> \read_result -> + expect read_result.value == 2 + read_result.new_buffer + |> read? + |> \read_result -> + expect read_result.value == 3 + read_result.new_buffer Ok result expect - result = runOperations12 {} + result = run_operations12 {} result |> Result.isOk # overwrite replaces the oldest item remaining in buffer following a read -runOperations13 = \_ -> +run_operations13 = \_ -> result = create { capacity: 3 } - |> write? 1 - |> write? 2 - |> write? 3 - |> read? - |> \readResult -> - expect readResult.value == 1 - readResult.newBuffer - |> write? 4 - |> overwrite 5 - |> read? - |> \readResult -> - expect readResult.value == 3 - readResult.newBuffer - |> read? - |> \readResult -> - expect readResult.value == 4 - readResult.newBuffer - |> read? - |> \readResult -> - expect readResult.value == 5 - readResult.newBuffer + |> write? 1 + |> write? 2 + |> write? 3 + |> read? + |> \read_result -> + expect read_result.value == 1 + read_result.new_buffer + |> write? 4 + |> overwrite 5 + |> read? + |> \read_result -> + expect read_result.value == 3 + read_result.new_buffer + |> read? + |> \read_result -> + expect read_result.value == 4 + read_result.new_buffer + |> read? + |> \read_result -> + expect read_result.value == 5 + read_result.new_buffer Ok result expect - result = runOperations13 {} + result = run_operations13 {} result |> Result.isOk # initial clear does not affect wrapping around -runOperations14 = \_ -> +run_operations14 = \_ -> result = create { capacity: 2 } - |> clear - |> write? 1 - |> write? 2 - |> overwrite 3 - |> overwrite 4 - |> read? - |> \readResult -> - expect readResult.value == 3 - readResult.newBuffer - |> read? - |> \readResult -> - expect readResult.value == 4 - readResult.newBuffer - |> \bufferBeforeRead -> - readResult = bufferBeforeRead |> read - expect readResult == Err BufferEmpty - bufferBeforeRead + |> clear + |> write? 1 + |> write? 2 + |> overwrite 3 + |> overwrite 4 + |> read? + |> \read_result -> + expect read_result.value == 3 + read_result.new_buffer + |> read? + |> \read_result -> + expect read_result.value == 4 + read_result.new_buffer + |> \buffer_before_read -> + read_result = buffer_before_read |> read + expect read_result == Err BufferEmpty + buffer_before_read Ok result expect - result = runOperations14 {} + result = run_operations14 {} result |> Result.isOk diff --git a/exercises/practice/clock/.meta/template.j2 b/exercises/practice/clock/.meta/template.j2 index 2eab9f6..8748b4b 100644 --- a/exercises/practice/clock/.meta/template.j2 +++ b/exercises/practice/clock/.meta/template.j2 @@ -16,7 +16,7 @@ expect {%- elif case["property"] in ["add", "subtract"] %} expect clock = create {{ plugins.to_hours_minutes_record(case["input"]) }} - result = clock |> {{ case["property"] | to_camel }} { minutes: {{ case["input"]["value"] }} } |> to_str + result = clock |> {{ case["property"] | to_snake }} { minutes: {{ case["input"]["value"] }} } |> to_str expected = {{ case["expected"] | to_roc }} result == expected {%- elif case["property"] == "equal" %} diff --git a/exercises/practice/clock/clock-test.roc b/exercises/practice/clock/clock-test.roc index 0e2cc01..6b113db 100644 --- a/exercises/practice/clock/clock-test.roc +++ b/exercises/practice/clock/clock-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/clock/canonical-data.json -# File last updated on 2024-10-13 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Clock exposing [create, add, subtract, to_str] diff --git a/exercises/practice/collatz-conjecture/.meta/template.j2 b/exercises/practice/collatz-conjecture/.meta/template.j2 index 04b4aa0..1e4e1cd 100644 --- a/exercises/practice/collatz-conjecture/.meta/template.j2 +++ b/exercises/practice/collatz-conjecture/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [steps] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["number"] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["number"] }} {%- if case["expected"]["error"] %} Result.isErr result {%- else %} diff --git a/exercises/practice/collatz-conjecture/collatz-conjecture-test.roc b/exercises/practice/collatz-conjecture/collatz-conjecture-test.roc index b2fd27d..576ef8e 100644 --- a/exercises/practice/collatz-conjecture/collatz-conjecture-test.roc +++ b/exercises/practice/collatz-conjecture/collatz-conjecture-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/collatz-conjecture/canonical-data.json -# File last updated on 2024-09-03 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import CollatzConjecture exposing [steps] diff --git a/exercises/practice/complex-numbers/complex-numbers-test.roc b/exercises/practice/complex-numbers/complex-numbers-test.roc index bdc6614..4795dc0 100644 --- a/exercises/practice/complex-numbers/complex-numbers-test.roc +++ b/exercises/practice/complex-numbers/complex-numbers-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/complex-numbers/canonical-data.json -# File last updated on 2024-09-21 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import ComplexNumbers exposing [real, imaginary, add, sub, mul, div, conjugate, abs, exp] diff --git a/exercises/practice/connect/.meta/template.j2 b/exercises/practice/connect/.meta/template.j2 index 32ed415..097deb0 100644 --- a/exercises/practice/connect/.meta/template.j2 +++ b/exercises/practice/connect/.meta/template.j2 @@ -2,13 +2,13 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect board = {{ case["input"]["board"] | to_roc_multiline_string | indent(8) }} - result = board |> {{ case["property"] | to_camel }} + result = board |> {{ case["property"] | to_snake }} result == {% if case["expected"] == "" %}Err NotFinished{% else %}Ok Player{{ case["expected"] }}{% endif %} {% endfor %} diff --git a/exercises/practice/connect/connect-test.roc b/exercises/practice/connect/connect-test.roc index 9344fe2..2c51faf 100644 --- a/exercises/practice/connect/connect-test.roc +++ b/exercises/practice/connect/connect-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/connect/canonical-data.json -# File last updated on 2024-09-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Connect exposing [winner] diff --git a/exercises/practice/crypto-square/.meta/template.j2 b/exercises/practice/crypto-square/.meta/template.j2 index 99e4fba..18b2756 100644 --- a/exercises/practice/crypto-square/.meta/template.j2 +++ b/exercises/practice/crypto-square/.meta/template.j2 @@ -2,13 +2,13 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect text = {{ case["input"]["plaintext"] | to_roc }} - result = {{ case["property"] | to_camel }} text + result = {{ case["property"] | to_snake }} text expected = Ok {{ case["expected"] | to_roc }} result == expected diff --git a/exercises/practice/crypto-square/crypto-square-test.roc b/exercises/practice/crypto-square/crypto-square-test.roc index ae3f6eb..63ae57a 100644 --- a/exercises/practice/crypto-square/crypto-square-test.roc +++ b/exercises/practice/crypto-square/crypto-square-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/crypto-square/canonical-data.json -# File last updated on 2024-10-10 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import CryptoSquare exposing [ciphertext] diff --git a/exercises/practice/custom-set/.meta/template.j2 b/exercises/practice/custom-set/.meta/template.j2 index 588735c..d1a9ba0 100644 --- a/exercises/practice/custom-set/.meta/template.j2 +++ b/exercises/practice/custom-set/.meta/template.j2 @@ -37,12 +37,12 @@ set property_map = { expect {%- if "set" in case["input"] %} set = from_list {{ case["input"]["set"] | to_roc }} - result = set |> {{ property | to_camel }} + result = set |> {{ property | to_snake }} {%- if "element" in case["input"] %} {{ case["input"]["element"] }}{%- endif %} {%- else %} set1 = from_list {{ case["input"]["set1"] | to_roc }} set2 = from_list {{ case["input"]["set2"] | to_roc }} - result = set1 |> {{ property | to_camel }} set2 + result = set1 |> {{ property | to_snake }} set2 {%- endif %} {%- if case["expected"] is iterable %} expected = {{ case["expected"] | to_roc }} |> from_list diff --git a/exercises/practice/custom-set/custom-set-test.roc b/exercises/practice/custom-set/custom-set-test.roc index 34930ba..47ca51e 100644 --- a/exercises/practice/custom-set/custom-set-test.roc +++ b/exercises/practice/custom-set/custom-set-test.roc @@ -1,24 +1,26 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/custom-set/canonical-data.json -# File last updated on 2024-10-11 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import CustomSet exposing [ contains, difference, - fromList, + from_list, insert, intersection, - isDisjointWith, - isEmpty, - isEq, - isSubsetOf, - toList, + is_disjoint_with, + is_empty, + is_eq, + is_subset_of, + to_list, union, ] @@ -29,16 +31,16 @@ import CustomSet exposing [ # sets with no elements are empty expect - set = fromList [] - result = set |> isEmpty + set = from_list [] + result = set |> is_empty expected = Bool.true result == expected # sets with elements are not empty expect - set = fromList [1] - result = set |> isEmpty + set = from_list [1] + result = set |> is_empty expected = Bool.false result == expected @@ -49,7 +51,7 @@ expect # nothing is contained in an empty set expect - set = fromList [] + set = from_list [] result = set |> contains 1 expected = Bool.false result == expected @@ -57,7 +59,7 @@ expect # when the element is in the set expect - set = fromList [1, 2, 3] + set = from_list [1, 2, 3] result = set |> contains 1 expected = Bool.true result == expected @@ -65,7 +67,7 @@ expect # when the element is not in the set expect - set = fromList [1, 2, 3] + set = from_list [1, 2, 3] result = set |> contains 4 expected = Bool.false result == expected @@ -77,54 +79,54 @@ expect # empty set is a subset of another empty set expect - set1 = fromList [] - set2 = fromList [] - result = set1 |> isSubsetOf set2 + set1 = from_list [] + set2 = from_list [] + result = set1 |> is_subset_of set2 expected = Bool.true result == expected # empty set is a subset of non-empty set expect - set1 = fromList [] - set2 = fromList [1] - result = set1 |> isSubsetOf set2 + set1 = from_list [] + set2 = from_list [1] + result = set1 |> is_subset_of set2 expected = Bool.true result == expected # non-empty set is not a subset of empty set expect - set1 = fromList [1] - set2 = fromList [] - result = set1 |> isSubsetOf set2 + set1 = from_list [1] + set2 = from_list [] + result = set1 |> is_subset_of set2 expected = Bool.false result == expected # set is a subset of set with exact same elements expect - set1 = fromList [1, 2, 3] - set2 = fromList [1, 2, 3] - result = set1 |> isSubsetOf set2 + set1 = from_list [1, 2, 3] + set2 = from_list [1, 2, 3] + result = set1 |> is_subset_of set2 expected = Bool.true result == expected # set is a subset of larger set with same elements expect - set1 = fromList [1, 2, 3] - set2 = fromList [4, 1, 2, 3] - result = set1 |> isSubsetOf set2 + set1 = from_list [1, 2, 3] + set2 = from_list [4, 1, 2, 3] + result = set1 |> is_subset_of set2 expected = Bool.true result == expected # set is not a subset of set that does not contain its elements expect - set1 = fromList [1, 2, 3] - set2 = fromList [4, 1, 3] - result = set1 |> isSubsetOf set2 + set1 = from_list [1, 2, 3] + set2 = from_list [4, 1, 3] + result = set1 |> is_subset_of set2 expected = Bool.false result == expected @@ -135,45 +137,45 @@ expect # the empty set is disjoint with itself expect - set1 = fromList [] - set2 = fromList [] - result = set1 |> isDisjointWith set2 + set1 = from_list [] + set2 = from_list [] + result = set1 |> is_disjoint_with set2 expected = Bool.true result == expected # empty set is disjoint with non-empty set expect - set1 = fromList [] - set2 = fromList [1] - result = set1 |> isDisjointWith set2 + set1 = from_list [] + set2 = from_list [1] + result = set1 |> is_disjoint_with set2 expected = Bool.true result == expected # non-empty set is disjoint with empty set expect - set1 = fromList [1] - set2 = fromList [] - result = set1 |> isDisjointWith set2 + set1 = from_list [1] + set2 = from_list [] + result = set1 |> is_disjoint_with set2 expected = Bool.true result == expected # sets are not disjoint if they share an element expect - set1 = fromList [1, 2] - set2 = fromList [2, 3] - result = set1 |> isDisjointWith set2 + set1 = from_list [1, 2] + set2 = from_list [2, 3] + result = set1 |> is_disjoint_with set2 expected = Bool.false result == expected # sets are disjoint if they share no elements expect - set1 = fromList [1, 2] - set2 = fromList [3, 4] - result = set1 |> isDisjointWith set2 + set1 = from_list [1, 2] + set2 = from_list [3, 4] + result = set1 |> is_disjoint_with set2 expected = Bool.true result == expected @@ -184,63 +186,63 @@ expect # empty sets are equal expect - set1 = fromList [] - set2 = fromList [] - result = set1 |> isEq set2 + set1 = from_list [] + set2 = from_list [] + result = set1 |> is_eq set2 expected = Bool.true result == expected # empty set is not equal to non-empty set expect - set1 = fromList [] - set2 = fromList [1, 2, 3] - result = set1 |> isEq set2 + set1 = from_list [] + set2 = from_list [1, 2, 3] + result = set1 |> is_eq set2 expected = Bool.false result == expected # non-empty set is not equal to empty set expect - set1 = fromList [1, 2, 3] - set2 = fromList [] - result = set1 |> isEq set2 + set1 = from_list [1, 2, 3] + set2 = from_list [] + result = set1 |> is_eq set2 expected = Bool.false result == expected # sets with the same elements are equal expect - set1 = fromList [1, 2] - set2 = fromList [2, 1] - result = set1 |> isEq set2 + set1 = from_list [1, 2] + set2 = from_list [2, 1] + result = set1 |> is_eq set2 expected = Bool.true result == expected # sets with different elements are not equal expect - set1 = fromList [1, 2, 3] - set2 = fromList [1, 2, 4] - result = set1 |> isEq set2 + set1 = from_list [1, 2, 3] + set2 = from_list [1, 2, 4] + result = set1 |> is_eq set2 expected = Bool.false result == expected # set is not equal to larger set with same elements expect - set1 = fromList [1, 2, 3] - set2 = fromList [1, 2, 3, 4] - result = set1 |> isEq set2 + set1 = from_list [1, 2, 3] + set2 = from_list [1, 2, 3, 4] + result = set1 |> is_eq set2 expected = Bool.false result == expected # set is equal to a set constructed from an array with duplicates expect - set1 = fromList [1] - set2 = fromList [1, 1] - result = set1 |> isEq set2 + set1 = from_list [1] + set2 = from_list [1, 1] + result = set1 |> is_eq set2 expected = Bool.true result == expected @@ -251,26 +253,26 @@ expect # add to empty set expect - set = fromList [] + set = from_list [] result = set |> insert 3 - expected = [3] |> fromList - result |> isEq expected + expected = [3] |> from_list + result |> is_eq expected # add to non-empty set expect - set = fromList [1, 2, 4] + set = from_list [1, 2, 4] result = set |> insert 3 - expected = [1, 2, 3, 4] |> fromList - result |> isEq expected + expected = [1, 2, 3, 4] |> from_list + result |> is_eq expected # adding an existing element does not change the set expect - set = fromList [1, 2, 3] + set = from_list [1, 2, 3] result = set |> insert 3 - expected = [1, 2, 3] |> fromList - result |> isEq expected + expected = [1, 2, 3] |> from_list + result |> is_eq expected ## ## Intersection returns a set of all shared elements @@ -279,47 +281,47 @@ expect # intersection of two empty sets is an empty set expect - set1 = fromList [] - set2 = fromList [] + set1 = from_list [] + set2 = from_list [] result = set1 |> intersection set2 - expected = [] |> fromList - result |> isEq expected + expected = [] |> from_list + result |> is_eq expected # intersection of an empty set and non-empty set is an empty set expect - set1 = fromList [] - set2 = fromList [3, 2, 5] + set1 = from_list [] + set2 = from_list [3, 2, 5] result = set1 |> intersection set2 - expected = [] |> fromList - result |> isEq expected + expected = [] |> from_list + result |> is_eq expected # intersection of a non-empty set and an empty set is an empty set expect - set1 = fromList [1, 2, 3, 4] - set2 = fromList [] + set1 = from_list [1, 2, 3, 4] + set2 = from_list [] result = set1 |> intersection set2 - expected = [] |> fromList - result |> isEq expected + expected = [] |> from_list + result |> is_eq expected # intersection of two sets with no shared elements is an empty set expect - set1 = fromList [1, 2, 3] - set2 = fromList [4, 5, 6] + set1 = from_list [1, 2, 3] + set2 = from_list [4, 5, 6] result = set1 |> intersection set2 - expected = [] |> fromList - result |> isEq expected + expected = [] |> from_list + result |> is_eq expected # intersection of two sets with shared elements is a set of the shared elements expect - set1 = fromList [1, 2, 3, 4] - set2 = fromList [3, 2, 5] + set1 = from_list [1, 2, 3, 4] + set2 = from_list [3, 2, 5] result = set1 |> intersection set2 - expected = [2, 3] |> fromList - result |> isEq expected + expected = [2, 3] |> from_list + result |> is_eq expected ## ## Difference (or Complement) of a set is a set of all elements that are only in the first set @@ -328,47 +330,47 @@ expect # difference of two empty sets is an empty set expect - set1 = fromList [] - set2 = fromList [] + set1 = from_list [] + set2 = from_list [] result = set1 |> difference set2 - expected = [] |> fromList - result |> isEq expected + expected = [] |> from_list + result |> is_eq expected # difference of empty set and non-empty set is an empty set expect - set1 = fromList [] - set2 = fromList [3, 2, 5] + set1 = from_list [] + set2 = from_list [3, 2, 5] result = set1 |> difference set2 - expected = [] |> fromList - result |> isEq expected + expected = [] |> from_list + result |> is_eq expected # difference of a non-empty set and an empty set is the non-empty set expect - set1 = fromList [1, 2, 3, 4] - set2 = fromList [] + set1 = from_list [1, 2, 3, 4] + set2 = from_list [] result = set1 |> difference set2 - expected = [1, 2, 3, 4] |> fromList - result |> isEq expected + expected = [1, 2, 3, 4] |> from_list + result |> is_eq expected # difference of two non-empty sets is a set of elements that are only in the first set expect - set1 = fromList [3, 2, 1] - set2 = fromList [2, 4] + set1 = from_list [3, 2, 1] + set2 = from_list [2, 4] result = set1 |> difference set2 - expected = [1, 3] |> fromList - result |> isEq expected + expected = [1, 3] |> from_list + result |> is_eq expected # difference removes all duplicates in the first set expect - set1 = fromList [1, 1] - set2 = fromList [1] + set1 = from_list [1, 1] + set2 = from_list [1] result = set1 |> difference set2 - expected = [] |> fromList - result |> isEq expected + expected = [] |> from_list + result |> is_eq expected ## ## Union returns a set of all elements in either set @@ -377,38 +379,38 @@ expect # union of empty sets is an empty set expect - set1 = fromList [] - set2 = fromList [] + set1 = from_list [] + set2 = from_list [] result = set1 |> union set2 - expected = [] |> fromList - result |> isEq expected + expected = [] |> from_list + result |> is_eq expected # union of an empty set and non-empty set is the non-empty set expect - set1 = fromList [] - set2 = fromList [2] + set1 = from_list [] + set2 = from_list [2] result = set1 |> union set2 - expected = [2] |> fromList - result |> isEq expected + expected = [2] |> from_list + result |> is_eq expected # union of a non-empty set and empty set is the non-empty set expect - set1 = fromList [1, 3] - set2 = fromList [] + set1 = from_list [1, 3] + set2 = from_list [] result = set1 |> union set2 - expected = [1, 3] |> fromList - result |> isEq expected + expected = [1, 3] |> from_list + result |> is_eq expected # union of non-empty sets contains all unique elements expect - set1 = fromList [1, 3] - set2 = fromList [2, 3] + set1 = from_list [1, 3] + set2 = from_list [2, 3] result = set1 |> union set2 - expected = [3, 2, 1] |> fromList - result |> isEq expected + expected = [3, 2, 1] |> from_list + result |> is_eq expected ## ## A set can be converted to a list of items @@ -416,22 +418,22 @@ expect # an empty set has an empty list of items expect - set = fromList [] - result = set |> toList |> List.sortAsc + set = from_list [] + result = set |> to_list |> List.sortAsc expected = [] result == expected # a set can provide the list of its items expect - set = fromList [1, 2, 3, 4] - result = set |> toList |> List.sortAsc + set = from_list [1, 2, 3, 4] + result = set |> to_list |> List.sortAsc expected = [1, 2, 3, 4] result == expected # duplicate items must be removed expect - set = fromList [1, 2, 2, 3, 3, 3, 4, 4, 4, 4] - result = set |> toList |> List.sortAsc + set = from_list [1, 2, 2, 3, 3, 3, 4, 4, 4, 4] + result = set |> to_list |> List.sortAsc expected = [1, 2, 3, 4] result == expected diff --git a/exercises/practice/darts/.meta/template.j2 b/exercises/practice/darts/.meta/template.j2 index 15c4a5a..1f2a9d9 100644 --- a/exercises/practice/darts/.meta/template.j2 +++ b/exercises/practice/darts/.meta/template.j2 @@ -7,7 +7,7 @@ import Darts exposing [score] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["x"] | to_roc_float }} {{ case["input"]["y"] | to_roc_float }} + result = {{ case["property"] | to_snake }} {{ case["input"]["x"] | to_roc_float }} {{ case["input"]["y"] | to_roc_float }} result == {{ case["expected"] }} {% endfor %} diff --git a/exercises/practice/darts/darts-test.roc b/exercises/practice/darts/darts-test.roc index 9e4582a..080a720 100644 --- a/exercises/practice/darts/darts-test.roc +++ b/exercises/practice/darts/darts-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/darts/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Darts exposing [score] diff --git a/exercises/practice/diamond/.meta/template.j2 b/exercises/practice/diamond/.meta/template.j2 index 35d0080..f4ac0f5 100644 --- a/exercises/practice/diamond/.meta/template.j2 +++ b/exercises/practice/diamond/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ exercise | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ exercise | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ exercise | to_camel }} '{{ case["input"]["letter"] }}' + result = {{ exercise | to_snake }} '{{ case["input"]["letter"] }}' expected = {{ case["expected"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replaceEach "·" " " result == expected diff --git a/exercises/practice/diamond/diamond-test.roc b/exercises/practice/diamond/diamond-test.roc index 7338baa..6e9582a 100644 --- a/exercises/practice/diamond/diamond-test.roc +++ b/exercises/practice/diamond/diamond-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/diamond/canonical-data.json -# File last updated on 2024-09-04 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Diamond exposing [diamond] diff --git a/exercises/practice/difference-of-squares/.meta/config.json b/exercises/practice/difference-of-squares/.meta/config.json index fdd0b2e..4c6e2cf 100644 --- a/exercises/practice/difference-of-squares/.meta/config.json +++ b/exercises/practice/difference-of-squares/.meta/config.json @@ -4,7 +4,7 @@ ], "files": { "solution": [ - "difference_of_squares.roc" + "DifferenceOfSquares.roc" ], "test": [ "difference-of-squares-test.roc" diff --git a/exercises/practice/difference-of-squares/.meta/template.j2 b/exercises/practice/difference-of-squares/.meta/template.j2 index d8badfe..59b84b7 100644 --- a/exercises/practice/difference-of-squares/.meta/template.j2 +++ b/exercises/practice/difference-of-squares/.meta/template.j2 @@ -2,7 +2,7 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import difference_of_squares exposing [square_of_sum, sum_of_squares, difference_of_squares] +import DifferenceOfSquares exposing [square_of_sum, sum_of_squares, difference_of_squares] {% for supercase in cases %} ## @@ -12,7 +12,7 @@ import difference_of_squares exposing [square_of_sum, sum_of_squares, difference {% for case in supercase["cases"] -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["number"] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["number"] }} result == {{ case["expected"] }} {% endfor %} diff --git a/exercises/practice/difference-of-squares/difference-of-squares-test.roc b/exercises/practice/difference-of-squares/difference-of-squares-test.roc index 129ace6..1f61717 100644 --- a/exercises/practice/difference-of-squares/difference-of-squares-test.roc +++ b/exercises/practice/difference-of-squares/difference-of-squares-test.roc @@ -1,14 +1,16 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/difference-of-squares/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" -import difference_of_squares exposing [square_of_sum, sum_of_squares, difference_of_squares] +import DifferenceOfSquares exposing [square_of_sum, sum_of_squares, difference_of_squares] ## ## Square the sum of the numbers up to the given number diff --git a/exercises/practice/dominoes/dominoes-test.roc b/exercises/practice/dominoes/dominoes-test.roc index c0a7e60..615e88a 100644 --- a/exercises/practice/dominoes/dominoes-test.roc +++ b/exercises/practice/dominoes/dominoes-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/dominoes/canonical-data.json -# File last updated on 2024-09-21 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Dominoes exposing [find_chain] diff --git a/exercises/practice/eliuds-eggs/.meta/template.j2 b/exercises/practice/eliuds-eggs/.meta/template.j2 index 28f464b..196d502 100644 --- a/exercises/practice/eliuds-eggs/.meta/template.j2 +++ b/exercises/practice/eliuds-eggs/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["number"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["number"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/eliuds-eggs/eliuds-eggs-test.roc b/exercises/practice/eliuds-eggs/eliuds-eggs-test.roc index c7c337e..affbbc7 100644 --- a/exercises/practice/eliuds-eggs/eliuds-eggs-test.roc +++ b/exercises/practice/eliuds-eggs/eliuds-eggs-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/eliuds-eggs/canonical-data.json -# File last updated on 2024-09-04 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import EliudsEggs exposing [egg_count] diff --git a/exercises/practice/error-handling/error-handling-test.roc b/exercises/practice/error-handling/error-handling-test.roc index fac5ae4..9fca35d 100644 --- a/exercises/practice/error-handling/error-handling-test.roc +++ b/exercises/practice/error-handling/error-handling-test.roc @@ -1,10 +1,12 @@ # File last updated on 2024-09-12 -app [main] { +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import ErrorHandling exposing [get_user, parse_user_id, get_page, error_message] diff --git a/exercises/practice/etl/etl-test.roc b/exercises/practice/etl/etl-test.roc index ae96293..192b72b 100644 --- a/exercises/practice/etl/etl-test.roc +++ b/exercises/practice/etl/etl-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/etl/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Etl exposing [transform] diff --git a/exercises/practice/flatten-array/.meta/template.j2 b/exercises/practice/flatten-array/.meta/template.j2 index b7345cc..a36cde7 100644 --- a/exercises/practice/flatten-array/.meta/template.j2 +++ b/exercises/practice/flatten-array/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} ({{ plugins.to_nested(case["input"]["array"]) }}) + result = {{ case["property"] | to_snake }} ({{ plugins.to_nested(case["input"]["array"]) }}) result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/flatten-array/flatten-array-test.roc b/exercises/practice/flatten-array/flatten-array-test.roc index 1661256..d987870 100644 --- a/exercises/practice/flatten-array/flatten-array-test.roc +++ b/exercises/practice/flatten-array/flatten-array-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/flatten-array/canonical-data.json -# File last updated on 2024-08-28 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import FlattenArray exposing [flatten] diff --git a/exercises/practice/food-chain/.meta/template.j2 b/exercises/practice/food-chain/.meta/template.j2 index 3ae9e44..4826b8b 100644 --- a/exercises/practice/food-chain/.meta/template.j2 +++ b/exercises/practice/food-chain/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["start_verse"] | to_roc }} {{ case["input"]["end_verse"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["startVerse"] | to_roc }} {{ case["input"]["endVerse"] | to_roc }} result == {{ case["expected"] | join('\n') | to_roc_multiline_string | indent(8) }} -{% endfor %} +{% endfor %} \ No newline at end of file diff --git a/exercises/practice/food-chain/food-chain-test.roc b/exercises/practice/food-chain/food-chain-test.roc index 53d7e59..fbf5339 100644 --- a/exercises/practice/food-chain/food-chain-test.roc +++ b/exercises/practice/food-chain/food-chain-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/food-chain/canonical-data.json -# File last updated on 2024-09-22 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import FoodChain exposing [recite] diff --git a/exercises/practice/forth/forth-test.roc b/exercises/practice/forth/forth-test.roc index 556a5a3..7c783fd 100644 --- a/exercises/practice/forth/forth-test.roc +++ b/exercises/practice/forth/forth-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/forth/canonical-data.json -# File last updated on 2024-09-07 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Forth exposing [evaluate] @@ -279,3 +281,4 @@ expect 1 swap """ result == Ok [1, 1, 1, 1] + diff --git a/exercises/practice/gigasecond/.meta/template.j2 b/exercises/practice/gigasecond/.meta/template.j2 index 83ccccc..be2140c 100644 --- a/exercises/practice/gigasecond/.meta/template.j2 +++ b/exercises/practice/gigasecond/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [add] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["moment"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["moment"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/gigasecond/gigasecond-test.roc b/exercises/practice/gigasecond/gigasecond-test.roc index ce75f4d..cdf2716 100644 --- a/exercises/practice/gigasecond/gigasecond-test.roc +++ b/exercises/practice/gigasecond/gigasecond-test.roc @@ -1,13 +1,15 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/gigasecond/canonical-data.json -# File last updated on 2024-10-18 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", isodate: "https://github.com/Anton-4/roc-isodate/releases/download/0.6.0/_n7UX8f5aFVVIXNa2AtOCvd-dcU-n-fp-0o8d22fyuQ.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Gigasecond exposing [add] diff --git a/exercises/practice/go-counting/.meta/template.j2 b/exercises/practice/go-counting/.meta/template.j2 index e434238..aaa0568 100644 --- a/exercises/practice/go-counting/.meta/template.j2 +++ b/exercises/practice/go-counting/.meta/template.j2 @@ -34,7 +34,7 @@ compareTerritories = \maybe_result, maybe_expected -> # {{ case["description"] }} expect board = {{ case["input"]["board"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replaceEach "·" " " - result = board |> {{ case["property"] | to_camel }} + result = board |> {{ case["property"] | to_snake }} {%- if case["property"] == "territory" %} { x : {{ case["input"]["x"] }}, y : {{ case["input"]["y"] }} }{% endif %} {%- if case["expected"]["error"] %} result |> Result.isErr diff --git a/exercises/practice/go-counting/go-counting-test.roc b/exercises/practice/go-counting/go-counting-test.roc index cea18fc..2a74485 100644 --- a/exercises/practice/go-counting/go-counting-test.roc +++ b/exercises/practice/go-counting/go-counting-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/go-counting/canonical-data.json -# File last updated on 2024-10-07 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import GoCounting exposing [territory, territories] @@ -14,13 +16,13 @@ import GoCounting exposing [territory, territories] ## comparing tags or records containing sets sometimes returns the wrong result ## depending on the internal order of the set data, so we have to unwrap the sets ## in order to compare them properly. -compareTerritory = \maybeResult, maybeExpected -> - when (maybeResult, maybeExpected) is +compareTerritory = \maybe_result, maybe_expected -> + when (maybe_result, maybe_expected) is (Ok result, Ok expected) -> result.owner == expected.owner && result.territory == expected.territory _ -> Bool.false -compareTerritories = \maybeResult, maybeExpected -> - when (maybeResult, maybeExpected) is +compareTerritories = \maybe_result, maybe_expected -> + when (maybe_result, maybe_expected) is (Ok result, Ok expected) -> result.black == expected.black && result.white == expected.white && result.none == expected.none _ -> Bool.false @@ -140,7 +142,9 @@ expect result = board |> territories expected = Ok { black: Set.empty {}, + white: Set.empty {}, + none: Set.fromList [ { x: 0, y: 0 }, ], @@ -161,10 +165,12 @@ expect { x: 0, y: 0 }, { x: 0, y: 1 }, ], + white: Set.fromList [ { x: 3, y: 0 }, { x: 3, y: 1 }, ], + none: Set.empty {}, } result |> compareTerritories expected @@ -178,7 +184,9 @@ expect { x: 0, y: 0 }, { x: 2, y: 0 }, ], + white: Set.empty {}, + none: Set.empty {}, } result |> compareTerritories expected diff --git a/exercises/practice/grains/grains-test.roc b/exercises/practice/grains/grains-test.roc index c65425f..ca8c5b5 100644 --- a/exercises/practice/grains/grains-test.roc +++ b/exercises/practice/grains/grains-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/grains/canonical-data.json -# File last updated on 2024-09-03 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Grains exposing [grains_on_square, total_grains] diff --git a/exercises/practice/grep/.meta/template.j2 b/exercises/practice/grep/.meta/template.j2 index 6e9bd7c..34afad9 100644 --- a/exercises/practice/grep/.meta/template.j2 +++ b/exercises/practice/grep/.meta/template.j2 @@ -8,7 +8,7 @@ import {{ exercise | to_pascal }} exposing [grep] {% for innerCase in case["cases"] -%} # {{ case["description"] }} - {{ innerCase["description"] }} expect - result = {{ innerCase["property"] | to_camel }} {{ innerCase["input"]["pattern"] | to_roc }} {{ innerCase["input"]["flags"] | to_roc }} {{ innerCase["input"]["files"] | to_roc }} + result = {{ innerCase["property"] | to_snake }} {{ innerCase["input"]["pattern"] | to_roc }} {{ innerCase["input"]["flags"] | to_roc }} {{ innerCase["input"]["files"] | to_roc }} result == Ok {{ innerCase["expected"] | join('\n') | to_roc_multiline_string | indent(8) }} {% endfor %} diff --git a/exercises/practice/grep/grep-test.roc b/exercises/practice/grep/grep-test.roc index b3a0233..2870729 100644 --- a/exercises/practice/grep/grep-test.roc +++ b/exercises/practice/grep/grep-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/grep/canonical-data.json -# File last updated on 2024-09-15 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Grep exposing [grep] diff --git a/exercises/practice/hamming/.meta/template.j2 b/exercises/practice/hamming/.meta/template.j2 index 5a2f717..6816105 100644 --- a/exercises/practice/hamming/.meta/template.j2 +++ b/exercises/practice/hamming/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["strand1"] | to_roc }} {{ case["input"]["strand2"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["strand1"] | to_roc }} {{ case["input"]["strand2"] | to_roc }} {%- if case["expected"]["error"] %} Result.isErr result {%- else %} diff --git a/exercises/practice/hamming/hamming-test.roc b/exercises/practice/hamming/hamming-test.roc index 9d096b0..d25f5a4 100644 --- a/exercises/practice/hamming/hamming-test.roc +++ b/exercises/practice/hamming/hamming-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/hamming/canonical-data.json -# File last updated on 2024-09-03 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Hamming exposing [distance] diff --git a/exercises/practice/hello-world/hello-world-test.roc b/exercises/practice/hello-world/hello-world-test.roc index 71e94bb..f90ea40 100644 --- a/exercises/practice/hello-world/hello-world-test.roc +++ b/exercises/practice/hello-world/hello-world-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/hello-world/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import HelloWorld exposing [hello] diff --git a/exercises/practice/hexadecimal/hexadecimal-test.roc b/exercises/practice/hexadecimal/hexadecimal-test.roc index aaf39b2..8874e93 100644 --- a/exercises/practice/hexadecimal/hexadecimal-test.roc +++ b/exercises/practice/hexadecimal/hexadecimal-test.roc @@ -1,9 +1,11 @@ -app [main] { +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Hexadecimal exposing [parse] diff --git a/exercises/practice/high-scores/.meta/template.j2 b/exercises/practice/high-scores/.meta/template.j2 index 6f67bd0..0b17d12 100644 --- a/exercises/practice/high-scores/.meta/template.j2 +++ b/exercises/practice/high-scores/.meta/template.j2 @@ -16,8 +16,8 @@ import {{ exercise | to_pascal }} exposing [latest, personal_best, personal_top_ # {{ case["description"] }} {%- endif %} expect - result = {{ case["property"] }} {{ case["input"]["scores"] }} - result == {% if case["property"] != "personal_top_three" %}Ok {% endif %}{{ case["expected"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["scores"] }} + result == {% if case["property"] != "personalTopThree" %}Ok {% endif %}{{ case["expected"] | to_roc }} {% endfor -%} {%- endfor %} diff --git a/exercises/practice/high-scores/high-scores-test.roc b/exercises/practice/high-scores/high-scores-test.roc index a98d7b8..62356fb 100644 --- a/exercises/practice/high-scores/high-scores-test.roc +++ b/exercises/practice/high-scores/high-scores-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/high-scores/canonical-data.json -# File last updated on 2024-10-06 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import HighScores exposing [latest, personal_best, personal_top_three] diff --git a/exercises/practice/house/.meta/template.j2 b/exercises/practice/house/.meta/template.j2 index 057abdf..a2c0bb0 100644 --- a/exercises/practice/house/.meta/template.j2 +++ b/exercises/practice/house/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["start_verse"] }} {{ case["input"]["end_verse"] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["startVerse"] }} {{ case["input"]["endVerse"] }} result == {{ "\n".join(case["expected"]) | to_roc }} {% endfor %} diff --git a/exercises/practice/house/house-test.roc b/exercises/practice/house/house-test.roc index 9b3702a..a60f07b 100644 --- a/exercises/practice/house/house-test.roc +++ b/exercises/practice/house/house-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/house/canonical-data.json -# File last updated on 2024-08-28 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import House exposing [recite] diff --git a/exercises/practice/isbn-verifier/.meta/template.j2 b/exercises/practice/isbn-verifier/.meta/template.j2 index d7935a0..e3258a2 100644 --- a/exercises/practice/isbn-verifier/.meta/template.j2 +++ b/exercises/practice/isbn-verifier/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [isValid] +import {{ exercise | to_pascal }} exposing [is_valid] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["isbn"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["isbn"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/isbn-verifier/isbn-verifier-test.roc b/exercises/practice/isbn-verifier/isbn-verifier-test.roc index 0dbf3a3..a932549 100644 --- a/exercises/practice/isbn-verifier/isbn-verifier-test.roc +++ b/exercises/practice/isbn-verifier/isbn-verifier-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/isbn-verifier/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import IsbnVerifier exposing [is_valid] diff --git a/exercises/practice/isogram/.meta/template.j2 b/exercises/practice/isogram/.meta/template.j2 index 3a82c89..35c5b09 100644 --- a/exercises/practice/isogram/.meta/template.j2 +++ b/exercises/practice/isogram/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [is_isogram] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["phrase"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["phrase"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/isogram/isogram-test.roc b/exercises/practice/isogram/isogram-test.roc index 06e3377..c4d324f 100644 --- a/exercises/practice/isogram/isogram-test.roc +++ b/exercises/practice/isogram/isogram-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/isogram/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Isogram exposing [is_isogram] diff --git a/exercises/practice/killer-sudoku-helper/killer-sudoku-helper-test.roc b/exercises/practice/killer-sudoku-helper/killer-sudoku-helper-test.roc index 26e15ff..2c91275 100644 --- a/exercises/practice/killer-sudoku-helper/killer-sudoku-helper-test.roc +++ b/exercises/practice/killer-sudoku-helper/killer-sudoku-helper-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/killer-sudoku-helper/canonical-data.json -# File last updated on 2024-09-28 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import KillerSudokuHelper exposing [combinations] diff --git a/exercises/practice/kindergarten-garden/.meta/template.j2 b/exercises/practice/kindergarten-garden/.meta/template.j2 index 40f0318..00bde51 100644 --- a/exercises/practice/kindergarten-garden/.meta/template.j2 +++ b/exercises/practice/kindergarten-garden/.meta/template.j2 @@ -21,7 +21,7 @@ import {{ exercise | to_pascal }} exposing [plants] # {{ subcase["description"] }} expect diagram = {{ subcase["input"]["diagram"] | to_roc_multiline_string | indent(8) }} - result = diagram |> {{ subcase["property"] | to_camel }} {{ subcase["input"]["student"] | to_pascal }} + result = diagram |> {{ subcase["property"] | to_snake }} {{ subcase["input"]["student"] | to_pascal }} result == Ok [{% for plant in subcase["expected"] %}{{ plant | to_pascal }}, {% endfor %}] {% endfor %} diff --git a/exercises/practice/kindergarten-garden/kindergarten-garden-test.roc b/exercises/practice/kindergarten-garden/kindergarten-garden-test.roc index abd7a44..ac1433d 100644 --- a/exercises/practice/kindergarten-garden/kindergarten-garden-test.roc +++ b/exercises/practice/kindergarten-garden/kindergarten-garden-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/kindergarten-garden/canonical-data.json -# File last updated on 2024-09-26 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import KindergartenGarden exposing [plants] diff --git a/exercises/practice/knapsack/.meta/Example.roc b/exercises/practice/knapsack/.meta/Example.roc index aac44f9..be1a6b0 100644 --- a/exercises/practice/knapsack/.meta/Example.roc +++ b/exercises/practice/knapsack/.meta/Example.roc @@ -1,15 +1,15 @@ -module [maxium_value] +module [maximum_value] Item : { weight : U64, value : U64 } -maxium_value : { items : List Item, maximum_weight : U64 } -> U64 -maxium_value = \{ items, maximum_weight } -> +maximum_value : { items : List Item, maximum_weight : U64 } -> U64 +maximum_value = \{ items, maximum_weight } -> when items is [] -> 0 [item, .. as rest] -> - max_value_without_item = maxium_value { items: rest, maximum_weight } + max_value_without_item = maximum_value { items: rest, maximum_weight } if item.weight > maximum_weight then max_value_without_item else - max_value_with_item = item.value + maxium_value { items: rest, maximum_weight: maximum_weight - item.weight } + max_value_with_item = item.value + maximum_value { items: rest, maximum_weight: maximum_weight - item.weight } Num.max max_value_without_item max_value_with_item diff --git a/exercises/practice/knapsack/.meta/template.j2 b/exercises/practice/knapsack/.meta/template.j2 index 64e5b21..18c7358 100644 --- a/exercises/practice/knapsack/.meta/template.j2 +++ b/exercises/practice/knapsack/.meta/template.j2 @@ -2,7 +2,7 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} @@ -16,7 +16,7 @@ expect {%- endfor %} ] {%- endif %} - result = {{ case["property"] | to_camel }} { items, maximum_weight: {{ case["input"]["maximum_weight"] }} } + result = {{ case["property"] | to_snake }} { items, maximum_weight: {{ case["input"]["maximumWeight"] }} } result == {{ case["expected"] | to_roc }} -{% endfor %} +{% endfor %} \ No newline at end of file diff --git a/exercises/practice/knapsack/Knapsack.roc b/exercises/practice/knapsack/Knapsack.roc index fe3936a..5737b7f 100644 --- a/exercises/practice/knapsack/Knapsack.roc +++ b/exercises/practice/knapsack/Knapsack.roc @@ -1,7 +1,7 @@ -module [maxium_value] +module [maximum_value] Item : { weight : U64, value : U64 } -maxium_value : { items : List Item, maximum_weight : U64 } -> U64 -maxium_value = \{ items, maximum_weight } -> - crash "Please implement the 'maxium_value' function" +maximum_value : { items : List Item, maximum_weight : U64 } -> U64 +maximum_value = \{ items, maximum_weight } -> + crash "Please implement the 'maximum_value' function" diff --git a/exercises/practice/knapsack/knapsack-test.roc b/exercises/practice/knapsack/knapsack-test.roc index 1aa019a..9631ccd 100644 --- a/exercises/practice/knapsack/knapsack-test.roc +++ b/exercises/practice/knapsack/knapsack-test.roc @@ -1,19 +1,21 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/knapsack/canonical-data.json -# File last updated on 2024-10-06 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" -import Knapsack exposing [maxium_value] +import Knapsack exposing [maximum_value] # no items expect items = [] - result = maxium_value { items, maximum_weight: 100 } + result = maximum_value { items, maximum_weight: 100 } result == 0 # one item, too heavy @@ -21,7 +23,7 @@ expect items = [ { weight: 100, value: 1 }, ] - result = maxium_value { items, maximum_weight: 10 } + result = maximum_value { items, maximum_weight: 10 } result == 0 # five items (cannot be greedy by weight) @@ -33,7 +35,7 @@ expect { weight: 2, value: 5 }, { weight: 10, value: 21 }, ] - result = maxium_value { items, maximum_weight: 10 } + result = maximum_value { items, maximum_weight: 10 } result == 21 # five items (cannot be greedy by value) @@ -45,7 +47,7 @@ expect { weight: 2, value: 20 }, { weight: 10, value: 50 }, ] - result = maxium_value { items, maximum_weight: 10 } + result = maximum_value { items, maximum_weight: 10 } result == 80 # example knapsack @@ -56,7 +58,7 @@ expect { weight: 6, value: 30 }, { weight: 4, value: 50 }, ] - result = maxium_value { items, maximum_weight: 10 } + result = maximum_value { items, maximum_weight: 10 } result == 90 # 8 items @@ -71,7 +73,7 @@ expect { weight: 2, value: 5 }, { weight: 2, value: 5 }, ] - result = maxium_value { items, maximum_weight: 104 } + result = maximum_value { items, maximum_weight: 104 } result == 900 # 15 items @@ -93,6 +95,6 @@ expect { weight: 118, value: 229 }, { weight: 120, value: 240 }, ] - result = maxium_value { items, maximum_weight: 750 } + result = maximum_value { items, maximum_weight: 750 } result == 1458 diff --git a/exercises/practice/largest-series-product/.meta/template.j2 b/exercises/practice/largest-series-product/.meta/template.j2 index c6e69af..fe95932 100644 --- a/exercises/practice/largest-series-product/.meta/template.j2 +++ b/exercises/practice/largest-series-product/.meta/template.j2 @@ -2,13 +2,13 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect digits = {{ case["input"]["digits"] | to_roc }} - result = digits |> {{ case["property"] | to_camel }} {{ case["input"]["span"] | to_roc }} + result = digits |> {{ case["property"] | to_snake }} {{ case["input"]["span"] | to_roc }} {%- if case["expected"]["error"] %} result |> Result.isErr {%- else %} diff --git a/exercises/practice/largest-series-product/largest-series-product-test.roc b/exercises/practice/largest-series-product/largest-series-product-test.roc index f89e140..9eb3d3a 100644 --- a/exercises/practice/largest-series-product/largest-series-product-test.roc +++ b/exercises/practice/largest-series-product/largest-series-product-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/largest-series-product/canonical-data.json -# File last updated on 2024-10-13 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import LargestSeriesProduct exposing [largest_product] diff --git a/exercises/practice/leap/leap-test.roc b/exercises/practice/leap/leap-test.roc index e6e9b41..a604025 100644 --- a/exercises/practice/leap/leap-test.roc +++ b/exercises/practice/leap/leap-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/leap/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Leap exposing [is_leap_year] diff --git a/exercises/practice/list-ops/.meta/template.j2 b/exercises/practice/list-ops/.meta/template.j2 index 917c444..5d77302 100644 --- a/exercises/practice/list-ops/.meta/template.j2 +++ b/exercises/practice/list-ops/.meta/template.j2 @@ -21,25 +21,25 @@ import {{ exercise | to_pascal }} exposing [append, concat, filter, length, map, # {{ case["description"] }} expect {%- if case["property"] == "append" %} - result = {{ case["property"] | to_camel }} {{ case["input"]["list1"] | to_roc }} {{ case["input"]["list2"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["list1"] | to_roc }} {{ case["input"]["list2"] | to_roc }} result == {{ case["expected"] | to_roc }} {%- elif case["property"] == "concat" %} - result = {{ case["property"] | to_camel }} {{ case["input"]["lists"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["lists"] | to_roc }} result == {{ case["expected"] | to_roc }} {%- elif case["property"] == "filter" %} - result = {{ case["property"] | to_camel }} {{ case["input"]["list"] | to_roc }} ({{ function_map[case["input"]["function"]] }}) + result = {{ case["property"] | to_snake }} {{ case["input"]["list"] | to_roc }} ({{ function_map[case["input"]["function"]] }}) result == {{ case["expected"] | to_roc }} {%- elif case["property"] == "length" %} - result = {{ case["property"] | to_camel }} {{ case["input"]["list"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["list"] | to_roc }} result == {{ case["expected"] }} {%- elif case["property"] == "map" %} - result = {{ case["property"] | to_camel }} {{ case["input"]["list"] | to_roc }} ({{ function_map[case["input"]["function"]] }}) + result = {{ case["property"] | to_snake }} {{ case["input"]["list"] | to_roc }} ({{ function_map[case["input"]["function"]] }}) result == {{ case["expected"] }} {%- elif case["property"] in ("foldl", "foldr") %} - result = {{ case["property"] | to_camel }} {{ case["input"]["list"] | to_roc }} {{ case["input"]["initial"] }} ({{ function_map[case["input"]["function"]] }}){% if "/" in function_map[case["input"]["function"]] %}|> Num.round{% endif %} + result = {{ case["property"] | to_snake }} {{ case["input"]["list"] | to_roc }} {{ case["input"]["initial"] }} ({{ function_map[case["input"]["function"]] }}){% if "/" in function_map[case["input"]["function"]] %}|> Num.round{% endif %} result == {{ case["expected"] | to_roc }} {%- elif case["property"] == "reverse" %} - result = {{ case["property"] | to_camel }} {{ case["input"]["list"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["list"] | to_roc }} result == {{ case["expected"] | to_roc }} {%- else %} Bool.true # This test case is not yet implemented diff --git a/exercises/practice/list-ops/list-ops-test.roc b/exercises/practice/list-ops/list-ops-test.roc index c2e4a47..ab89377 100644 --- a/exercises/practice/list-ops/list-ops-test.roc +++ b/exercises/practice/list-ops/list-ops-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/list-ops/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import ListOps exposing [append, concat, filter, length, map, foldl, foldr, reverse] diff --git a/exercises/practice/luhn/.meta/template.j2 b/exercises/practice/luhn/.meta/template.j2 index c1b5b16..9003a9c 100644 --- a/exercises/practice/luhn/.meta/template.j2 +++ b/exercises/practice/luhn/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["value"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["value"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/luhn/luhn-test.roc b/exercises/practice/luhn/luhn-test.roc index 8357b2b..9160e02 100644 --- a/exercises/practice/luhn/luhn-test.roc +++ b/exercises/practice/luhn/luhn-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/luhn/canonical-data.json -# File last updated on 2024-08-29 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Luhn exposing [valid] diff --git a/exercises/practice/matching-brackets/.meta/template.j2 b/exercises/practice/matching-brackets/.meta/template.j2 index a64ef18..0b4214c 100644 --- a/exercises/practice/matching-brackets/.meta/template.j2 +++ b/exercises/practice/matching-brackets/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["input"]["value"] | to_roc }} |> {{ case["property"] | to_camel }} + result = {{ case["input"]["value"] | to_roc }} |> {{ case["property"] | to_snake }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/matching-brackets/matching-brackets-test.roc b/exercises/practice/matching-brackets/matching-brackets-test.roc index ddee048..7ab16ed 100644 --- a/exercises/practice/matching-brackets/matching-brackets-test.roc +++ b/exercises/practice/matching-brackets/matching-brackets-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/matching-brackets/canonical-data.json -# File last updated on 2024-09-16 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import MatchingBrackets exposing [is_paired] diff --git a/exercises/practice/matrix/.meta/template.j2 b/exercises/practice/matrix/.meta/template.j2 index 587c94b..da16ff9 100644 --- a/exercises/practice/matrix/.meta/template.j2 +++ b/exercises/practice/matrix/.meta/template.j2 @@ -8,7 +8,7 @@ import {{ exercise | to_pascal }} exposing [row, column] # {{ case["description"] }} expect matrix_str = {{ case["input"]["string"] | to_roc_multiline_string | indent(8) }} - result = matrix_str |> {{ case["property"] | to_camel }} {{ case["input"]["index"] | to_roc }} + result = matrix_str |> {{ case["property"] | to_snake }} {{ case["input"]["index"] | to_roc }} result == Ok {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/matrix/matrix-test.roc b/exercises/practice/matrix/matrix-test.roc index 0367580..4554f52 100644 --- a/exercises/practice/matrix/matrix-test.roc +++ b/exercises/practice/matrix/matrix-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/matrix/canonical-data.json -# File last updated on 2024-09-20 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Matrix exposing [row, column] diff --git a/exercises/practice/meetup/.meta/template.j2 b/exercises/practice/meetup/.meta/template.j2 index ed99fb4..44e298e 100644 --- a/exercises/practice/meetup/.meta/template.j2 +++ b/exercises/practice/meetup/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header(imports=["isodate"]) }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} { + result = {{ case["property"] | to_snake }} { year: {{ case["input"]["year"] | to_roc }}, month: {{ case["input"]["month"] | to_roc }}, week: {{ case["input"]["week"] | to_pascal }}, diff --git a/exercises/practice/meetup/meetup-test.roc b/exercises/practice/meetup/meetup-test.roc index 60c8f69..3aef3eb 100644 --- a/exercises/practice/meetup/meetup-test.roc +++ b/exercises/practice/meetup/meetup-test.roc @@ -1,13 +1,15 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/meetup/canonical-data.json -# File last updated on 2024-10-18 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", isodate: "https://github.com/Anton-4/roc-isodate/releases/download/0.6.0/_n7UX8f5aFVVIXNa2AtOCvd-dcU-n-fp-0o8d22fyuQ.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Meetup exposing [meetup] diff --git a/exercises/practice/micro-blog/.meta/template.j2 b/exercises/practice/micro-blog/.meta/template.j2 index 76e9dc9..f6874d2 100644 --- a/exercises/practice/micro-blog/.meta/template.j2 +++ b/exercises/practice/micro-blog/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header(imports=["unicode"]) }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["phrase"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["phrase"] | to_roc }} result == Ok {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/micro-blog/micro-blog-test.roc b/exercises/practice/micro-blog/micro-blog-test.roc index d1bc846..d5d238e 100644 --- a/exercises/practice/micro-blog/micro-blog-test.roc +++ b/exercises/practice/micro-blog/micro-blog-test.roc @@ -1,13 +1,15 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/micro-blog/canonical-data.json -# File last updated on 2024-09-22 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", unicode: "https://github.com/roc-lang/unicode/releases/download/0.2.0/odvSckHK9LxWLbsrPmo2s6aQ3bn7C3PALyv0ZI1gAu0.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import MicroBlog exposing [truncate] diff --git a/exercises/practice/minesweeper/.meta/template.j2 b/exercises/practice/minesweeper/.meta/template.j2 index 5f0877f..68a45c7 100644 --- a/exercises/practice/minesweeper/.meta/template.j2 +++ b/exercises/practice/minesweeper/.meta/template.j2 @@ -2,13 +2,13 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect minefield = {{ case["input"]["minefield"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replaceEach "·" " " - result = {{ case["property"] | to_camel }} minefield + result = {{ case["property"] | to_snake }} minefield expected = {{ case["expected"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replaceEach "·" " " result == expected diff --git a/exercises/practice/minesweeper/minesweeper-test.roc b/exercises/practice/minesweeper/minesweeper-test.roc index 92b7305..cde9ab3 100644 --- a/exercises/practice/minesweeper/minesweeper-test.roc +++ b/exercises/practice/minesweeper/minesweeper-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/minesweeper/canonical-data.json -# File last updated on 2024-09-02 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Minesweeper exposing [annotate] diff --git a/exercises/practice/nth-prime/.meta/template.j2 b/exercises/practice/nth-prime/.meta/template.j2 index cc0d133..f3e1633 100644 --- a/exercises/practice/nth-prime/.meta/template.j2 +++ b/exercises/practice/nth-prime/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["number"] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["number"] }} {%- if case["expected"]["error"] %} result |> Result.isErr {%- else %} diff --git a/exercises/practice/nth-prime/nth-prime-test.roc b/exercises/practice/nth-prime/nth-prime-test.roc index e1cd91e..84e4e1a 100644 --- a/exercises/practice/nth-prime/nth-prime-test.roc +++ b/exercises/practice/nth-prime/nth-prime-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/nth-prime/canonical-data.json -# File last updated on 2024-10-07 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import NthPrime exposing [prime] diff --git a/exercises/practice/nucleotide-count/.meta/template.j2 b/exercises/practice/nucleotide-count/.meta/template.j2 index fc973d8..76acf3a 100644 --- a/exercises/practice/nucleotide-count/.meta/template.j2 +++ b/exercises/practice/nucleotide-count/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["strand"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["strand"] | to_roc }} {%- if case["expected"]["error"] %} Result.isErr result {%- else %} diff --git a/exercises/practice/nucleotide-count/nucleotide-count-test.roc b/exercises/practice/nucleotide-count/nucleotide-count-test.roc index bb0dbb8..c446f2f 100644 --- a/exercises/practice/nucleotide-count/nucleotide-count-test.roc +++ b/exercises/practice/nucleotide-count/nucleotide-count-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/nucleotide-count/canonical-data.json -# File last updated on 2024-09-22 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import NucleotideCount exposing [nucleotide_counts] diff --git a/exercises/practice/ocr-numbers/.meta/template.j2 b/exercises/practice/ocr-numbers/.meta/template.j2 index 382ff3c..ea0dda5 100644 --- a/exercises/practice/ocr-numbers/.meta/template.j2 +++ b/exercises/practice/ocr-numbers/.meta/template.j2 @@ -2,13 +2,13 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect grid = {{ case["input"]["rows"] | to_roc_multiline_string | indent(8) }} - result = {{ case["property"] | to_camel }} grid + result = {{ case["property"] | to_snake }} grid {%- if case["expected"]["error"] %} result |> Result.isErr {%- else %} diff --git a/exercises/practice/ocr-numbers/ocr-numbers-test.roc b/exercises/practice/ocr-numbers/ocr-numbers-test.roc index 12454ba..72f9942 100644 --- a/exercises/practice/ocr-numbers/ocr-numbers-test.roc +++ b/exercises/practice/ocr-numbers/ocr-numbers-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/ocr-numbers/canonical-data.json -# File last updated on 2024-10-13 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import OcrNumbers exposing [convert] diff --git a/exercises/practice/octal/octal-test.roc b/exercises/practice/octal/octal-test.roc index ede743e..88588da 100644 --- a/exercises/practice/octal/octal-test.roc +++ b/exercises/practice/octal/octal-test.roc @@ -1,9 +1,11 @@ -app [main] { +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Octal exposing [parse] diff --git a/exercises/practice/palindrome-products/.meta/template.j2 b/exercises/practice/palindrome-products/.meta/template.j2 index 49fff41..ad39a3b 100644 --- a/exercises/practice/palindrome-products/.meta/template.j2 +++ b/exercises/practice/palindrome-products/.meta/template.j2 @@ -13,7 +13,7 @@ isEq = \result, expected -> {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"] | to_roc }} {%- if case["expected"]["error"] %} result |> Result.isErr {%- else %} diff --git a/exercises/practice/palindrome-products/palindrome-products-test.roc b/exercises/practice/palindrome-products/palindrome-products-test.roc index a404fc9..17960b2 100644 --- a/exercises/practice/palindrome-products/palindrome-products-test.roc +++ b/exercises/practice/palindrome-products/palindrome-products-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/palindrome-products/canonical-data.json -# File last updated on 2024-10-15 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import PalindromeProducts exposing [smallest, largest] diff --git a/exercises/practice/pangram/.meta/template.j2 b/exercises/practice/pangram/.meta/template.j2 index ea55248..e0040de 100644 --- a/exercises/practice/pangram/.meta/template.j2 +++ b/exercises/practice/pangram/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [is_pangram] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["sentence"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["sentence"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/pangram/pangram-test.roc b/exercises/practice/pangram/pangram-test.roc index 6624c86..e0ea641 100644 --- a/exercises/practice/pangram/pangram-test.roc +++ b/exercises/practice/pangram/pangram-test.roc @@ -1,11 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/pangram/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } + +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Pangram exposing [is_pangram] diff --git a/exercises/practice/pascals-triangle/pascals-triangle-test.roc b/exercises/practice/pascals-triangle/pascals-triangle-test.roc index ca51f74..cceae7e 100644 --- a/exercises/practice/pascals-triangle/pascals-triangle-test.roc +++ b/exercises/practice/pascals-triangle/pascals-triangle-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/pascals-triangle/canonical-data.json -# File last updated on 2024-10-14 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import PascalsTriangle exposing [pascals_triangle] diff --git a/exercises/practice/perfect-numbers/.meta/template.j2 b/exercises/practice/perfect-numbers/.meta/template.j2 index 78bef44..e03500c 100644 --- a/exercises/practice/perfect-numbers/.meta/template.j2 +++ b/exercises/practice/perfect-numbers/.meta/template.j2 @@ -12,7 +12,7 @@ import {{ exercise | to_pascal }} exposing [classify] {% for case in supercase["cases"] -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["number"] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["number"] }} {%- if case["expected"]["error"] %} Result.isErr result {%- else %} diff --git a/exercises/practice/perfect-numbers/perfect-numbers-test.roc b/exercises/practice/perfect-numbers/perfect-numbers-test.roc index 63153dc..cfddee4 100644 --- a/exercises/practice/perfect-numbers/perfect-numbers-test.roc +++ b/exercises/practice/perfect-numbers/perfect-numbers-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/perfect-numbers/canonical-data.json -# File last updated on 2024-09-03 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import PerfectNumbers exposing [classify] diff --git a/exercises/practice/phone-number/.meta/template.j2 b/exercises/practice/phone-number/.meta/template.j2 index 18d89bf..af27f75 100644 --- a/exercises/practice/phone-number/.meta/template.j2 +++ b/exercises/practice/phone-number/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["phrase"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["phrase"] | to_roc }} {%- if case["expected"]["error"] %} result |> Result.isErr {%- else %} diff --git a/exercises/practice/phone-number/phone-number-test.roc b/exercises/practice/phone-number/phone-number-test.roc index 4bfc6db..a9776ba 100644 --- a/exercises/practice/phone-number/phone-number-test.roc +++ b/exercises/practice/phone-number/phone-number-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/phone-number/canonical-data.json -# File last updated on 2024-10-09 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import PhoneNumber exposing [clean] diff --git a/exercises/practice/pig-latin/.meta/template.j2 b/exercises/practice/pig-latin/.meta/template.j2 index ee914cd..a667978 100644 --- a/exercises/practice/pig-latin/.meta/template.j2 +++ b/exercises/practice/pig-latin/.meta/template.j2 @@ -2,7 +2,7 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["cases"][0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["cases"][0]["property"] | to_snake }}] {% for supercase in cases %} ## @@ -12,7 +12,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["cases"][0]["property"] {% for case in supercase["cases"] -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["phrase"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["phrase"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/pig-latin/pig-latin-test.roc b/exercises/practice/pig-latin/pig-latin-test.roc index 20fa3c0..11a06f6 100644 --- a/exercises/practice/pig-latin/pig-latin-test.roc +++ b/exercises/practice/pig-latin/pig-latin-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/pig-latin/canonical-data.json -# File last updated on 2024-09-03 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import PigLatin exposing [translate] diff --git a/exercises/practice/poker/.meta/template.j2 b/exercises/practice/poker/.meta/template.j2 index c9cc1e0..37993dd 100644 --- a/exercises/practice/poker/.meta/template.j2 +++ b/exercises/practice/poker/.meta/template.j2 @@ -2,13 +2,13 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect hands = {{ case["input"]["hands"] | to_roc }} - result = {{ case["property"] | to_camel }} hands + result = {{ case["property"] | to_snake }} hands result == Ok {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/poker/poker-test.roc b/exercises/practice/poker/poker-test.roc index dadabb9..764f00f 100644 --- a/exercises/practice/poker/poker-test.roc +++ b/exercises/practice/poker/poker-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/poker/canonical-data.json -# File last updated on 2024-10-08 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Poker exposing [best_hands] diff --git a/exercises/practice/prime-factors/.meta/template.j2 b/exercises/practice/prime-factors/.meta/template.j2 index 921d074..a8cb222 100644 --- a/exercises/practice/prime-factors/.meta/template.j2 +++ b/exercises/practice/prime-factors/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ exercise | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ exercise | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ exercise | to_camel }} {{ case["input"]["value"] | to_roc }} + result = {{ exercise | to_snake }} {{ case["input"]["value"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/prime-factors/prime-factors-test.roc b/exercises/practice/prime-factors/prime-factors-test.roc index 5690e29..285b2e1 100644 --- a/exercises/practice/prime-factors/prime-factors-test.roc +++ b/exercises/practice/prime-factors/prime-factors-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/prime-factors/canonical-data.json -# File last updated on 2024-09-04 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import PrimeFactors exposing [prime_factors] diff --git a/exercises/practice/protein-translation/.meta/Example.roc b/exercises/practice/protein-translation/.meta/Example.roc index e615978..3bd0bab 100644 --- a/exercises/practice/protein-translation/.meta/Example.roc +++ b/exercises/practice/protein-translation/.meta/Example.roc @@ -1,10 +1,10 @@ module [to_protein] Codon : List U8 -amino_acid : [Cysteine, Leucine, Methionine, Phenylalanine, Serine, Tryptophan, Tyrosine] -Protein : List amino_acid +AminoAcid : [Cysteine, Leucine, Methionine, Phenylalanine, Serine, Tryptophan, Tyrosine] +Protein : List AminoAcid -to_instruction : Codon -> Result [Append amino_acid, Stop] [InvalidCodon Codon] +to_instruction : Codon -> Result [Append AminoAcid, Stop] [InvalidCodon Codon] to_instruction = \codon -> when codon is ['A', 'U', 'G'] -> Ok (Append Methionine) diff --git a/exercises/practice/protein-translation/protein-translation-test.roc b/exercises/practice/protein-translation/protein-translation-test.roc index ac868bc..e623521 100644 --- a/exercises/practice/protein-translation/protein-translation-test.roc +++ b/exercises/practice/protein-translation/protein-translation-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/protein-translation/canonical-data.json -# File last updated on 2024-09-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import ProteinTranslation exposing [to_protein] diff --git a/exercises/practice/proverb/.meta/template.j2 b/exercises/practice/proverb/.meta/template.j2 index 14889e5..3e054ce 100644 --- a/exercises/practice/proverb/.meta/template.j2 +++ b/exercises/practice/proverb/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["strings"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["strings"] | to_roc }} expected = {{ case["expected"] | to_roc_multiline_string | indent(8) }} result == expected diff --git a/exercises/practice/proverb/proverb-test.roc b/exercises/practice/proverb/proverb-test.roc index 44dd76f..7a80825 100644 --- a/exercises/practice/proverb/proverb-test.roc +++ b/exercises/practice/proverb/proverb-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/proverb/canonical-data.json -# File last updated on 2024-09-23 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Proverb exposing [recite] diff --git a/exercises/practice/pythagorean-triplet/.meta/template.j2 b/exercises/practice/pythagorean-triplet/.meta/template.j2 index f914ca7..c37971f 100644 --- a/exercises/practice/pythagorean-triplet/.meta/template.j2 +++ b/exercises/practice/pythagorean-triplet/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["n"] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["n"] }} expected = Set.fromList [{%- for triplet in case["expected"] %} ({{ triplet[0] }}, {{ triplet[1] }}, {{ triplet[2] }}), {%- endfor %}] diff --git a/exercises/practice/pythagorean-triplet/pythagorean-triplet-test.roc b/exercises/practice/pythagorean-triplet/pythagorean-triplet-test.roc index 4694248..a73db04 100644 --- a/exercises/practice/pythagorean-triplet/pythagorean-triplet-test.roc +++ b/exercises/practice/pythagorean-triplet/pythagorean-triplet-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/pythagorean-triplet/canonical-data.json -# File last updated on 2024-10-10 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import PythagoreanTriplet exposing [triplets_with_sum] diff --git a/exercises/practice/queen-attack/queen-attack-test.roc b/exercises/practice/queen-attack/queen-attack-test.roc index 36ce3e7..080a3ed 100644 --- a/exercises/practice/queen-attack/queen-attack-test.roc +++ b/exercises/practice/queen-attack/queen-attack-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/queen-attack/canonical-data.json -# File last updated on 2024-09-21 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import QueenAttack exposing [create, rank, file, queen_can_attack] @@ -16,17 +18,17 @@ import QueenAttack exposing [create, rank, file, queen_can_attack] # queen with a valid position expect - maybe_square = create "C6" + maybeSquare = create "C6" result = - maybe_square + maybeSquare |> Result.try \square -> Ok (rank square) result == Ok 6 expect - maybe_square = create "C6" + maybeSquare = create "C6" result = - maybe_square + maybeSquare |> Result.try \square -> Ok (file square) result == Ok 'C' @@ -47,10 +49,10 @@ expect # cannot attack expect - maybe_square1 = create "E6" - maybe_square2 = create "G2" + maybeSquare1 = create "E6" + maybeSquare2 = create "G2" result = - when (maybe_square1, maybe_square2) is + when (maybeSquare1, maybeSquare2) is (Ok square1, Ok square2) -> square1 |> queen_can_attack square2 @@ -59,10 +61,10 @@ expect # can attack on same row expect - maybe_square1 = create "E6" - maybe_square2 = create "G6" + maybeSquare1 = create "E6" + maybeSquare2 = create "G6" result = - when (maybe_square1, maybe_square2) is + when (maybeSquare1, maybeSquare2) is (Ok square1, Ok square2) -> square1 |> queen_can_attack square2 @@ -71,10 +73,10 @@ expect # can attack on same column expect - maybe_square1 = create "F4" - maybe_square2 = create "F6" + maybeSquare1 = create "F4" + maybeSquare2 = create "F6" result = - when (maybe_square1, maybe_square2) is + when (maybeSquare1, maybeSquare2) is (Ok square1, Ok square2) -> square1 |> queen_can_attack square2 @@ -83,10 +85,10 @@ expect # can attack on first diagonal expect - maybe_square1 = create "C6" - maybe_square2 = create "E8" + maybeSquare1 = create "C6" + maybeSquare2 = create "E8" result = - when (maybe_square1, maybe_square2) is + when (maybeSquare1, maybeSquare2) is (Ok square1, Ok square2) -> square1 |> queen_can_attack square2 @@ -95,10 +97,10 @@ expect # can attack on second diagonal expect - maybe_square1 = create "C6" - maybe_square2 = create "B5" + maybeSquare1 = create "C6" + maybeSquare2 = create "B5" result = - when (maybe_square1, maybe_square2) is + when (maybeSquare1, maybeSquare2) is (Ok square1, Ok square2) -> square1 |> queen_can_attack square2 @@ -107,10 +109,10 @@ expect # can attack on third diagonal expect - maybe_square1 = create "C6" - maybe_square2 = create "B7" + maybeSquare1 = create "C6" + maybeSquare2 = create "B7" result = - when (maybe_square1, maybe_square2) is + when (maybeSquare1, maybeSquare2) is (Ok square1, Ok square2) -> square1 |> queen_can_attack square2 @@ -119,10 +121,10 @@ expect # can attack on fourth diagonal expect - maybe_square1 = create "H7" - maybe_square2 = create "G8" + maybeSquare1 = create "H7" + maybeSquare2 = create "G8" result = - when (maybe_square1, maybe_square2) is + when (maybeSquare1, maybeSquare2) is (Ok square1, Ok square2) -> square1 |> queen_can_attack square2 @@ -131,10 +133,10 @@ expect # cannot attack if falling diagonals are only the same when reflected across the longest falling diagonal expect - maybe_square1 = create "B4" - maybe_square2 = create "F6" + maybeSquare1 = create "B4" + maybeSquare2 = create "F6" result = - when (maybe_square1, maybe_square2) is + when (maybeSquare1, maybeSquare2) is (Ok square1, Ok square2) -> square1 |> queen_can_attack square2 diff --git a/exercises/practice/rail-fence-cipher/.meta/template.j2 b/exercises/practice/rail-fence-cipher/.meta/template.j2 index a739785..8507ae7 100644 --- a/exercises/practice/rail-fence-cipher/.meta/template.j2 +++ b/exercises/practice/rail-fence-cipher/.meta/template.j2 @@ -13,7 +13,7 @@ import {{ exercise | to_pascal }} exposing [encode, decode] # {{ case["description"] }} expect message = {{ case["input"]["msg"] | to_roc }} - result = message |> {{ case["property"] | to_camel }} {{ case["input"]["rails"] | to_roc }} + result = message |> {{ case["property"] | to_snake }} {{ case["input"]["rails"] | to_roc }} expected = Ok {{ case["expected"] | to_roc }} result == expected diff --git a/exercises/practice/rail-fence-cipher/rail-fence-cipher-test.roc b/exercises/practice/rail-fence-cipher/rail-fence-cipher-test.roc index e8360e4..43f2331 100644 --- a/exercises/practice/rail-fence-cipher/rail-fence-cipher-test.roc +++ b/exercises/practice/rail-fence-cipher/rail-fence-cipher-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/rail-fence-cipher/canonical-data.json -# File last updated on 2024-10-23 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import RailFenceCipher exposing [encode, decode] diff --git a/exercises/practice/raindrops/.meta/template.j2 b/exercises/practice/raindrops/.meta/template.j2 index c5fa4e0..60457cf 100644 --- a/exercises/practice/raindrops/.meta/template.j2 +++ b/exercises/practice/raindrops/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [convert] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["number"] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["number"] }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/raindrops/raindrops-test.roc b/exercises/practice/raindrops/raindrops-test.roc index 179c01e..3c825b1 100644 --- a/exercises/practice/raindrops/raindrops-test.roc +++ b/exercises/practice/raindrops/raindrops-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/raindrops/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Raindrops exposing [convert] diff --git a/exercises/practice/rational-numbers/.meta/template.j2 b/exercises/practice/rational-numbers/.meta/template.j2 index b14247c..4efdee9 100644 --- a/exercises/practice/rational-numbers/.meta/template.j2 +++ b/exercises/practice/rational-numbers/.meta/template.j2 @@ -20,14 +20,14 @@ import {{ exercise | to_pascal }} exposing [add, sub, mul, div, abs, exp, exp_re # {{ case["description"] }} expect {%- if "r1" in case["input"] %} - result = {{ plugins.to_roc_rational(case["input"]["r1"]) }} |> {{ property_map[case["property"]] | to_camel }} ({{ plugins.to_roc_rational(case["input"]["r2"]) }}) + result = {{ plugins.to_roc_rational(case["input"]["r1"]) }} |> {{ property_map[case["property"]] | to_snake }} ({{ plugins.to_roc_rational(case["input"]["r2"]) }}) {%- elif "r" in case["input"] %} {%- if "x" in case["input"] %} - result = {{ case["input"]["x"] | to_roc }} |> {{ property_map[case["property"]] | to_camel }} ({{ plugins.to_roc_rational(case["input"]["r"]) }}) + result = {{ case["input"]["x"] | to_roc }} |> {{ property_map[case["property"]] | to_snake }} ({{ plugins.to_roc_rational(case["input"]["r"]) }}) {%- elif "n" in case["input"] %} - result = {{ plugins.to_roc_rational(case["input"]["r"]) }} |> {{ property_map[case["property"]] | to_camel }} {{ case["input"]["n"] | to_roc }} + result = {{ plugins.to_roc_rational(case["input"]["r"]) }} |> {{ property_map[case["property"]] | to_snake }} {{ case["input"]["n"] | to_roc }} {%- else %} - result = {{ plugins.to_roc_rational(case["input"]["r"]) }} |> {{ property_map[case["property"]] | to_camel }} + result = {{ plugins.to_roc_rational(case["input"]["r"]) }} |> {{ property_map[case["property"]] | to_snake }} {%- endif %} {%- else %} crash "This test case is not implemented yet." diff --git a/exercises/practice/rational-numbers/rational-numbers-test.roc b/exercises/practice/rational-numbers/rational-numbers-test.roc index 92606e9..5f5ee63 100644 --- a/exercises/practice/rational-numbers/rational-numbers-test.roc +++ b/exercises/practice/rational-numbers/rational-numbers-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/rational-numbers/canonical-data.json -# File last updated on 2024-09-06 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import RationalNumbers exposing [add, sub, mul, div, abs, exp, exp_real, reduce] diff --git a/exercises/practice/rectangles/.meta/template.j2 b/exercises/practice/rectangles/.meta/template.j2 index c4d55b5..20dd6b4 100644 --- a/exercises/practice/rectangles/.meta/template.j2 +++ b/exercises/practice/rectangles/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["strings"] | to_roc_multiline_string | indent(8) }} + result = {{ case["property"] | to_snake }} {{ case["input"]["strings"] | to_roc_multiline_string | indent(8) }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/rectangles/rectangles-test.roc b/exercises/practice/rectangles/rectangles-test.roc index 56fcf77..9a42376 100644 --- a/exercises/practice/rectangles/rectangles-test.roc +++ b/exercises/practice/rectangles/rectangles-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/rectangles/canonical-data.json -# File last updated on 2024-09-11 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Rectangles exposing [rectangles] diff --git a/exercises/practice/resistor-color-duo/.meta/template.j2 b/exercises/practice/resistor-color-duo/.meta/template.j2 index 8b31ed0..cd0e6e0 100644 --- a/exercises/practice/resistor-color-duo/.meta/template.j2 +++ b/exercises/practice/resistor-color-duo/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [value] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["colors"][0] | to_pascal }} {{ case["input"]["colors"][1] | to_pascal }} + result = {{ case["property"] | to_snake }} {{ case["input"]["colors"][0] | to_pascal }} {{ case["input"]["colors"][1] | to_pascal }} result == {{ case["expected"] }} {% endfor %} diff --git a/exercises/practice/resistor-color-duo/resistor-color-duo-test.roc b/exercises/practice/resistor-color-duo/resistor-color-duo-test.roc index 080feac..72aeb0c 100644 --- a/exercises/practice/resistor-color-duo/resistor-color-duo-test.roc +++ b/exercises/practice/resistor-color-duo/resistor-color-duo-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/resistor-color-duo/canonical-data.json -# File last updated on 2024-09-12 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import ResistorColorDuo exposing [value] diff --git a/exercises/practice/resistor-color/.meta/template.j2 b/exercises/practice/resistor-color/.meta/template.j2 index 3dab013..f672632 100644 --- a/exercises/practice/resistor-color/.meta/template.j2 +++ b/exercises/practice/resistor-color/.meta/template.j2 @@ -10,7 +10,7 @@ import {{ exercise | to_pascal }} exposing [color_code, colors] ## {% if case["property"] == "colors" %} expect - result = {{ case["property"] | to_camel }} + result = {{ case["property"] | to_snake }} result == [ {%- for color in case["expected"] %} {{ color | to_roc }}, @@ -20,7 +20,7 @@ expect {% for subcase in case["cases"] -%} # {{ subcase["description"] }} expect - result = {{ subcase["property"] | to_camel }} {{ subcase["input"]["color"] | to_roc }} + result = {{ subcase["property"] | to_snake }} {{ subcase["input"]["color"] | to_roc }} result == Ok {{ subcase["expected"] }} {% endfor %} diff --git a/exercises/practice/resistor-color/resistor-color-test.roc b/exercises/practice/resistor-color/resistor-color-test.roc index d9dfa57..e2865ec 100644 --- a/exercises/practice/resistor-color/resistor-color-test.roc +++ b/exercises/practice/resistor-color/resistor-color-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/resistor-color/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import ResistorColor exposing [color_code, colors] diff --git a/exercises/practice/rest-api/.meta/template.j2 b/exercises/practice/rest-api/.meta/template.j2 index ef6728a..dce6960 100644 --- a/exercises/practice/rest-api/.meta/template.j2 +++ b/exercises/practice/rest-api/.meta/template.j2 @@ -41,7 +41,7 @@ expect {%- endfor %} ] } - result = database |> {{ case["property"] | to_camel }} { + result = database |> {{ case["property"] | to_snake }} { url: {{ case["input"]["url"] | to_roc }}, {%- if case["input"].get("payload", {}) != {} %} payload: {{ case["input"]["payload"] | tojson | to_roc }} diff --git a/exercises/practice/rest-api/rest-api-test.roc b/exercises/practice/rest-api/rest-api-test.roc index 24be82f..041bf8f 100644 --- a/exercises/practice/rest-api/rest-api-test.roc +++ b/exercises/practice/rest-api/rest-api-test.roc @@ -1,17 +1,19 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/rest-api/canonical-data.json -# File last updated on 2024-09-09 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", json: "https://github.com/lukewilliamboswell/roc-json/releases/download/0.11.0/z45Wzc-J39TLNweQUoLw3IGZtkQiEN3lTBv3BXErRjQ.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import RestApi exposing [get, post] -standardize_result = \result -> +standardizeResult = \result -> result |> Result.try \string -> string @@ -36,7 +38,7 @@ expect |> get { url: "/users", } - |> standardize_result + |> standardizeResult expected = Ok "{\"users\":[]}" result == expected @@ -52,7 +54,7 @@ expect url: "/add", payload: "{\"user\": \"Adam\"}", } - |> standardize_result + |> standardizeResult expected = Ok "{\"balance\":0,\"name\":\"Adam\",\"owed_by\":{},\"owes\":{}}" result == expected @@ -80,7 +82,7 @@ expect url: "/users", payload: "{\"users\": [\"Bob\"]}", } - |> standardize_result + |> standardizeResult expected = Ok "{\"users\":[{\"balance\":0,\"name\":\"Bob\",\"owed_by\":{},\"owes\":{}}]}" result == expected @@ -112,7 +114,7 @@ expect url: "/iou", payload: "{\"amount\": 3.0, \"borrower\": \"Bob\", \"lender\": \"Adam\"}", } - |> standardize_result + |> standardizeResult expected = Ok "{\"users\":[{\"balance\":3,\"name\":\"Adam\",\"owed_by\":{\"Bob\":3},\"owes\":{}},{\"balance\":-3,\"name\":\"Bob\",\"owed_by\":{},\"owes\":{\"Adam\":3}}]}" result == expected @@ -150,7 +152,7 @@ expect url: "/iou", payload: "{\"amount\": 3.0, \"borrower\": \"Bob\", \"lender\": \"Adam\"}", } - |> standardize_result + |> standardizeResult expected = Ok "{\"users\":[{\"balance\":3,\"name\":\"Adam\",\"owed_by\":{\"Bob\":3},\"owes\":{}},{\"balance\":-6,\"name\":\"Bob\",\"owed_by\":{},\"owes\":{\"Adam\":3,\"Chuck\":3}}]}" result == expected @@ -188,7 +190,7 @@ expect url: "/iou", payload: "{\"amount\": 3.0, \"borrower\": \"Adam\", \"lender\": \"Bob\"}", } - |> standardize_result + |> standardizeResult expected = Ok "{\"users\":[{\"balance\":-3,\"name\":\"Adam\",\"owed_by\":{},\"owes\":{\"Bob\":3}},{\"balance\":0,\"name\":\"Bob\",\"owed_by\":{\"Adam\":3},\"owes\":{\"Chuck\":3}}]}" result == expected @@ -220,7 +222,7 @@ expect url: "/iou", payload: "{\"amount\": 2.0, \"borrower\": \"Bob\", \"lender\": \"Adam\"}", } - |> standardize_result + |> standardizeResult expected = Ok "{\"users\":[{\"balance\":-1,\"name\":\"Adam\",\"owed_by\":{},\"owes\":{\"Bob\":1}},{\"balance\":1,\"name\":\"Bob\",\"owed_by\":{\"Adam\":1},\"owes\":{}}]}" result == expected @@ -252,7 +254,7 @@ expect url: "/iou", payload: "{\"amount\": 4.0, \"borrower\": \"Bob\", \"lender\": \"Adam\"}", } - |> standardize_result + |> standardizeResult expected = Ok "{\"users\":[{\"balance\":1,\"name\":\"Adam\",\"owed_by\":{\"Bob\":1},\"owes\":{}},{\"balance\":-1,\"name\":\"Bob\",\"owed_by\":{},\"owes\":{\"Adam\":1}}]}" result == expected @@ -284,7 +286,7 @@ expect url: "/iou", payload: "{\"amount\": 3.0, \"borrower\": \"Bob\", \"lender\": \"Adam\"}", } - |> standardize_result + |> standardizeResult expected = Ok "{\"users\":[{\"balance\":0,\"name\":\"Adam\",\"owed_by\":{},\"owes\":{}},{\"balance\":0,\"name\":\"Bob\",\"owed_by\":{},\"owes\":{}}]}" result == expected diff --git a/exercises/practice/reverse-string/.meta/template.j2 b/exercises/practice/reverse-string/.meta/template.j2 index 7f962e9..946f850 100644 --- a/exercises/practice/reverse-string/.meta/template.j2 +++ b/exercises/practice/reverse-string/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [reverse] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["value"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["value"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/reverse-string/reverse-string-test.roc b/exercises/practice/reverse-string/reverse-string-test.roc index 633e8c7..3eab775 100644 --- a/exercises/practice/reverse-string/reverse-string-test.roc +++ b/exercises/practice/reverse-string/reverse-string-test.roc @@ -1,13 +1,15 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/reverse-string/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", unicode: "https://github.com/roc-lang/unicode/releases/download/0.2.0/odvSckHK9LxWLbsrPmo2s6aQ3bn7C3PALyv0ZI1gAu0.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import ReverseString exposing [reverse] diff --git a/exercises/practice/rna-transcription/.meta/template.j2 b/exercises/practice/rna-transcription/.meta/template.j2 index 774e61e..c8bcae5 100644 --- a/exercises/practice/rna-transcription/.meta/template.j2 +++ b/exercises/practice/rna-transcription/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [to_rna] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["dna"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["dna"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/rna-transcription/rna-transcription-test.roc b/exercises/practice/rna-transcription/rna-transcription-test.roc index e915339..dbc437f 100644 --- a/exercises/practice/rna-transcription/rna-transcription-test.roc +++ b/exercises/practice/rna-transcription/rna-transcription-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/rna-transcription/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import RnaTranscription exposing [to_rna] diff --git a/exercises/practice/robot-simulator/robot-simulator-test.roc b/exercises/practice/robot-simulator/robot-simulator-test.roc index f621691..3d68fc1 100644 --- a/exercises/practice/robot-simulator/robot-simulator-test.roc +++ b/exercises/practice/robot-simulator/robot-simulator-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/robot-simulator/canonical-data.json -# File last updated on 2024-09-23 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import RobotSimulator exposing [create, move] diff --git a/exercises/practice/roman-numerals/.meta/template.j2 b/exercises/practice/roman-numerals/.meta/template.j2 index be80e58..bc1c769 100644 --- a/exercises/practice/roman-numerals/.meta/template.j2 +++ b/exercises/practice/roman-numerals/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["number"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["number"] | to_roc }} result == Ok {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/roman-numerals/roman-numerals-test.roc b/exercises/practice/roman-numerals/roman-numerals-test.roc index 6c70e54..7fc98f3 100644 --- a/exercises/practice/roman-numerals/roman-numerals-test.roc +++ b/exercises/practice/roman-numerals/roman-numerals-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/roman-numerals/canonical-data.json -# File last updated on 2024-09-24 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import RomanNumerals exposing [roman] diff --git a/exercises/practice/rotational-cipher/.meta/template.j2 b/exercises/practice/rotational-cipher/.meta/template.j2 index 9d42cc4..26a225d 100644 --- a/exercises/practice/rotational-cipher/.meta/template.j2 +++ b/exercises/practice/rotational-cipher/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [rotate] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["text"] | to_roc }} {{ case["input"]["shiftKey"] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["text"] | to_roc }} {{ case["input"]["shiftKey"] }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/rotational-cipher/rotational-cipher-test.roc b/exercises/practice/rotational-cipher/rotational-cipher-test.roc index 009ca03..7ad9b2d 100644 --- a/exercises/practice/rotational-cipher/rotational-cipher-test.roc +++ b/exercises/practice/rotational-cipher/rotational-cipher-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/rotational-cipher/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import RotationalCipher exposing [rotate] diff --git a/exercises/practice/run-length-encoding/.meta/template.j2 b/exercises/practice/run-length-encoding/.meta/template.j2 index 104278d..b8176fd 100644 --- a/exercises/practice/run-length-encoding/.meta/template.j2 +++ b/exercises/practice/run-length-encoding/.meta/template.j2 @@ -17,7 +17,7 @@ expect result = string |> encode |> Result.try decode result == Ok string {%- else %} - result = string |> {{ case["property"] | to_camel }} + result = string |> {{ case["property"] | to_snake }} expected = {{ case["expected"] | to_roc }} result == Ok expected {%- endif %} diff --git a/exercises/practice/run-length-encoding/run-length-encoding-test.roc b/exercises/practice/run-length-encoding/run-length-encoding-test.roc index bf48e86..2ec6fc8 100644 --- a/exercises/practice/run-length-encoding/run-length-encoding-test.roc +++ b/exercises/practice/run-length-encoding/run-length-encoding-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/run-length-encoding/canonical-data.json -# File last updated on 2024-10-10 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import RunLengthEncoding exposing [encode, decode] diff --git a/exercises/practice/saddle-points/.meta/Example.roc b/exercises/practice/saddle-points/.meta/Example.roc index 0428211..513f2e4 100644 --- a/exercises/practice/saddle-points/.meta/Example.roc +++ b/exercises/practice/saddle-points/.meta/Example.roc @@ -1,39 +1,38 @@ -module [saddlePoints] +module [saddle_points] Forest : List (List U8) Position : { row : U64, column : U64 } -saddlePoints : Forest -> Set Position -saddlePoints = \treeHeights -> - tallestTreesEastWest = - treeHeights - |> List.mapWithIndex \row, rowIndex -> - maxInRow = row |> List.max |> Result.withDefault 0 +saddle_points : Forest -> Set Position +saddle_points = \tree_heights -> + tallest_trees_east_west = + tree_heights + |> List.mapWithIndex \row, row_index -> + max_in_row = row |> List.max |> Result.withDefault 0 row - |> List.mapWithIndex \height, columnIndex -> - if height == maxInRow then [{ row: rowIndex + 1, column: columnIndex + 1 }] else [] + |> List.mapWithIndex \height, column_index -> + if height == max_in_row then [{ row: row_index + 1, column: column_index + 1 }] else [] |> List.join |> List.join |> Set.fromList - numColumns = treeHeights |> List.map List.len |> List.max |> Result.withDefault 0 - smallestTreeNorthSouth = - List.range { start: At 0, end: Before numColumns } - |> List.map \columnIndex -> + num_columns = tree_heights |> List.map List.len |> List.max |> Result.withDefault 0 + smallest_trees_north_south = + List.range { start: At 0, end: Before num_columns } + |> List.map \column_index -> column = - treeHeights - |> List.mapWithIndex \row, rowIndex -> + tree_heights + |> List.mapWithIndex \row, row_index -> row - |> List.get? columnIndex - |> \height -> Ok { height, rowIndex } + |> List.get? column_index + |> \height -> Ok { height, row_index } |> List.keepOks \id -> id - minInColumn = column |> List.map .height |> List.min |> Result.withDefault 0 + min_in_column = column |> List.map .height |> List.min |> Result.withDefault 0 column - |> List.keepIf \{ height } -> height == minInColumn - |> List.map \{ rowIndex } -> { row: rowIndex + 1, column: columnIndex + 1 } + |> List.keepIf \{ height } -> height == min_in_column + |> List.map \{ row_index } -> { row: row_index + 1, column: column_index + 1 } |> List.joinMap \id -> id |> Set.fromList - tallestTreesEastWest |> Set.intersection smallestTreeNorthSouth - + tallest_trees_east_west |> Set.intersection smallest_trees_north_south \ No newline at end of file diff --git a/exercises/practice/saddle-points/.meta/template.j2 b/exercises/practice/saddle-points/.meta/template.j2 index dcf1b0a..2f9a2bc 100644 --- a/exercises/practice/saddle-points/.meta/template.j2 +++ b/exercises/practice/saddle-points/.meta/template.j2 @@ -2,7 +2,7 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} @@ -12,7 +12,7 @@ expect {{ row | to_roc }}, {%- endfor %} ] - result = treeHeights |> {{ case["property"] | to_camel }} + result = treeHeights |> {{ case["property"] | to_snake }} expected = Set.fromList [ {%- for tree in case["expected"] %} {{ tree | to_roc }}, diff --git a/exercises/practice/saddle-points/SaddlePoints.roc b/exercises/practice/saddle-points/SaddlePoints.roc index 0ce3059..0fab5de 100644 --- a/exercises/practice/saddle-points/SaddlePoints.roc +++ b/exercises/practice/saddle-points/SaddlePoints.roc @@ -1,8 +1,8 @@ -module [saddlePoints] +module [saddle_points] Forest : List (List U8) Position : { row : U64, column : U64 } -saddlePoints : Forest -> Set Position -saddlePoints = \treeHeights -> - crash "Please implement the 'saddlePoints' function" +saddle_points : Forest -> Set Position +saddle_points = \treeHeights -> + crash "Please implement the 'saddle_points' function" diff --git a/exercises/practice/saddle-points/saddle-points-test.roc b/exercises/practice/saddle-points/saddle-points-test.roc index e417438..d5562f2 100644 --- a/exercises/practice/saddle-points/saddle-points-test.roc +++ b/exercises/practice/saddle-points/saddle-points-test.roc @@ -1,14 +1,16 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/saddle-points/canonical-data.json -# File last updated on 2024-09-24 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" -import SaddlePoints exposing [saddlePoints] +import SaddlePoints exposing [saddle_points] # Can identify single saddle point expect @@ -17,7 +19,7 @@ expect [5, 3, 2], [6, 6, 7], ] - result = treeHeights |> saddlePoints + result = treeHeights |> saddle_points expected = Set.fromList [ { row: 2, column: 1 }, ] @@ -28,7 +30,7 @@ expect treeHeights = [ [], ] - result = treeHeights |> saddlePoints + result = treeHeights |> saddle_points expected = Set.fromList [ ] result == expected @@ -40,7 +42,7 @@ expect [3, 1, 2], [2, 3, 1], ] - result = treeHeights |> saddlePoints + result = treeHeights |> saddle_points expected = Set.fromList [ ] result == expected @@ -52,7 +54,7 @@ expect [3, 5, 5], [1, 5, 4], ] - result = treeHeights |> saddlePoints + result = treeHeights |> saddle_points expected = Set.fromList [ { row: 1, column: 2 }, { row: 2, column: 2 }, @@ -67,7 +69,7 @@ expect [5, 5, 5], [7, 5, 6], ] - result = treeHeights |> saddlePoints + result = treeHeights |> saddle_points expected = Set.fromList [ { row: 2, column: 1 }, { row: 2, column: 2 }, @@ -82,7 +84,7 @@ expect [6, 7, 6], [3, 2, 5], ] - result = treeHeights |> saddlePoints + result = treeHeights |> saddle_points expected = Set.fromList [ { row: 3, column: 3 }, ] @@ -94,7 +96,7 @@ expect [3, 1, 3], [3, 2, 4], ] - result = treeHeights |> saddlePoints + result = treeHeights |> saddle_points expected = Set.fromList [ { row: 1, column: 3 }, { row: 1, column: 1 }, @@ -109,7 +111,7 @@ expect [4], [1], ] - result = treeHeights |> saddlePoints + result = treeHeights |> saddle_points expected = Set.fromList [ { row: 2, column: 1 }, { row: 4, column: 1 }, @@ -121,7 +123,7 @@ expect treeHeights = [ [2, 5, 3, 5], ] - result = treeHeights |> saddlePoints + result = treeHeights |> saddle_points expected = Set.fromList [ { row: 1, column: 2 }, { row: 1, column: 4 }, diff --git a/exercises/practice/say/.meta/template.j2 b/exercises/practice/say/.meta/template.j2 index db12e77..455f5f7 100644 --- a/exercises/practice/say/.meta/template.j2 +++ b/exercises/practice/say/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["number"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["number"] | to_roc }} {%- if case["expected"]["error"] %} result |> Result.isErr {%- else %} diff --git a/exercises/practice/say/say-test.roc b/exercises/practice/say/say-test.roc index ad4d2d6..829b881 100644 --- a/exercises/practice/say/say-test.roc +++ b/exercises/practice/say/say-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/say/canonical-data.json -# File last updated on 2024-09-22 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Say exposing [say] diff --git a/exercises/practice/scrabble-score/.meta/template.j2 b/exercises/practice/scrabble-score/.meta/template.j2 index 52afc48..bbb6d67 100644 --- a/exercises/practice/scrabble-score/.meta/template.j2 +++ b/exercises/practice/scrabble-score/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["word"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["word"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/scrabble-score/scrabble-score-test.roc b/exercises/practice/scrabble-score/scrabble-score-test.roc index 127f5d1..b697507 100644 --- a/exercises/practice/scrabble-score/scrabble-score-test.roc +++ b/exercises/practice/scrabble-score/scrabble-score-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/scrabble-score/canonical-data.json -# File last updated on 2024-09-10 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import ScrabbleScore exposing [score] diff --git a/exercises/practice/secret-handshake/.meta/template.j2 b/exercises/practice/secret-handshake/.meta/template.j2 index cd07067..7259076 100644 --- a/exercises/practice/secret-handshake/.meta/template.j2 +++ b/exercises/practice/secret-handshake/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["number"] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["number"] }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/secret-handshake/secret-handshake-test.roc b/exercises/practice/secret-handshake/secret-handshake-test.roc index 43ecac1..e28c94e 100644 --- a/exercises/practice/secret-handshake/secret-handshake-test.roc +++ b/exercises/practice/secret-handshake/secret-handshake-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/secret-handshake/canonical-data.json -# File last updated on 2024-09-02 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import SecretHandshake exposing [commands] diff --git a/exercises/practice/series/.meta/template.j2 b/exercises/practice/series/.meta/template.j2 index f6078c2..4e1b83c 100644 --- a/exercises/practice/series/.meta/template.j2 +++ b/exercises/practice/series/.meta/template.j2 @@ -2,13 +2,13 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} {%- if case["expected"]["error"] %} – just return an empty list{%- endif %} expect - result = {{ case["input"]["series"] | to_roc }} |> {{ case["property"] | to_camel }} {{ case["input"]["sliceLength"] | to_roc }} + result = {{ case["input"]["series"] | to_roc }} |> {{ case["property"] | to_snake }} {{ case["input"]["sliceLength"] | to_roc }} {%- if case["expected"]["error"] %} result == [] {%- else %} diff --git a/exercises/practice/series/series-test.roc b/exercises/practice/series/series-test.roc index 90c4575..171cfcd 100644 --- a/exercises/practice/series/series-test.roc +++ b/exercises/practice/series/series-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/series/canonical-data.json -# File last updated on 2024-09-13 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Series exposing [slices] diff --git a/exercises/practice/sgf-parsing/.meta/template.j2 b/exercises/practice/sgf-parsing/.meta/template.j2 index 37e2093..f71b977 100644 --- a/exercises/practice/sgf-parsing/.meta/template.j2 +++ b/exercises/practice/sgf-parsing/.meta/template.j2 @@ -2,7 +2,7 @@ {{ macros.canonical_ref() }} {{ macros.header(imports=["parser"]) }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {%- macro to_node(node) %} GameNode { @@ -22,7 +22,7 @@ GameNode { # {{ case["description"] }} expect sgf = {{ case["input"]["encoded"] | to_roc }} - result = {{ case["property"] | to_camel }} sgf + result = {{ case["property"] | to_snake }} sgf {%- if case["expected"]["error"] %} result |> Result.isErr {%- else %} diff --git a/exercises/practice/sgf-parsing/sgf-parsing-test.roc b/exercises/practice/sgf-parsing/sgf-parsing-test.roc index bcb1878..abbedfe 100644 --- a/exercises/practice/sgf-parsing/sgf-parsing-test.roc +++ b/exercises/practice/sgf-parsing/sgf-parsing-test.roc @@ -1,13 +1,15 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/sgf-parsing/canonical-data.json -# File last updated on 2024-10-17 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", parser: "https://github.com/lukewilliamboswell/roc-parser/releases/download/0.9.0/w8YKp2YAgQt5REYk912HfKAHBjcXsrnvtjI0CBzoAT4.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import SgfParsing exposing [parse] diff --git a/exercises/practice/sieve/.meta/template.j2 b/exercises/practice/sieve/.meta/template.j2 index e018b27..fb13bc7 100644 --- a/exercises/practice/sieve/.meta/template.j2 +++ b/exercises/practice/sieve/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["limit"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["limit"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/sieve/sieve-test.roc b/exercises/practice/sieve/sieve-test.roc index e4a8e3f..96329e3 100644 --- a/exercises/practice/sieve/sieve-test.roc +++ b/exercises/practice/sieve/sieve-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/sieve/canonical-data.json -# File last updated on 2024-09-15 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Sieve exposing [primes] diff --git a/exercises/practice/simple-linked-list/simple-linked-list-test.roc b/exercises/practice/simple-linked-list/simple-linked-list-test.roc index 1f99d23..6d097c2 100644 --- a/exercises/practice/simple-linked-list/simple-linked-list-test.roc +++ b/exercises/practice/simple-linked-list/simple-linked-list-test.roc @@ -1,10 +1,12 @@ -# File last updated on 2024-10-22 -app [main] { +# File last updated on 2025-1-4 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import SimpleLinkedList exposing [from_list, to_list, push, pop, reverse, len] diff --git a/exercises/practice/space-age/.meta/template.j2 b/exercises/practice/space-age/.meta/template.j2 index 17cf190..4905d2e 100644 --- a/exercises/practice/space-age/.meta/template.j2 +++ b/exercises/practice/space-age/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["planet"] | to_pascal }} {{ case["input"]["seconds"] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["planet"] | to_pascal }} {{ case["input"]["seconds"] }} Num.isApproxEq result {{ case["expected"] }} { atol: 0.01 } {% endfor %} diff --git a/exercises/practice/space-age/space-age-test.roc b/exercises/practice/space-age/space-age-test.roc index a674a02..3ff45c9 100644 --- a/exercises/practice/space-age/space-age-test.roc +++ b/exercises/practice/space-age/space-age-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/space-age/canonical-data.json -# File last updated on 2024-09-07 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import SpaceAge exposing [age] @@ -49,3 +51,4 @@ expect expect result = age Neptune 1821023456 Num.isApproxEq result 0.35 { atol: 0.01 } + diff --git a/exercises/practice/spiral-matrix/.meta/template.j2 b/exercises/practice/spiral-matrix/.meta/template.j2 index 799ba09..f9e1eae 100644 --- a/exercises/practice/spiral-matrix/.meta/template.j2 +++ b/exercises/practice/spiral-matrix/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["size"] }} + result = {{ case["property"] | to_snake }} {{ case["input"]["size"] }} {%- if case["expected"] == [] %} result == [] {%- else %} diff --git a/exercises/practice/spiral-matrix/spiral-matrix-test.roc b/exercises/practice/spiral-matrix/spiral-matrix-test.roc index 8e7d727..84ce513 100644 --- a/exercises/practice/spiral-matrix/spiral-matrix-test.roc +++ b/exercises/practice/spiral-matrix/spiral-matrix-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/spiral-matrix/canonical-data.json -# File last updated on 2024-10-07 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import SpiralMatrix exposing [spiral_matrix] diff --git a/exercises/practice/square-root/.meta/template.j2 b/exercises/practice/square-root/.meta/template.j2 index 6193b1d..3bd1766 100644 --- a/exercises/practice/square-root/.meta/template.j2 +++ b/exercises/practice/square-root/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["radicand"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["radicand"] | to_roc }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/square-root/square-root-test.roc b/exercises/practice/square-root/square-root-test.roc index 6a70515..ac24cd5 100644 --- a/exercises/practice/square-root/square-root-test.roc +++ b/exercises/practice/square-root/square-root-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/square-root/canonical-data.json -# File last updated on 2024-08-29 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import SquareRoot exposing [square_root] diff --git a/exercises/practice/strain/.meta/template.j2 b/exercises/practice/strain/.meta/template.j2 index 64e18dd..8f2bbea 100644 --- a/exercises/practice/strain/.meta/template.j2 +++ b/exercises/practice/strain/.meta/template.j2 @@ -18,7 +18,7 @@ import {{ exercise | to_pascal }} exposing [keep, discard] # {{ case["description"] }} expect list = {{ case["input"]["list"] | to_roc }} - result = list |> {{ case["property"] | to_camel }} {{ function_map[case["input"]["predicate"]] }} + result = list |> {{ case["property"] | to_snake }} {{ function_map[case["input"]["predicate"]] }} expected = {{ case["expected"] | to_roc }} result == expected diff --git a/exercises/practice/strain/strain-test.roc b/exercises/practice/strain/strain-test.roc index 3936fb8..1e32ecf 100644 --- a/exercises/practice/strain/strain-test.roc +++ b/exercises/practice/strain/strain-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/strain/canonical-data.json -# File last updated on 2024-10-08 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Strain exposing [keep, discard] diff --git a/exercises/practice/sublist/.meta/template.j2 b/exercises/practice/sublist/.meta/template.j2 index 40185b1..d197d62 100644 --- a/exercises/practice/sublist/.meta/template.j2 +++ b/exercises/practice/sublist/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["input"]["listOne"] | to_roc }} |> {{ case["property"] | to_camel }} {{ case["input"]["listTwo"] | to_roc }} + result = {{ case["input"]["listOne"] | to_roc }} |> {{ case["property"] | to_snake }} {{ case["input"]["listTwo"] | to_roc }} result == {{ case["expected"] | to_pascal }} {% endfor %} diff --git a/exercises/practice/sublist/sublist-test.roc b/exercises/practice/sublist/sublist-test.roc index cdcd217..75ab438 100644 --- a/exercises/practice/sublist/sublist-test.roc +++ b/exercises/practice/sublist/sublist-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/sublist/canonical-data.json -# File last updated on 2024-09-05 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Sublist exposing [sublist] diff --git a/exercises/practice/sum-of-multiples/.meta/template.j2 b/exercises/practice/sum-of-multiples/.meta/template.j2 index ec8bc44..4ce89bd 100644 --- a/exercises/practice/sum-of-multiples/.meta/template.j2 +++ b/exercises/practice/sum-of-multiples/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ exercise | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ exercise | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["input"]["factors"] | to_roc }} |> {{ exercise | to_camel }} {{ case["input"]["limit"] }} + result = {{ case["input"]["factors"] | to_roc }} |> {{ exercise | to_snake }} {{ case["input"]["limit"] }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/sum-of-multiples/sum-of-multiples-test.roc b/exercises/practice/sum-of-multiples/sum-of-multiples-test.roc index 50611af..5983a3d 100644 --- a/exercises/practice/sum-of-multiples/sum-of-multiples-test.roc +++ b/exercises/practice/sum-of-multiples/sum-of-multiples-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/sum-of-multiples/canonical-data.json -# File last updated on 2024-09-02 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import SumOfMultiples exposing [sum_of_multiples] diff --git a/exercises/practice/tournament/.meta/template.j2 b/exercises/practice/tournament/.meta/template.j2 index 2aaca96..00f52eb 100644 --- a/exercises/practice/tournament/.meta/template.j2 +++ b/exercises/practice/tournament/.meta/template.j2 @@ -2,13 +2,13 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect table = {{ case["input"]["rows"] | to_roc_multiline_string | indent(8) }} - result = {{ case["property"] | to_camel }} table + result = {{ case["property"] | to_snake }} table expected = Ok {{ case["expected"] | to_roc_multiline_string | indent(8) }} result == expected diff --git a/exercises/practice/tournament/tournament-test.roc b/exercises/practice/tournament/tournament-test.roc index db1628d..955b258 100644 --- a/exercises/practice/tournament/tournament-test.roc +++ b/exercises/practice/tournament/tournament-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/tournament/canonical-data.json -# File last updated on 2024-10-13 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Tournament exposing [tally] diff --git a/exercises/practice/transpose/.meta/template.j2 b/exercises/practice/transpose/.meta/template.j2 index aa250dd..58b899d 100644 --- a/exercises/practice/transpose/.meta/template.j2 +++ b/exercises/practice/transpose/.meta/template.j2 @@ -2,13 +2,13 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect input = {{ case["input"]["lines"] | to_roc_multiline_string | replace(" ", "□") | indent(8) }} |> Str.replaceEach "□" " " - result = {{ case["property"] | to_camel }} input |> Str.replaceEach " " "□" + result = {{ case["property"] | to_snake }} input |> Str.replaceEach " " "□" expected = {{ case["expected"] | to_roc_multiline_string | replace(" ", "□") | indent(8) }} result == expected diff --git a/exercises/practice/transpose/transpose-test.roc b/exercises/practice/transpose/transpose-test.roc index fd94d3e..2688537 100644 --- a/exercises/practice/transpose/transpose-test.roc +++ b/exercises/practice/transpose/transpose-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/transpose/canonical-data.json -# File last updated on 2024-09-11 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Transpose exposing [transpose] diff --git a/exercises/practice/triangle/.meta/Example.roc b/exercises/practice/triangle/.meta/Example.roc index 684db29..4717503 100644 --- a/exercises/practice/triangle/.meta/Example.roc +++ b/exercises/practice/triangle/.meta/Example.roc @@ -1,4 +1,4 @@ -module [is_equilateral, is_isoceles, is_scalene] +module [is_equilateral, is_isosceles, is_scalene] approx_eq = \x, y -> Num.isApproxEq x y {} @@ -10,10 +10,10 @@ is_equilateral : (F64, F64, F64) -> Bool is_equilateral = \(a, b, c) -> is_valid_triangle (a, b, c) && approx_eq a b && approx_eq b c -is_isoceles : (F64, F64, F64) -> Bool -is_isoceles = \(a, b, c) -> +is_isosceles : (F64, F64, F64) -> Bool +is_isosceles = \(a, b, c) -> is_valid_triangle (a, b, c) && (approx_eq a b || approx_eq b c || approx_eq a c) is_scalene : (F64, F64, F64) -> Bool is_scalene = \(a, b, c) -> - is_valid_triangle (a, b, c) && !(is_isoceles (a, b, c)) \ No newline at end of file + is_valid_triangle (a, b, c) && !(is_isosceles (a, b, c)) \ No newline at end of file diff --git a/exercises/practice/triangle/.meta/template.j2 b/exercises/practice/triangle/.meta/template.j2 index 3420af2..539bb23 100644 --- a/exercises/practice/triangle/.meta/template.j2 +++ b/exercises/practice/triangle/.meta/template.j2 @@ -2,7 +2,7 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [is_equilateral, is_isoceles, is_scalene] +import {{ exercise | to_pascal }} exposing [is_equilateral, is_isosceles, is_scalene] {% for supercase in cases %} ## @@ -12,8 +12,8 @@ import {{ exercise | to_pascal }} exposing [is_equilateral, is_isoceles, is_scal {% for case in supercase["cases"] -%} # {{ case["description"] }} expect - result = is{{ case["property"] | to_pascal }} {{ case["input"]["sides"] | to_roc_tuple }} + result = is_{{ case["property"] }} {{ case["input"]["sides"] | to_roc_tuple }} result == {{ case["expected"] | to_roc }} {% endfor %} -{% endfor %} +{% endfor %} \ No newline at end of file diff --git a/exercises/practice/triangle/Triangle.roc b/exercises/practice/triangle/Triangle.roc index e4323b8..f1e3ff5 100644 --- a/exercises/practice/triangle/Triangle.roc +++ b/exercises/practice/triangle/Triangle.roc @@ -1,12 +1,12 @@ -module [is_equilateral, is_isoceles, is_scalene] +module [is_equilateral, is_isosceles, is_scalene] is_equilateral : (F64, F64, F64) -> Bool is_equilateral = \(a, b, c) -> crash "Please implement the 'is_equilateral' function" -is_isoceles : (F64, F64, F64) -> Bool -is_isoceles = \(a, b, c) -> - crash "Please implement the 'is_isoceles' function" +is_isosceles : (F64, F64, F64) -> Bool +is_isosceles = \(a, b, c) -> + crash "Please implement the 'is_isosceles' function" is_scalene : (F64, F64, F64) -> Bool is_scalene = \(a, b, c) -> diff --git a/exercises/practice/triangle/triangle-test.roc b/exercises/practice/triangle/triangle-test.roc index f619608..bbe2f45 100644 --- a/exercises/practice/triangle/triangle-test.roc +++ b/exercises/practice/triangle/triangle-test.roc @@ -1,14 +1,16 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/triangle/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" -import Triangle exposing [is_equilateral, is_isoceles, is_scalene] +import Triangle exposing [is_equilateral, is_isosceles, is_scalene] ## ## equilateral triangle @@ -45,47 +47,47 @@ expect # last two sides are equal expect - result = is_isoceles (3, 4, 4) + result = is_isosceles (3, 4, 4) result == Bool.true # first two sides are equal expect - result = is_isoceles (4, 4, 3) + result = is_isosceles (4, 4, 3) result == Bool.true # first and last sides are equal expect - result = is_isoceles (4, 3, 4) + result = is_isosceles (4, 3, 4) result == Bool.true # equilateral triangles are also isosceles expect - result = is_isoceles (4, 4, 4) + result = is_isosceles (4, 4, 4) result == Bool.true # no sides are equal expect - result = is_isoceles (2, 3, 4) + result = is_isosceles (2, 3, 4) result == Bool.false # first triangle inequality violation expect - result = is_isoceles (1, 1, 3) + result = is_isosceles (1, 1, 3) result == Bool.false # second triangle inequality violation expect - result = is_isoceles (1, 3, 1) + result = is_isosceles (1, 3, 1) result == Bool.false # third triangle inequality violation expect - result = is_isoceles (3, 1, 1) + result = is_isosceles (3, 1, 1) result == Bool.false # sides may be floats expect - result = is_isoceles (0.5f64, 0.4f64, 0.5f64) + result = is_isosceles (0.5f64, 0.4f64, 0.5f64) result == Bool.true ## diff --git a/exercises/practice/two-bucket/.meta/Example.roc b/exercises/practice/two-bucket/.meta/Example.roc index 43797ce..ac0836e 100644 --- a/exercises/practice/two-bucket/.meta/Example.roc +++ b/exercises/practice/two-bucket/.meta/Example.roc @@ -35,27 +35,27 @@ bfs = \{ start, neighbors, success } -> help [start] (Set.empty {}) (Dict.empty {}) measure : - { bucketOne : U64, bucketTwo : U64, goal : U64, startBucket : [One, Two] } + { bucket_one : U64, bucket_two : U64, goal : U64, start_bucket : [One, Two] } -> - Result { moves : U64, goalBucket : [One, Two], otherBucket : U64 } [NoSolutionExists] -measure = \{ bucketOne, bucketTwo, goal, startBucket } -> + Result { moves : U64, goal_bucket : [One, Two], other_bucket : U64 } [NoSolutionExists] +measure = \{ bucket_one, bucket_two, goal, start_bucket } -> if goal == 0 then - Ok { moves: 0, goalBucket: One, otherBucket: 0 } + Ok { moves: 0, goal_bucket: One, other_bucket: 0 } else start = - when startBucket is - One -> { volume_one: bucketOne, volume_two: 0 } - Two -> { volume_one: 0, volume_two: bucketTwo } + when start_bucket is + One -> { volume_one: bucket_one, volume_two: 0 } + Two -> { volume_one: 0, volume_two: bucket_two } neighbors = \{ volume_one, volume_two } -> - volume_one_to_two = Num.min volume_one (bucketTwo - volume_two) - volume_two_to_one = Num.min volume_two (bucketOne - volume_one) + volume_one_to_two = Num.min volume_one (bucket_two - volume_two) + volume_two_to_one = Num.min volume_two (bucket_one - volume_one) [ { volume_one: 0, volume_two }, # empty bucket one { volume_one, volume_two: 0 }, # empty bucket two - { volume_one: bucketOne, volume_two }, # fill bucket one - { volume_one, volume_two: bucketTwo }, # fill bucket two + { volume_one: bucket_one, volume_two }, # fill bucket one + { volume_one, volume_two: bucket_two }, # fill bucket two { # pour bucket one into bucket two volume_one: volume_one - volume_one_to_two, @@ -72,9 +72,9 @@ measure = \{ bucketOne, bucketTwo, goal, startBucket } -> || # forbidden move: cannot end up with the starting bucket empty and # the other bucket full - when startBucket is - One -> v1 == 0 && v2 == bucketTwo - Two -> v1 == bucketOne && v2 == 0 + when start_bucket is + One -> v1 == 0 && v2 == bucket_two + Two -> v1 == bucket_one && v2 == 0 success = \{ volume_one, volume_two } -> volume_one == goal || volume_two == goal @@ -82,8 +82,8 @@ measure = \{ bucketOne, bucketTwo, goal, startBucket } -> Ok [.. as rest, last] -> Ok { moves: List.len rest + 1, - goalBucket: if last.volume_one == goal then One else Two, - otherBucket: if last.volume_one == goal then last.volume_two else last.volume_one, + goal_bucket: if last.volume_one == goal then One else Two, + other_bucket: if last.volume_one == goal then last.volume_two else last.volume_one, } _ -> Err NoSolutionExists \ No newline at end of file diff --git a/exercises/practice/two-bucket/.meta/template.j2 b/exercises/practice/two-bucket/.meta/template.j2 index 4d76292..84714e5 100644 --- a/exercises/practice/two-bucket/.meta/template.j2 +++ b/exercises/practice/two-bucket/.meta/template.j2 @@ -2,24 +2,24 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} { - bucket_one: {{ case["input"]["bucket_one"] }}, - bucket_two: {{ case["input"]["bucket_two"] }}, + result = {{ case["property"] | to_snake }} { + bucket_one: {{ case["input"]["bucketOne"] }}, + bucket_two: {{ case["input"]["bucketTwo"] }}, goal: {{ case["input"]["goal"] }}, - start_bucket: {{ case["input"]["start_bucket"] | to_pascal }}, + start_bucket: {{ case["input"]["startBucket"] | to_pascal }}, } {%- if case["expected"]["error"] %} result |> Result.isErr {%- else %} expected = Ok { moves: {{ case["expected"]["moves"] }}, - goal_bucket: {{ case["expected"]["goal_bucket"] | to_pascal }}, - other_bucket: {{ case["expected"]["other_bucket"] }}, + goal_bucket: {{ case["expected"]["goalBucket"] | to_pascal }}, + other_bucket: {{ case["expected"]["otherBucket"] }}, } result == expected {%- endif %} diff --git a/exercises/practice/two-bucket/two-bucket-test.roc b/exercises/practice/two-bucket/two-bucket-test.roc index 63f443d..e27258f 100644 --- a/exercises/practice/two-bucket/two-bucket-test.roc +++ b/exercises/practice/two-bucket/two-bucket-test.roc @@ -1,137 +1,139 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/two-bucket/canonical-data.json -# File last updated on 2024-10-01 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import TwoBucket exposing [measure] # Measure using bucket one of size 3 and bucket two of size 5 - start with bucket one expect result = measure { - bucketOne: 3, - bucketTwo: 5, + bucket_one: 3, + bucket_two: 5, goal: 1, - startBucket: One, + start_bucket: One, } expected = Ok { moves: 4, - goalBucket: One, - otherBucket: 5, + goal_bucket: One, + other_bucket: 5, } result == expected # Measure using bucket one of size 3 and bucket two of size 5 - start with bucket two expect result = measure { - bucketOne: 3, - bucketTwo: 5, + bucket_one: 3, + bucket_two: 5, goal: 1, - startBucket: Two, + start_bucket: Two, } expected = Ok { moves: 8, - goalBucket: Two, - otherBucket: 3, + goal_bucket: Two, + other_bucket: 3, } result == expected # Measure using bucket one of size 7 and bucket two of size 11 - start with bucket one expect result = measure { - bucketOne: 7, - bucketTwo: 11, + bucket_one: 7, + bucket_two: 11, goal: 2, - startBucket: One, + start_bucket: One, } expected = Ok { moves: 14, - goalBucket: One, - otherBucket: 11, + goal_bucket: One, + other_bucket: 11, } result == expected # Measure using bucket one of size 7 and bucket two of size 11 - start with bucket two expect result = measure { - bucketOne: 7, - bucketTwo: 11, + bucket_one: 7, + bucket_two: 11, goal: 2, - startBucket: Two, + start_bucket: Two, } expected = Ok { moves: 18, - goalBucket: Two, - otherBucket: 7, + goal_bucket: Two, + other_bucket: 7, } result == expected # Measure one step using bucket one of size 1 and bucket two of size 3 - start with bucket two expect result = measure { - bucketOne: 1, - bucketTwo: 3, + bucket_one: 1, + bucket_two: 3, goal: 3, - startBucket: Two, + start_bucket: Two, } expected = Ok { moves: 1, - goalBucket: Two, - otherBucket: 0, + goal_bucket: Two, + other_bucket: 0, } result == expected # Measure using bucket one of size 2 and bucket two of size 3 - start with bucket one and end with bucket two expect result = measure { - bucketOne: 2, - bucketTwo: 3, + bucket_one: 2, + bucket_two: 3, goal: 3, - startBucket: One, + start_bucket: One, } expected = Ok { moves: 2, - goalBucket: Two, - otherBucket: 2, + goal_bucket: Two, + other_bucket: 2, } result == expected # Not possible to reach the goal expect result = measure { - bucketOne: 6, - bucketTwo: 15, + bucket_one: 6, + bucket_two: 15, goal: 5, - startBucket: One, + start_bucket: One, } result |> Result.isErr # With the same buckets but a different goal, then it is possible expect result = measure { - bucketOne: 6, - bucketTwo: 15, + bucket_one: 6, + bucket_two: 15, goal: 9, - startBucket: One, + start_bucket: One, } expected = Ok { moves: 10, - goalBucket: Two, - otherBucket: 0, + goal_bucket: Two, + other_bucket: 0, } result == expected # Goal larger than both buckets is impossible expect result = measure { - bucketOne: 5, - bucketTwo: 7, + bucket_one: 5, + bucket_two: 7, goal: 8, - startBucket: One, + start_bucket: One, } result |> Result.isErr diff --git a/exercises/practice/two-fer/.meta/template.j2 b/exercises/practice/two-fer/.meta/template.j2 index f7d1acd..d343bb7 100644 --- a/exercises/practice/two-fer/.meta/template.j2 +++ b/exercises/practice/two-fer/.meta/template.j2 @@ -2,15 +2,15 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ exercise | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ exercise | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect {%- if case["input"]["name"] == None %} - result = {{ case["property"] | to_camel }} Anonymous + result = {{ case["property"] | to_snake }} Anonymous {%- else %} - result = {{ case["property"] | to_camel }} (Name {{ case["input"]["name"] | to_roc }}) + result = {{ case["property"] | to_snake }} (Name {{ case["input"]["name"] | to_roc }}) {%- endif %} result == {{ case["expected"] | to_roc }} diff --git a/exercises/practice/two-fer/two-fer-test.roc b/exercises/practice/two-fer/two-fer-test.roc index d43c7f4..4125603 100644 --- a/exercises/practice/two-fer/two-fer-test.roc +++ b/exercises/practice/two-fer/two-fer-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/two-fer/canonical-data.json -# File last updated on 2024-08-27 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import TwoFer exposing [two_fer] diff --git a/exercises/practice/variable-length-quantity/variable-length-quantity-test.roc b/exercises/practice/variable-length-quantity/variable-length-quantity-test.roc index e043899..036d70d 100644 --- a/exercises/practice/variable-length-quantity/variable-length-quantity-test.roc +++ b/exercises/practice/variable-length-quantity/variable-length-quantity-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/variable-length-quantity/canonical-data.json -# File last updated on 2024-10-15 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import VariableLengthQuantity exposing [encode, decode] diff --git a/exercises/practice/word-count/.meta/template.j2 b/exercises/practice/word-count/.meta/template.j2 index 8902bfa..59fc61d 100644 --- a/exercises/practice/word-count/.meta/template.j2 +++ b/exercises/practice/word-count/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["sentence"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["sentence"] | to_roc }} expected = Dict.fromList [ {%- for word, count in case["expected"].items() %} ({{ word | to_roc }}, {{ count }}), diff --git a/exercises/practice/word-count/word-count-test.roc b/exercises/practice/word-count/word-count-test.roc index 58dc1fd..ba0515f 100644 --- a/exercises/practice/word-count/word-count-test.roc +++ b/exercises/practice/word-count/word-count-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/word-count/canonical-data.json -# File last updated on 2024-09-29 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import WordCount exposing [count_words] diff --git a/exercises/practice/word-search/.meta/template.j2 b/exercises/practice/word-search/.meta/template.j2 index 7a534aa..9933251 100644 --- a/exercises/practice/word-search/.meta/template.j2 +++ b/exercises/practice/word-search/.meta/template.j2 @@ -2,14 +2,14 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect grid = {{ case["input"]["grid"] | to_roc_multiline_string | indent(8) }} - words_to_search_for = {{ case["input"]["words_to_search_for"] | to_roc }} - result = grid |> {{ case["property"] | to_camel }} words_to_search_for + words_to_search_for = {{ case["input"]["wordsToSearchFor"] | to_roc }} + result = grid |> {{ case["property"] | to_snake }} words_to_search_for expected = Dict.fromList [ {%- for word, result in case["expected"].items() %} {%- if result is none %} diff --git a/exercises/practice/word-search/word-search-test.roc b/exercises/practice/word-search/word-search-test.roc index 54a42f2..b0578d4 100644 --- a/exercises/practice/word-search/word-search-test.roc +++ b/exercises/practice/word-search/word-search-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/word-search/canonical-data.json -# File last updated on 2024-10-07 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import WordSearch exposing [search] diff --git a/exercises/practice/wordy/.meta/template.j2 b/exercises/practice/wordy/.meta/template.j2 index 279d4aa..8a333ef 100644 --- a/exercises/practice/wordy/.meta/template.j2 +++ b/exercises/practice/wordy/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [answer] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} {{ case["input"]["question"] | to_roc }} + result = {{ case["property"] | to_snake }} {{ case["input"]["question"] | to_roc }} {%- if case["expected"]["error"] %} Result.isErr result {%- else %} diff --git a/exercises/practice/wordy/wordy-test.roc b/exercises/practice/wordy/wordy-test.roc index fbe2d13..c369735 100644 --- a/exercises/practice/wordy/wordy-test.roc +++ b/exercises/practice/wordy/wordy-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/wordy/canonical-data.json -# File last updated on 2024-09-03 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Wordy exposing [answer] diff --git a/exercises/practice/yacht/.meta/template.j2 b/exercises/practice/yacht/.meta/template.j2 index a73d28d..aa10461 100644 --- a/exercises/practice/yacht/.meta/template.j2 +++ b/exercises/practice/yacht/.meta/template.j2 @@ -2,12 +2,12 @@ {{ macros.canonical_ref() }} {{ macros.header() }} -import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_camel }}] +import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["input"]["dice"] | to_roc }} |> {{ case["property"] | to_camel }} {{ case["input"]["category"] | to_pascal }} + result = {{ case["input"]["dice"] | to_roc }} |> {{ case["property"] | to_snake }} {{ case["input"]["category"] | to_pascal }} result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/yacht/yacht-test.roc b/exercises/practice/yacht/yacht-test.roc index 917a112..b8a10e3 100644 --- a/exercises/practice/yacht/yacht-test.roc +++ b/exercises/practice/yacht/yacht-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/yacht/canonical-data.json -# File last updated on 2024-09-23 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import Yacht exposing [score] diff --git a/exercises/practice/zebra-puzzle/.meta/template.j2 b/exercises/practice/zebra-puzzle/.meta/template.j2 index 99c755b..8025968 100644 --- a/exercises/practice/zebra-puzzle/.meta/template.j2 +++ b/exercises/practice/zebra-puzzle/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [owns_zebra, drinks_water] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_camel }} + result = {{ case["property"] | to_snake }} result == Ok {{ case["expected"] }} {% endfor %} diff --git a/exercises/practice/zebra-puzzle/zebra-puzzle-test.roc b/exercises/practice/zebra-puzzle/zebra-puzzle-test.roc index e5771da..a8ff4a3 100644 --- a/exercises/practice/zebra-puzzle/zebra-puzzle-test.roc +++ b/exercises/practice/zebra-puzzle/zebra-puzzle-test.roc @@ -1,12 +1,14 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/zebra-puzzle/canonical-data.json -# File last updated on 2024-10-22 -app [main] { +# File last updated on 2025-01-04 +app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.18.0/0APbwVN1_p1mJ96tXjaoiUCr8NBGamr8G8Ac_DrXR-o.tar.br", } +import pf.Stdout + main! = \_args -> - Ok {} + Stdout.line! "" import ZebraPuzzle exposing [owns_zebra, drinks_water]