diff --git a/bin/add-exercise b/bin/add-exercise index 921a5fa5..b813d0ab 100755 --- a/bin/add-exercise +++ b/bin/add-exercise @@ -68,7 +68,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["myArg"] | to_roc }} + result = {{ case["property"] | to_snake }}({{ case["input"]["myArg"] | to_roc }}) result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/config/generator_macros.j2 b/config/generator_macros.j2 index 97b1cf4f..287a587e 100644 --- a/config/generator_macros.j2 +++ b/config/generator_macros.j2 @@ -37,7 +37,7 @@ app [main!] { import pf.Stdout main! = |_args| - Stdout.line! "" + Stdout.line!("") {%- endmacro %} diff --git a/exercises/practice/accumulate/.meta/template.j2 b/exercises/practice/accumulate/.meta/template.j2 index 7532eb0e..3b652ad1 100644 --- a/exercises/practice/accumulate/.meta/template.j2 +++ b/exercises/practice/accumulate/.meta/template.j2 @@ -5,34 +5,36 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {% set accumulators = { - "(x) => x * x": "\\x ->\n x * x", + "(x) => x * x": "|x|\n x * x", "(x) => upcase(x)": "to_upper", "(x) => reverse(x)": "reverse", - "(x) => accumulate([\"1\", \"2\", \"3\"], (y) => x + y)": "\\x ->\n accumulate [\"1\", \"2\", \"3\"] (\\y -> Str.concat x y)" + "(x) => accumulate([\"1\", \"2\", \"3\"], (y) => x + y)": "|x|\n accumulate([\"1\", \"2\", \"3\"], |y| Str.concat(x, y))" } -%} {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 %} reverse : Str -> Str reverse = |str| - Str.to_utf8 str + Str.to_utf8(str) |> List.reverse |> Str.from_utf8 - |> Result.with_default "" + |> Result.with_default("") to_upper : Str -> Str to_upper = |str| - Str.to_utf8 str - |> List.map |byte| - if 'a' <= byte && byte <= 'z' then - byte - 'a' + 'A' - else - byte + Str.to_utf8(str) + |> List.map( + |byte| + if 'a' <= byte && byte <= 'z' then + byte - 'a' + 'A' + else + byte + ) |> Str.from_utf8 - |> Result.with_default "" + |> Result.with_default("") diff --git a/exercises/practice/accumulate/accumulate-test.roc b/exercises/practice/accumulate/accumulate-test.roc index c1603de3..fbf6ed81 100644 --- a/exercises/practice/accumulate/accumulate-test.roc +++ b/exercises/practice/accumulate/accumulate-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/acronym/.meta/template.j2 b/exercises/practice/acronym/.meta/template.j2 index 6c2dcdea..c49cadb6 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_snake }} {{ 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 1355a401..cf6e011e 100644 --- a/exercises/practice/acronym/acronym-test.roc +++ b/exercises/practice/acronym/acronym-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/affine-cipher/.meta/template.j2 b/exercises/practice/affine-cipher/.meta/template.j2 index 1f738429..764b52b8 100644 --- a/exercises/practice/affine-cipher/.meta/template.j2 +++ b/exercises/practice/affine-cipher/.meta/template.j2 @@ -14,11 +14,11 @@ 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_snake }} phrase key + result = {{ case["property"] | to_snake }}(phrase, key) {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} - expected = Ok {{ case["expected"] | to_roc }} + expected = Ok({{ case["expected"] | to_roc }}) result == expected {%- endif %} diff --git a/exercises/practice/affine-cipher/affine-cipher-test.roc b/exercises/practice/affine-cipher/affine-cipher-test.roc index a951527c..402ca1e8 100644 --- a/exercises/practice/affine-cipher/affine-cipher-test.roc +++ b/exercises/practice/affine-cipher/affine-cipher-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/all-your-base/.meta/template.j2 b/exercises/practice/all-your-base/.meta/template.j2 index c028fa90..dbba8591 100644 --- a/exercises/practice/all-your-base/.meta/template.j2 +++ b/exercises/practice/all-your-base/.meta/template.j2 @@ -7,11 +7,11 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - 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 }} } + 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.is_err {%- else %} - result == Ok {{ case["expected"] }} + result == Ok({{ case["expected"] }}) {%- endif %} {% 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 ba7b7700..8ea2795a 100644 --- a/exercises/practice/all-your-base/all-your-base-test.roc +++ b/exercises/practice/all-your-base/all-your-base-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/allergies/.meta/template.j2 b/exercises/practice/allergies/.meta/template.j2 index b59ce358..33f1aa05 100644 --- a/exercises/practice/allergies/.meta/template.j2 +++ b/exercises/practice/allergies/.meta/template.j2 @@ -9,11 +9,11 @@ import {{ exercise | to_pascal }} exposing [allergic_to, set] # {{ outerCase["description"] }} {{ case["description"] | default('') }} expect {%- if case["property"] == "allergicTo" %} - result = allergic_to {{ case["input"]["item"] | to_pascal }} {{ case["input"]["score"] | to_roc }} + result = allergic_to({{ case["input"]["item"] | to_pascal }}, {{ case["input"]["score"] | to_roc }}) result == {{ case["expected"] | to_roc }} {%- else %} - result = set {{ case["input"]["score"] }} - result == Set.from_list [{{ case["expected"] | map('to_pascal') | join(", ") }}] + result = set({{ case["input"]["score"] }}) + result == Set.from_list([{{ case["expected"] | map('to_pascal') | join(", ") }}]) {%- endif %} {% endfor %} diff --git a/exercises/practice/allergies/allergies-test.roc b/exercises/practice/allergies/allergies-test.roc index 374ba9ec..e2f4f52d 100644 --- a/exercises/practice/allergies/allergies-test.roc +++ b/exercises/practice/allergies/allergies-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/alphametics/.meta/template.j2 b/exercises/practice/alphametics/.meta/template.j2 index d46f8ef5..543145f4 100644 --- a/exercises/practice/alphametics/.meta/template.j2 +++ b/exercises/practice/alphametics/.meta/template.j2 @@ -7,15 +7,15 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["puzzle"] | to_roc }} + result = {{ case["property"] | to_snake }}({{ case["input"]["puzzle"] | to_roc }}) {%- if case["expected"] %} - Result.with_default result [] |> Set.from_list == Set.from_list [ + Result.with_default(result, []) |> Set.from_list == Set.from_list([ {%- for letter, value in case["expected"].items() %} ('{{ letter }}', {{ value }}), {%- endfor %} - ] + ]) {%- else %} - Result.is_err result + Result.is_err(result) {%- endif %} {% endfor %} diff --git a/exercises/practice/alphametics/alphametics-test.roc b/exercises/practice/alphametics/alphametics-test.roc index 3c926595..dd11bee3 100644 --- a/exercises/practice/alphametics/alphametics-test.roc +++ b/exercises/practice/alphametics/alphametics-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/anagram/.meta/template.j2 b/exercises/practice/anagram/.meta/template.j2 index 89654c9b..3af1c1ad 100644 --- a/exercises/practice/anagram/.meta/template.j2 +++ b/exercises/practice/anagram/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 4156219a..1b4f2225 100644 --- a/exercises/practice/anagram/anagram-test.roc +++ b/exercises/practice/anagram/anagram-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", unicode: "https://github.com/roc-lang/unicode/releases/download/0.3.0/9KKFsA4CdOz0JIOL7iBSI_2jGIXQ6TsFBXgd086idpY.tar.br", diff --git a/exercises/practice/armstrong-numbers/.meta/template.j2 b/exercises/practice/armstrong-numbers/.meta/template.j2 index e9e45470..3bb36c52 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_snake }} {{ 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 f85f5c08..01d9ff5a 100644 --- a/exercises/practice/armstrong-numbers/armstrong-numbers-test.roc +++ b/exercises/practice/armstrong-numbers/armstrong-numbers-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/atbash-cipher/.meta/template.j2 b/exercises/practice/atbash-cipher/.meta/template.j2 index 278ded24..5c7ae3ef 100644 --- a/exercises/practice/atbash-cipher/.meta/template.j2 +++ b/exercises/practice/atbash-cipher/.meta/template.j2 @@ -15,7 +15,7 @@ expect phrase = {{ case["input"]["phrase"] | to_roc }} result = phrase |> {{ case["property"] | to_snake }} expected = {{ case["expected"] | to_roc }} - result == Ok expected + result == Ok(expected) {% endfor %} {% endfor %} diff --git a/exercises/practice/atbash-cipher/atbash-cipher-test.roc b/exercises/practice/atbash-cipher/atbash-cipher-test.roc index 1a710a75..a59e7034 100644 --- a/exercises/practice/atbash-cipher/atbash-cipher-test.roc +++ b/exercises/practice/atbash-cipher/atbash-cipher-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/binary-search-tree/.meta/template.j2 b/exercises/practice/binary-search-tree/.meta/template.j2 index 52fea611..1abf72ce 100644 --- a/exercises/practice/binary-search-tree/.meta/template.j2 +++ b/exercises/practice/binary-search-tree/.meta/template.j2 @@ -9,11 +9,11 @@ import {{ exercise | to_pascal }} exposing [from_list, to_list] {%- endmacro %} {% macro to_tree(tree) -%} -{% if tree is none %}Nil{% else %}Node { +{% if tree is none %}Nil{% else %}Node({ value: {{ tree["data"] }}, left: {{ to_tree(tree["left"]) }}, right: {{ to_tree(tree["right"]) }}, -}{% endif %} +}){% endif %} {%- endmacro %} {% for supercase in cases %} @@ -33,12 +33,12 @@ import {{ exercise | to_pascal }} exposing [from_list, to_list] expect data = {{ to_int_list(subcase["input"]["treeData"]) }} {%- if subcase["property"] == "data" %} - result = data |> from_list + result = from_list(data) expected = {{ to_tree(subcase["expected"]) }} result == expected {%- else %} - tree = data |> from_list - result = tree |> to_list + tree = from_list(data) + result = to_list(tree) expected = {{ to_int_list(subcase["expected"]) }} result == expected {%- endif %} 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 a18f700a..2348f304 100644 --- a/exercises/practice/binary-search-tree/binary-search-tree-test.roc +++ b/exercises/practice/binary-search-tree/binary-search-tree-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } @@ -18,7 +18,7 @@ import BinarySearchTree exposing [from_list, to_list] expect data = [4] - result = data |> from_list + result = from_list(data) expected = Node( { value: 4, @@ -35,7 +35,7 @@ expect # smaller number at left node expect data = [4, 2] - result = data |> from_list + result = from_list(data) expected = Node( { value: 4, @@ -54,7 +54,7 @@ expect # same number at left node expect data = [4, 4] - result = data |> from_list + result = from_list(data) expected = Node( { value: 4, @@ -73,7 +73,7 @@ expect # greater number at right node expect data = [4, 5] - result = data |> from_list + result = from_list(data) expected = Node( { value: 4, @@ -95,7 +95,7 @@ expect expect data = [4, 2, 6, 1, 3, 5, 7] - result = data |> from_list + result = from_list(data) expected = Node( { value: 4, @@ -148,40 +148,40 @@ expect # can sort single number expect data = [2] - tree = data |> from_list - result = tree |> to_list + tree = from_list(data) + result = to_list(tree) expected = [2] result == expected # can sort if second number is smaller than first expect data = [2, 1] - tree = data |> from_list - result = tree |> to_list + tree = from_list(data) + result = to_list(tree) expected = [1, 2] result == expected # can sort if second number is same as first expect data = [2, 2] - tree = data |> from_list - result = tree |> to_list + tree = from_list(data) + result = to_list(tree) expected = [2, 2] result == expected # can sort if second number is greater than first expect data = [2, 3] - tree = data |> from_list - result = tree |> to_list + tree = from_list(data) + result = to_list(tree) expected = [2, 3] result == expected # can sort complex tree expect data = [2, 1, 3, 6, 7, 5] - tree = data |> from_list - result = tree |> to_list + tree = from_list(data) + result = to_list(tree) 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 04ba2d3d..c24afc3a 100644 --- a/exercises/practice/binary-search/.meta/template.j2 +++ b/exercises/practice/binary-search/.meta/template.j2 @@ -7,11 +7,11 @@ 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_snake }} {{ case["input"]["value"] }} + result = {{ case["input"]["array"] | to_roc }} |> {{ case["property"] | to_snake }}({{ case["input"]["value"] }}) {%- if case["expected"]["error"] %} - Result.is_err result + Result.is_err(result) {%- else %} - result == Ok {{ case["expected"] }} + result == Ok({{ case["expected"] }}) {%- endif %} {% endfor %} diff --git a/exercises/practice/binary-search/binary-search-test.roc b/exercises/practice/binary-search/binary-search-test.roc index 68fb31fd..e0cb6353 100644 --- a/exercises/practice/binary-search/binary-search-test.roc +++ b/exercises/practice/binary-search/binary-search-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/binary/.meta/template.j2 b/exercises/practice/binary/.meta/template.j2 index c60a6475..4cca58ab 100644 --- a/exercises/practice/binary/.meta/template.j2 +++ b/exercises/practice/binary/.meta/template.j2 @@ -7,9 +7,9 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 }} + result == Ok({{ case["expected"] | to_roc }}) {%- else %} result |> Result.is_err {%- endif %} diff --git a/exercises/practice/binary/binary-test.roc b/exercises/practice/binary/binary-test.roc index 432c26e5..f6095ef0 100644 --- a/exercises/practice/binary/binary-test.roc +++ b/exercises/practice/binary/binary-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/bob/.meta/template.j2 b/exercises/practice/bob/.meta/template.j2 index fe5df14b..9995b77c 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_snake }} {{ 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/.meta/tests.toml b/exercises/practice/bob/.meta/tests.toml index ea47d6bb..5299e289 100644 --- a/exercises/practice/bob/.meta/tests.toml +++ b/exercises/practice/bob/.meta/tests.toml @@ -71,6 +71,7 @@ description = "alternate silence" [66953780-165b-4e7e-8ce3-4bcb80b6385a] description = "multiple line question" +include = false [5371ef75-d9ea-4103-bcfa-2da973ddec1b] description = "starting with whitespace" @@ -83,3 +84,7 @@ description = "other whitespace" [12983553-8601-46a8-92fa-fcaa3bc4a2a0] description = "non-question ending with whitespace" + +[2c7278ac-f955-4eb4-bf8f-e33eb4116a15] +description = "multiple line question" +reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a" diff --git a/exercises/practice/bob/bob-test.roc b/exercises/practice/bob/bob-test.roc index 9aea6e77..65a21f94 100644 --- a/exercises/practice/bob/bob-test.roc +++ b/exercises/practice/bob/bob-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } @@ -112,11 +112,6 @@ expect result = response("\t\t\t\t\t\t\t\t\t\t") result == "Fine. Be that way!" -# multiple line question -expect - result = response("\nDoes this cryogenic chamber make me look fat?\nNo.") - result == "Whatever." - # starting with whitespace expect result = response(" hmmmmmmm...") @@ -137,3 +132,8 @@ expect result = response("This is a statement ending with whitespace ") result == "Whatever." +# multiple line question +expect + result = response("\nDoes this cryogenic chamber make\n me look fat?") + result == "Sure." + diff --git a/exercises/practice/bowling/.meta/template.j2 b/exercises/practice/bowling/.meta/template.j2 index e5f6da01..17e2f490 100644 --- a/exercises/practice/bowling/.meta/template.j2 +++ b/exercises/practice/bowling/.meta/template.j2 @@ -6,39 +6,42 @@ import {{ exercise | to_pascal }} exposing [Game, create, roll, score] replay_game : List U64 -> Result Game _ replay_game = |rolls| - new_game = create? {} + new_game = create({})? rolls - |> List.walk_until (Ok new_game) \state, pins -> - when state is - Ok game -> - when game |> roll pins is - Ok updated_game -> Continue (Ok updated_game) - Err err -> Break (Err err) + |> List.walk_until( + Ok(new_game), + |state, pins| + when state is + Ok(game) -> + when game |> roll(pins) is + Ok(updated_game) -> Continue(Ok(updated_game)) + Err(err) -> Break(Err(err)) - Err _ -> crash "Impossible, we don't start or Continue with an Err" + Err(_) -> crash "Impossible, we don't start or Continue with an Err" + ) {% for case in cases -%} # {{ case["description"] }} expect - maybe_game = create { previous_rolls : {{ case["input"]["previousRolls"] | to_roc }} } + maybe_game = create({ previous_rolls : {{ case["input"]["previousRolls"] | to_roc }} }) {%- if case["property"] == "score" %} - result = maybe_game |> Result.try \game -> score game + result = maybe_game |> Result.try(|game| score(game)) {%- else %} - result = maybe_game |> Result.try \game -> - game |> {{ case["property"] | to_snake }} {{ case["input"]["roll"] }} + result = maybe_game |> Result.try(|game| + game |> {{ case["property"] | to_snake }}({{ case["input"]["roll"] }})) {%- endif %} {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} - result == Ok {{ case["expected"] | to_roc }} + result == Ok({{ case["expected"] | to_roc }}) {%- endif %} {%- if case["property"] == "score" and not case["expected"]["error"] %} # should be able to replay this finished game from the start expect rolls = {{ case["input"]["previousRolls"] | to_roc }} - result = replay_game rolls + result = replay_game(rolls) result |> Result.is_ok {%- endif %} diff --git a/exercises/practice/bowling/bowling-test.roc b/exercises/practice/bowling/bowling-test.roc index 0932935c..4bacc4ff 100644 --- a/exercises/practice/bowling/bowling-test.roc +++ b/exercises/practice/bowling/bowling-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } @@ -25,7 +25,7 @@ replay_game = |rolls| Ok(updated_game) -> Continue(Ok(updated_game)) Err(err) -> Break(Err(err)) - Err(_) -> crash("Impossible, we don't start or Continue with an Err"), + Err(_) -> crash "Impossible, we don't start or Continue with an Err", ) # should be able to score a game with all zeros diff --git a/exercises/practice/change/.meta/template.j2 b/exercises/practice/change/.meta/template.j2 index e689e598..1aa34c3d 100644 --- a/exercises/practice/change/.meta/template.j2 +++ b/exercises/practice/change/.meta/template.j2 @@ -8,11 +8,11 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } # {{ case["description"] }} expect coins = {{ case["input"]["coins"] | to_roc }} - result = coins |> {{ case["property"] | to_snake }} {{ case["input"]["target"] }} + result = coins |> {{ case["property"] | to_snake }}({{ case["input"]["target"] }}) {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} - result == Ok {{ case["expected"] | to_roc }} + result == Ok({{ case["expected"] | to_roc }}) {%- endif %} {% endfor %} diff --git a/exercises/practice/change/change-test.roc b/exercises/practice/change/change-test.roc index c37ca304..f50911bf 100644 --- a/exercises/practice/change/change-test.roc +++ b/exercises/practice/change/change-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/circular-buffer/.meta/template.j2 b/exercises/practice/circular-buffer/.meta/template.j2 index ff9ecd3e..a03dbc83 100644 --- a/exercises/practice/circular-buffer/.meta/template.j2 +++ b/exercises/practice/circular-buffer/.meta/template.j2 @@ -8,39 +8,39 @@ import {{ exercise | to_pascal }} exposing [create, read, write, overwrite, clea # {{ case["description"] }} run_operations{{ loop.index }} = |_| result = - create { capacity: {{ case["input"]["capacity"] }} } + create({ capacity: {{ case["input"]["capacity"] }} }) {%- for op in case["input"]["operations"] -%} {%- if op["operation"] == "clear" %} |> clear {%- elif op["operation"] == "overwrite" %} - |> overwrite {{ op["item"] }} + |> overwrite({{ op["item"] }}) {%- elif op["operation"] == "write" %} {%- if op["should_succeed"] %} - |> write? {{ op["item"] }} + |> write({{ op["item"] }})? {%- else %} - |> \buffer_before_write -> - write_result = buffer_before_write |> write {{ op["item"] }} - expect write_result == Err BufferFull + |> |buffer_before_write| + write_result = buffer_before_write |> write({{ op["item"] }}) + expect write_result == Err(BufferFull) buffer_before_write {%- endif %} {%- elif op["operation"] == "read" %} {%- if op["should_succeed"] %} - |> read? |> \read_result -> + |> read? |> |read_result| expect read_result.value == {{ op["expected"] }} read_result.new_buffer {%- else %} - |> \buffer_before_read -> + |> |buffer_before_read| read_result = buffer_before_read |> read - expect read_result == Err BufferEmpty + expect read_result == Err(BufferEmpty) buffer_before_read {%- endif %} {%- endif %} {%- endfor %} - Ok result + Ok(result) expect - result = run_operations{{ loop.index }} {} + result = run_operations{{ loop.index }}({}) result |> Result.is_ok {% endfor %} diff --git a/exercises/practice/circular-buffer/circular-buffer-test.roc b/exercises/practice/circular-buffer/circular-buffer-test.roc index e22a9172..7dec8d0e 100644 --- a/exercises/practice/circular-buffer/circular-buffer-test.roc +++ b/exercises/practice/circular-buffer/circular-buffer-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/clock/.meta/template.j2 b/exercises/practice/clock/.meta/template.j2 index 8748b4b9..0455601a 100644 --- a/exercises/practice/clock/.meta/template.j2 +++ b/exercises/practice/clock/.meta/template.j2 @@ -9,20 +9,20 @@ import {{ exercise | to_pascal }} exposing [create, add, subtract, to_str] {%- if case["property"] == "create" %} expect - clock = create {{ plugins.to_hours_minutes_record(case["input"]) }} + clock = create({{ plugins.to_hours_minutes_record(case["input"]) }}) result = clock |> to_str expected = {{ case["expected"] | to_roc }} result == expected {%- elif case["property"] in ["add", "subtract"] %} expect - clock = create {{ plugins.to_hours_minutes_record(case["input"]) }} - result = clock |> {{ case["property"] | to_snake }} { minutes: {{ case["input"]["value"] }} } |> to_str + clock = create({{ plugins.to_hours_minutes_record(case["input"]) }}) + result = clock |> {{ case["property"] | to_snake }}({ minutes: {{ case["input"]["value"] }} }) |> to_str expected = {{ case["expected"] | to_roc }} result == expected {%- elif case["property"] == "equal" %} expect - clock1 = create {{ plugins.to_hours_minutes_record(case["input"]["clock1"]) }} - clock2 = create {{ plugins.to_hours_minutes_record(case["input"]["clock2"]) }} + clock1 = create({{ plugins.to_hours_minutes_record(case["input"]["clock1"]) }}) + clock2 = create({{ plugins.to_hours_minutes_record(case["input"]["clock2"]) }}) clock1 {%- if case["expected"] %} == {%- else %} != {% endif %} clock2 {%- else %} diff --git a/exercises/practice/clock/clock-test.roc b/exercises/practice/clock/clock-test.roc index a353f2a7..92d6a396 100644 --- a/exercises/practice/clock/clock-test.roc +++ b/exercises/practice/clock/clock-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/collatz-conjecture/.meta/template.j2 b/exercises/practice/collatz-conjecture/.meta/template.j2 index 580a826e..ce67bec3 100644 --- a/exercises/practice/collatz-conjecture/.meta/template.j2 +++ b/exercises/practice/collatz-conjecture/.meta/template.j2 @@ -7,11 +7,11 @@ import {{ exercise | to_pascal }} exposing [steps] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["number"] }} + result = {{ case["property"] | to_snake }}({{ case["input"]["number"] }}) {%- if case["expected"]["error"] %} - Result.is_err result + Result.is_err(result) {%- else %} - result == Ok {{ case["expected"] }} + result == Ok({{ case["expected"] }}) {%- endif %} {% endfor %} diff --git a/exercises/practice/collatz-conjecture/collatz-conjecture-test.roc b/exercises/practice/collatz-conjecture/collatz-conjecture-test.roc index bd3feeeb..64773c4a 100644 --- a/exercises/practice/collatz-conjecture/collatz-conjecture-test.roc +++ b/exercises/practice/collatz-conjecture/collatz-conjecture-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/complex-numbers/.meta/plugins.py b/exercises/practice/complex-numbers/.meta/plugins.py index 394b2128..5459402e 100644 --- a/exercises/practice/complex-numbers/.meta/plugins.py +++ b/exercises/practice/complex-numbers/.meta/plugins.py @@ -1,7 +1,7 @@ float_map = { "e": "Num.e", - "ln(2)": "Num.log 2f64", - "ln(2)/2": "Num.log 2f64 / 2", + "ln(2)": "Num.log(2f64)", + "ln(2)/2": "Num.log(2f64) / 2", "pi": "Num.pi", "pi/4": "Num.pi / 4", } diff --git a/exercises/practice/complex-numbers/.meta/template.j2 b/exercises/practice/complex-numbers/.meta/template.j2 index fa2a6d85..64464d1e 100644 --- a/exercises/practice/complex-numbers/.meta/template.j2 +++ b/exercises/practice/complex-numbers/.meta/template.j2 @@ -5,7 +5,7 @@ import {{ exercise | to_pascal }} exposing [real, imaginary, add, sub, mul, div, conjugate, abs, exp] is_approx_eq = |z1, z2| - z1.re |> Num.is_approx_eq z2.re {} && z1.im |> Num.is_approx_eq z2.im {} + z1.re |> Num.is_approx_eq(z2.re, {}) && z1.im |> Num.is_approx_eq(z2.im, {}) {% for supercase in cases %} ### @@ -25,20 +25,20 @@ is_approx_eq = |z1, z2| {%- if subcase["input"]["z"] %} expect z = {{ plugins.to_complex_number(subcase["input"]["z"]) }} - result = {{ subcase["property"] }} z + result = {{ subcase["property"] }}(z) {%- if subcase["expected"] is iterable and subcase["expected"] is not string %} expected = {{ plugins.to_complex_number(subcase["expected"]) }} - result |> is_approx_eq expected + result |> is_approx_eq(expected) {%- else %} - result |> Num.is_approx_eq {{ subcase["expected"] | to_roc }} {} + result |> Num.is_approx_eq({{ subcase["expected"] | to_roc }}, {}) {%- endif %} {%- elif subcase["input"]["z1"] %} expect z1 = {{ plugins.to_complex_number(subcase["input"]["z1"]) }} z2 = {{ plugins.to_complex_number(subcase["input"]["z2"]) }} - result = z1 |> {{ subcase["property"] }} z2 + result = z1 |> {{ subcase["property"] }}(z2) expected = {{ plugins.to_complex_number(subcase["expected"]) }} - result |> is_approx_eq expected + result |> is_approx_eq(expected) {%- endif %} {% endfor %} diff --git a/exercises/practice/complex-numbers/complex-numbers-test.roc b/exercises/practice/complex-numbers/complex-numbers-test.roc index 8c605229..147f2a3a 100644 --- a/exercises/practice/complex-numbers/complex-numbers-test.roc +++ b/exercises/practice/complex-numbers/complex-numbers-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/connect/.meta/template.j2 b/exercises/practice/connect/.meta/template.j2 index 097deb01..25aa62ac 100644 --- a/exercises/practice/connect/.meta/template.j2 +++ b/exercises/practice/connect/.meta/template.j2 @@ -9,6 +9,6 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } expect board = {{ case["input"]["board"] | to_roc_multiline_string | indent(8) }} result = board |> {{ case["property"] | to_snake }} - result == {% if case["expected"] == "" %}Err NotFinished{% else %}Ok Player{{ case["expected"] }}{% endif %} + 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 37e22fad..9e49daab 100644 --- a/exercises/practice/connect/connect-test.roc +++ b/exercises/practice/connect/connect-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/crypto-square/.meta/template.j2 b/exercises/practice/crypto-square/.meta/template.j2 index 18b27565..be3e8b42 100644 --- a/exercises/practice/crypto-square/.meta/template.j2 +++ b/exercises/practice/crypto-square/.meta/template.j2 @@ -8,8 +8,8 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } # {{ case["description"] }} expect text = {{ case["input"]["plaintext"] | to_roc }} - result = {{ case["property"] | to_snake }} text - expected = Ok {{ case["expected"] | to_roc }} + result = {{ case["property"] | to_snake }}(text) + expected = Ok({{ case["expected"] | to_roc }}) result == expected {% endfor %} diff --git a/exercises/practice/crypto-square/.meta/tests.toml b/exercises/practice/crypto-square/.meta/tests.toml index 085d142e..94ef0819 100644 --- a/exercises/practice/crypto-square/.meta/tests.toml +++ b/exercises/practice/crypto-square/.meta/tests.toml @@ -32,3 +32,8 @@ description = "8 character plaintext results in 3 chunks, the last one with a tr [fbcb0c6d-4c39-4a31-83f6-c473baa6af80] description = "54 character plaintext results in 7 chunks, the last two with trailing spaces" +include = false + +[33fd914e-fa44-445b-8f38-ff8fbc9fe6e6] +description = "54 character plaintext results in 8 chunks, the last two with trailing spaces" +reimplements = "fbcb0c6d-4c39-4a31-83f6-c473baa6af80" diff --git a/exercises/practice/crypto-square/crypto-square-test.roc b/exercises/practice/crypto-square/crypto-square-test.roc index 56a41d08..0d7dd196 100644 --- a/exercises/practice/crypto-square/crypto-square-test.roc +++ b/exercises/practice/crypto-square/crypto-square-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } @@ -61,7 +61,7 @@ expect expected = Ok("clu hlt io ") result == expected -# 54 character plaintext results in 7 chunks, the last two with trailing spaces +# 54 character plaintext results in 8 chunks, the last two with trailing spaces expect text = "If man was meant to stay on the ground, god would have given us roots." result = ciphertext(text) diff --git a/exercises/practice/custom-set/.meta/template.j2 b/exercises/practice/custom-set/.meta/template.j2 index 6ab44eea..e99d682e 100644 --- a/exercises/practice/custom-set/.meta/template.j2 +++ b/exercises/practice/custom-set/.meta/template.j2 @@ -36,17 +36,17 @@ set property_map = { {% set property = property_map.get(case["property"], case["property"]) %} expect {%- if "set" in case["input"] %} - set = from_list {{ case["input"]["set"] | to_roc }} + set = from_list({{ case["input"]["set"] | to_roc }}) result = set |> {{ property | to_snake }} - {%- if "element" in case["input"] %} {{ case["input"]["element"] }}{%- endif %} + {%- 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_snake }} set2 + set1 = from_list({{ case["input"]["set1"] | to_roc }}) + set2 = from_list({{ case["input"]["set2"] | to_roc }}) + result = set1 |> {{ property | to_snake }}(set2) {%- endif %} {%- if case["expected"] is iterable %} expected = {{ case["expected"] | to_roc }} |> from_list - result |> is_eq expected + result |> is_eq(expected) {%- else %} expected = {{ case["expected"] | to_roc }} result == expected @@ -62,7 +62,7 @@ expect {% for case in additional_cases -%} # {{ case["description"] }} expect - set = from_list {{ case["input"]["set"] | to_roc }} + set = from_list({{ case["input"]["set"] | to_roc }}) result = set |> to_list |> List.sort_asc expected = {{ case["expected"] | to_roc }} result == expected diff --git a/exercises/practice/custom-set/custom-set-test.roc b/exercises/practice/custom-set/custom-set-test.roc index f62e0f18..a494c52c 100644 --- a/exercises/practice/custom-set/custom-set-test.roc +++ b/exercises/practice/custom-set/custom-set-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/darts/.meta/template.j2 b/exercises/practice/darts/.meta/template.j2 index 1f2a9d98..1aa085d5 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_snake }} {{ 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 ff605258..2616dc2e 100644 --- a/exercises/practice/darts/darts-test.roc +++ b/exercises/practice/darts/darts-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/diamond/.meta/template.j2 b/exercises/practice/diamond/.meta/template.j2 index ed46b6ee..348be2e9 100644 --- a/exercises/practice/diamond/.meta/template.j2 +++ b/exercises/practice/diamond/.meta/template.j2 @@ -7,8 +7,8 @@ import {{ exercise | to_pascal }} exposing [{{ exercise | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ exercise | to_snake }} '{{ case["input"]["letter"] }}' - expected = {{ case["expected"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replace_each "·" " " + result = {{ exercise | to_snake }}('{{ case["input"]["letter"] }}') + expected = {{ case["expected"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replace_each("·", " ") result == expected {% endfor %} diff --git a/exercises/practice/diamond/diamond-test.roc b/exercises/practice/diamond/diamond-test.roc index fbbaf97f..e461abe5 100644 --- a/exercises/practice/diamond/diamond-test.roc +++ b/exercises/practice/diamond/diamond-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/difference-of-squares/.meta/template.j2 b/exercises/practice/difference-of-squares/.meta/template.j2 index 59b84b7c..23bf22a3 100644 --- a/exercises/practice/difference-of-squares/.meta/template.j2 +++ b/exercises/practice/difference-of-squares/.meta/template.j2 @@ -12,7 +12,7 @@ import DifferenceOfSquares exposing [square_of_sum, sum_of_squares, difference_o {% for case in supercase["cases"] -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 94d4e6f6..1222aef7 100644 --- a/exercises/practice/difference-of-squares/difference-of-squares-test.roc +++ b/exercises/practice/difference-of-squares/difference-of-squares-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/dominoes/.meta/template.j2 b/exercises/practice/dominoes/.meta/template.j2 index cf99838e..cd28e4a8 100644 --- a/exercises/practice/dominoes/.meta/template.j2 +++ b/exercises/practice/dominoes/.meta/template.j2 @@ -18,29 +18,33 @@ Domino : (U8, U8) canonicalize : List Domino -> List Domino canonicalize = |dominoes| dominoes - |> List.map |domino| + |> List.map(|domino| if domino.0 > domino.1 then (domino.1, domino.0) else domino + ) ## Ensure that the given result is Ok and is a valid chain for the ## given list of dominoes is_valid_chain_for : Result (List Domino) _, List Domino -> Bool -is_valid_chain_for = |maybeChain, dominoes| - when maybeChain is - Err _ -> Bool.false - Ok chain -> - if Set.from_list (canonicalize chain) == Set.from_list (canonicalize dominoes) then +is_valid_chain_for = |maybe_chain, dominoes| + when maybe_chain is + Err(_) -> Bool.false + Ok(chain) -> + if Set.from_list(canonicalize(chain)) == Set.from_list(canonicalize(dominoes)) then when chain is [] -> Bool.true [.., last] -> chain - |> List.walk_until (Ok last) \state, domino -> - when state is - Err InvalidChain -> crash "Unreachable" - Ok previous -> - if previous.1 == domino.0 then - Continue (Ok domino) - else - Break (Err InvalidChain) + |> List.walk_until( + Ok(last), + |state, domino| + when state is + Err(InvalidChain) -> crash "Unreachable" + Ok(previous) -> + if previous.1 == domino.0 then + Continue(Ok(domino)) + else + Break(Err(InvalidChain)) + ) |> Result.is_ok else Bool.false @@ -48,9 +52,9 @@ is_valid_chain_for = |maybeChain, dominoes| {% for case in cases -%} # {{ case["description"] }} expect - result = find_chain {{ to_list_of_pairs(case["input"]["dominoes"]) }} + result = find_chain({{ to_list_of_pairs(case["input"]["dominoes"]) }}) {%- if case["expected"] %} - result |> is_valid_chain_for {{ to_list_of_pairs(case["input"]["dominoes"]) }} + result |> is_valid_chain_for({{ to_list_of_pairs(case["input"]["dominoes"]) }}) {%- else %} result |> Result.is_err {%- endif %} diff --git a/exercises/practice/dominoes/dominoes-test.roc b/exercises/practice/dominoes/dominoes-test.roc index 8db193a5..63e9270f 100644 --- a/exercises/practice/dominoes/dominoes-test.roc +++ b/exercises/practice/dominoes/dominoes-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } @@ -39,7 +39,7 @@ is_valid_chain_for = |maybe_chain, dominoes| Ok(last), |state, domino| when state is - Err(InvalidChain) -> crash("Unreachable") + Err(InvalidChain) -> crash "Unreachable" Ok(previous) -> if previous.1 == domino.0 then Continue(Ok(domino)) diff --git a/exercises/practice/eliuds-eggs/.meta/template.j2 b/exercises/practice/eliuds-eggs/.meta/template.j2 index 196d5020..bfe5d436 100644 --- a/exercises/practice/eliuds-eggs/.meta/template.j2 +++ b/exercises/practice/eliuds-eggs/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 a72a0a4b..2bdad812 100644 --- a/exercises/practice/eliuds-eggs/eliuds-eggs-test.roc +++ b/exercises/practice/eliuds-eggs/eliuds-eggs-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/etl/.meta/template.j2 b/exercises/practice/etl/.meta/template.j2 index 0b2244d9..eb107999 100644 --- a/exercises/practice/etl/.meta/template.j2 +++ b/exercises/practice/etl/.meta/template.j2 @@ -8,17 +8,17 @@ import {{ exercise | to_pascal }} exposing [transform] # {{ case["description"] }} expect legacy = - Dict.from_list [ + Dict.from_list([ {%- for score, letters in case["input"]["legacy"].items() %} ({{score}}, {{ letters | to_roc | replace("\"", "'") }}), {%- endfor %} - ] + ]) expected = - Dict.from_list [ + Dict.from_list([ {%- for letter, score in case["expected"].items() %} ('{{letter}}', {{ score }}), {%- endfor %} - ] - transform legacy == expected + ]) + transform(legacy) == expected {% endfor %} diff --git a/exercises/practice/etl/etl-test.roc b/exercises/practice/etl/etl-test.roc index 4729b210..8f7e0061 100644 --- a/exercises/practice/etl/etl-test.roc +++ b/exercises/practice/etl/etl-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/flatten-array/.meta/plugins.py b/exercises/practice/flatten-array/.meta/plugins.py index b8d04960..83ba7509 100644 --- a/exercises/practice/flatten-array/.meta/plugins.py +++ b/exercises/practice/flatten-array/.meta/plugins.py @@ -2,7 +2,7 @@ def to_nested(value, top_level=True): if value is None: return "Null" elif isinstance(value, int): - return f"Value {value}" + return f"Value({value})" else: content = ", ".join([to_nested(elem, False) for elem in value]) - return f"NestedArray [\n{content}]" + return f"NestedArray([\n{content}])" diff --git a/exercises/practice/flatten-array/.meta/template.j2 b/exercises/practice/flatten-array/.meta/template.j2 index a36cde7d..8314785c 100644 --- a/exercises/practice/flatten-array/.meta/template.j2 +++ b/exercises/practice/flatten-array/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} ({{ 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/.meta/tests.toml b/exercises/practice/flatten-array/.meta/tests.toml index 6300219d..44acf175 100644 --- a/exercises/practice/flatten-array/.meta/tests.toml +++ b/exercises/practice/flatten-array/.meta/tests.toml @@ -32,12 +32,32 @@ description = "null values are omitted from the final result" [c6cf26de-8ccd-4410-84bd-b9efd88fd2bc] description = "consecutive null values at the front of the list are omitted from the final result" +include = false + +[bc72da10-5f55-4ada-baf3-50e4da02ec8e] +description = "consecutive null values at the front of the array are omitted from the final result" +reimplements = "c6cf26de-8ccd-4410-84bd-b9efd88fd2bc" [382c5242-587e-4577-b8ce-a5fb51e385a1] description = "consecutive null values in the middle of the list are omitted from the final result" +include = false + +[6991836d-0d9b-4703-80a0-3f1f23eb5981] +description = "consecutive null values in the middle of the array are omitted from the final result" +reimplements = "382c5242-587e-4577-b8ce-a5fb51e385a1" [ef1d4790-1b1e-4939-a179-51ace0829dbd] description = "6 level nest list with null values" +include = false + +[dc90a09c-5376-449c-a7b3-c2d20d540069] +description = "6 level nested array with null values" +reimplements = "ef1d4790-1b1e-4939-a179-51ace0829dbd" [85721643-705a-4150-93ab-7ae398e2942d] description = "all values in nested list are null" +include = false + +[51f5d9af-8f7f-4fb5-a156-69e8282cb275] +description = "all values in nested array are null" +reimplements = "85721643-705a-4150-93ab-7ae398e2942d" diff --git a/exercises/practice/flatten-array/flatten-array-test.roc b/exercises/practice/flatten-array/flatten-array-test.roc index 44abd701..1ec17e05 100644 --- a/exercises/practice/flatten-array/flatten-array-test.roc +++ b/exercises/practice/flatten-array/flatten-array-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } @@ -169,7 +169,7 @@ expect ) result == [1, 2] -# consecutive null values at the front of the list are omitted from the final result +# consecutive null values at the front of the array are omitted from the final result expect result = flatten( NestedArray( @@ -182,7 +182,7 @@ expect ) result == [3] -# consecutive null values in the middle of the list are omitted from the final result +# consecutive null values in the middle of the array are omitted from the final result expect result = flatten( NestedArray( @@ -196,7 +196,7 @@ expect ) result == [1, 4] -# 6 level nest list with null values +# 6 level nested array with null values expect result = flatten( NestedArray( @@ -239,7 +239,7 @@ expect ) result == [0, 2, 2, 3, 8, 100, -2] -# all values in nested list are null +# all values in nested array are null expect result = flatten( NestedArray( diff --git a/exercises/practice/flower-field/.meta/template.j2 b/exercises/practice/flower-field/.meta/template.j2 index 34cd4b31..14eafc1f 100644 --- a/exercises/practice/flower-field/.meta/template.j2 +++ b/exercises/practice/flower-field/.meta/template.j2 @@ -7,9 +7,9 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - garden = {{ case["input"]["garden"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replace_each "·" " " - result = {{ case["property"] | to_snake }} garden - expected = {{ case["expected"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replace_each "·" " " + garden = {{ case["input"]["garden"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replace_each("·", " ") + result = {{ case["property"] | to_snake }}(garden) + expected = {{ case["expected"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replace_each("·", " ") result == expected {% endfor %} diff --git a/exercises/practice/flower-field/flower-field-test.roc b/exercises/practice/flower-field/flower-field-test.roc index cbdf9a1f..99620535 100644 --- a/exercises/practice/flower-field/flower-field-test.roc +++ b/exercises/practice/flower-field/flower-field-test.roc @@ -1,6 +1,6 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/flower-field/canonical-data.json -# File last updated on 2025-07-02 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } @@ -8,22 +8,22 @@ app [main!] { import pf.Stdout main! = |_args| - Stdout.line! "" + Stdout.line!("") import FlowerField exposing [annotate] # no rows expect - garden = "" |> Str.replace_each "·" " " - result = annotate garden - expected = "" |> Str.replace_each "·" " " + garden = "" |> Str.replace_each("·", " ") + result = annotate(garden) + expected = "" |> Str.replace_each("·", " ") result == expected # no columns expect - garden = "" |> Str.replace_each "·" " " - result = annotate garden - expected = "" |> Str.replace_each "·" " " + garden = "" |> Str.replace_each("·", " ") + result = annotate(garden) + expected = "" |> Str.replace_each("·", " ") result == expected # no flowers @@ -34,15 +34,15 @@ expect ··· ··· """ - |> Str.replace_each "·" " " - result = annotate garden + |> Str.replace_each("·", " ") + result = annotate(garden) expected = """ ··· ··· ··· """ - |> Str.replace_each "·" " " + |> Str.replace_each("·", " ") result == expected # garden full of flowers @@ -53,15 +53,15 @@ expect *** *** """ - |> Str.replace_each "·" " " - result = annotate garden + |> Str.replace_each("·", " ") + result = annotate(garden) expected = """ *** *** *** """ - |> Str.replace_each "·" " " + |> Str.replace_each("·", " ") result == expected # flower surrounded by spaces @@ -72,15 +72,15 @@ expect ·*· ··· """ - |> Str.replace_each "·" " " - result = annotate garden + |> Str.replace_each("·", " ") + result = annotate(garden) expected = """ 111 1*1 111 """ - |> Str.replace_each "·" " " + |> Str.replace_each("·", " ") result == expected # space surrounded by flowers @@ -91,29 +91,29 @@ expect *·* *** """ - |> Str.replace_each "·" " " - result = annotate garden + |> Str.replace_each("·", " ") + result = annotate(garden) expected = """ *** *8* *** """ - |> Str.replace_each "·" " " + |> Str.replace_each("·", " ") result == expected # horizontal line expect - garden = "·*·*·" |> Str.replace_each "·" " " - result = annotate garden - expected = "1*2*1" |> Str.replace_each "·" " " + garden = "·*·*·" |> Str.replace_each("·", " ") + result = annotate(garden) + expected = "1*2*1" |> Str.replace_each("·", " ") result == expected # horizontal line, flowers at edges expect - garden = "*···*" |> Str.replace_each "·" " " - result = annotate garden - expected = "*1·1*" |> Str.replace_each "·" " " + garden = "*···*" |> Str.replace_each("·", " ") + result = annotate(garden) + expected = "*1·1*" |> Str.replace_each("·", " ") result == expected # vertical line @@ -126,8 +126,8 @@ expect * · """ - |> Str.replace_each "·" " " - result = annotate garden + |> Str.replace_each("·", " ") + result = annotate(garden) expected = """ 1 @@ -136,7 +136,7 @@ expect * 1 """ - |> Str.replace_each "·" " " + |> Str.replace_each("·", " ") result == expected # vertical line, flowers at edges @@ -149,8 +149,8 @@ expect · * """ - |> Str.replace_each "·" " " - result = annotate garden + |> Str.replace_each("·", " ") + result = annotate(garden) expected = """ * @@ -159,7 +159,7 @@ expect 1 * """ - |> Str.replace_each "·" " " + |> Str.replace_each("·", " ") result == expected # cross @@ -172,8 +172,8 @@ expect ··*·· ··*·· """ - |> Str.replace_each "·" " " - result = annotate garden + |> Str.replace_each("·", " ") + result = annotate(garden) expected = """ ·2*2· @@ -182,7 +182,7 @@ expect 25*52 ·2*2· """ - |> Str.replace_each "·" " " + |> Str.replace_each("·", " ") result == expected # large garden @@ -196,8 +196,8 @@ expect ·*··*· ······ """ - |> Str.replace_each "·" " " - result = annotate garden + |> Str.replace_each("·", " ") + result = annotate(garden) expected = """ 1*22*1 @@ -207,6 +207,6 @@ expect 1*22*2 111111 """ - |> Str.replace_each "·" " " + |> Str.replace_each("·", " ") result == expected diff --git a/exercises/practice/food-chain/.meta/template.j2 b/exercises/practice/food-chain/.meta/template.j2 index 4826b8b1..18bdbc29 100644 --- a/exercises/practice/food-chain/.meta/template.j2 +++ b/exercises/practice/food-chain/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["startVerse"] | to_roc }} {{ case["input"]["endVerse"] | 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 %} \ 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 0bcdbc91..90fe0d3e 100644 --- a/exercises/practice/food-chain/food-chain-test.roc +++ b/exercises/practice/food-chain/food-chain-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/forth/.meta/template.j2 b/exercises/practice/forth/.meta/template.j2 index 5cfd30e1..2a51879e 100644 --- a/exercises/practice/forth/.meta/template.j2 +++ b/exercises/practice/forth/.meta/template.j2 @@ -8,11 +8,11 @@ import Forth exposing [evaluate] {% for innerCase in case["cases"] %} # {{ case["description"] }}: {{ innerCase["description"] }} expect - result = evaluate {{ innerCase["input"]["instructions"] | join('\n') | to_roc_multiline_string | indent(8) }} + result = evaluate({{ innerCase["input"]["instructions"] | join('\n') | to_roc_multiline_string | indent(8) }}) {%- if innerCase["expected"]["error"] %} - Result.is_err result + Result.is_err(result) {%- else %} - result == Ok {{ innerCase["expected"] }} + result == Ok({{ innerCase["expected"] }}) {%- endif %} {% endfor %} {% endfor %} diff --git a/exercises/practice/forth/.meta/tests.toml b/exercises/practice/forth/.meta/tests.toml index cd443c7a..af25f3de 100644 --- a/exercises/practice/forth/.meta/tests.toml +++ b/exercises/practice/forth/.meta/tests.toml @@ -24,6 +24,9 @@ description = "addition -> errors if there is nothing on the stack" [06efb9a4-817a-435e-b509-06166993c1b8] description = "addition -> errors if there is only one value on the stack" +[1e07a098-c5fa-4c66-97b2-3c81205dbc2f] +description = "addition -> more than two values on the stack" + [09687c99-7bbc-44af-8526-e402f997ccbf] description = "subtraction -> can subtract two numbers" @@ -33,6 +36,9 @@ description = "subtraction -> errors if there is nothing on the stack" [b3cee1b2-9159-418a-b00d-a1bb3765c23b] description = "subtraction -> errors if there is only one value on the stack" +[2c8cc5ed-da97-4cb1-8b98-fa7b526644f4] +description = "subtraction -> more than two values on the stack" + [5df0ceb5-922e-401f-974d-8287427dbf21] description = "multiplication -> can multiply two numbers" @@ -42,6 +48,9 @@ description = "multiplication -> errors if there is nothing on the stack" [8ba4b432-9f94-41e0-8fae-3b3712bd51b3] description = "multiplication -> errors if there is only one value on the stack" +[5cd085b5-deb1-43cc-9c17-6b1c38bc9970] +description = "multiplication -> more than two values on the stack" + [e74c2204-b057-4cff-9aa9-31c7c97a93f5] description = "division -> can divide two numbers" @@ -57,12 +66,21 @@ description = "division -> errors if there is nothing on the stack" [d5547f43-c2ff-4d5c-9cb0-2a4f6684c20d] description = "division -> errors if there is only one value on the stack" +[f224f3e0-b6b6-4864-81de-9769ecefa03f] +description = "division -> more than two values on the stack" + [ee28d729-6692-4a30-b9be-0d830c52a68c] description = "combined arithmetic -> addition and subtraction" [40b197da-fa4b-4aca-a50b-f000d19422c1] description = "combined arithmetic -> multiplication and division" +[f749b540-53aa-458e-87ec-a70797eddbcb] +description = "combined arithmetic -> multiplication and addition" + +[c8e5a4c2-f9bf-4805-9a35-3c3314e4989a] +description = "combined arithmetic -> addition and multiplication" + [c5758235-6eef-4bf6-ab62-c878e50b9957] description = "dup -> copies a value on the stack" @@ -137,7 +155,6 @@ include = false [5180f261-89dd-491e-b230-62737e09806f] description = "user-defined words -> errors if executing a non-existent word" -# This case is not relevant for Roc because it is not stateful [3c8bfef3-edbb-49c1-9993-21d4030043cb] description = "user-defined words -> only defines locally" include = false diff --git a/exercises/practice/forth/forth-test.roc b/exercises/practice/forth/forth-test.roc index 06955aed..615818eb 100644 --- a/exercises/practice/forth/forth-test.roc +++ b/exercises/practice/forth/forth-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } @@ -37,6 +37,11 @@ expect result = evaluate("1 +") Result.is_err(result) +# addition: more than two values on the stack +expect + result = evaluate("1 2 3 +") + result == Ok([1, 5]) + # subtraction: can subtract two numbers expect result = evaluate("3 4 -") @@ -52,6 +57,11 @@ expect result = evaluate("1 -") Result.is_err(result) +# subtraction: more than two values on the stack +expect + result = evaluate("1 12 3 -") + result == Ok([1, 9]) + # multiplication: can multiply two numbers expect result = evaluate("2 4 *") @@ -67,6 +77,11 @@ expect result = evaluate("1 *") Result.is_err(result) +# multiplication: more than two values on the stack +expect + result = evaluate("1 2 3 *") + result == Ok([1, 6]) + # division: can divide two numbers expect result = evaluate("12 3 /") @@ -92,6 +107,11 @@ expect result = evaluate("1 /") Result.is_err(result) +# division: more than two values on the stack +expect + result = evaluate("1 12 3 /") + result == Ok([1, 4]) + # combined arithmetic: addition and subtraction expect result = evaluate("1 2 + 4 -") @@ -102,6 +122,16 @@ expect result = evaluate("2 4 * 3 /") result == Ok([2]) +# combined arithmetic: multiplication and addition +expect + result = evaluate("1 3 4 * +") + result == Ok([13]) + +# combined arithmetic: addition and multiplication +expect + result = evaluate("1 3 4 + *") + result == Ok([7]) + # dup: copies a value on the stack expect result = evaluate("1 dup") diff --git a/exercises/practice/gigasecond/.meta/template.j2 b/exercises/practice/gigasecond/.meta/template.j2 index be2140c7..017461a6 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_snake }} {{ 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 08d4bde0..68b5b3b2 100644 --- a/exercises/practice/gigasecond/gigasecond-test.roc +++ b/exercises/practice/gigasecond/gigasecond-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", isodate: "https://github.com/imclerran/roc-isodate/releases/download/v0.6.0/79DATSmwkFXMsS0dF7w1RTHeQCGwFNzh9zylic4Fw9w.tar.br", diff --git a/exercises/practice/go-counting/.meta/template.j2 b/exercises/practice/go-counting/.meta/template.j2 index 885807ff..c9ded94a 100644 --- a/exercises/practice/go-counting/.meta/template.j2 +++ b/exercises/practice/go-counting/.meta/template.j2 @@ -4,13 +4,13 @@ {% macro to_territory(territory) %} {%- if territory == [] %} -Set.empty {} +Set.empty({}) {%- else %} -Set.from_list [ +Set.from_list([ {%- for intersection in territory %} { x : {{ intersection[0] }}, y : {{ intersection[1] }} }, {%- endfor %} -] +]) {%- endif %} {% endmacro %} @@ -20,37 +20,37 @@ import {{ exercise | to_pascal }} 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 = |maybe_result, maybe_expected| +compare_territory = |maybe_result, maybe_expected| when (maybe_result, maybe_expected) is - (Ok result, Ok expected) -> result.owner == expected.owner && result.territory == expected.territory + (Ok(result), Ok(expected)) -> result.owner == expected.owner && result.territory == expected.territory _ -> Bool.false -compareTerritories = |maybe_result, maybe_expected| +compare_territories = |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 + (Ok(result), Ok(expected)) -> result.black == expected.black && result.white == expected.white && result.none == expected.none _ -> Bool.false {% for case in cases -%} # {{ case["description"] }} expect - board = {{ case["input"]["board"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replace_each "·" " " + board = {{ case["input"]["board"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replace_each("·", " ") result = board |> {{ case["property"] | to_snake }} - {%- if case["property"] == "territory" %} { x : {{ case["input"]["x"] }}, y : {{ case["input"]["y"] }} }{% endif %} + {%- if case["property"] == "territory" %}({ x : {{ case["input"]["x"] }}, y : {{ case["input"]["y"] }} }){% endif %} {%- if case["expected"]["error"] %} result |> Result.is_err {%- elif case["expected"]["owner"] %} - expected = Ok { + expected = Ok({ owner: {{ case["expected"]["owner"] | to_pascal }}, territory: {{ to_territory(case["expected"]["territory"]) }}, - } - result |> compareTerritory expected + }) + result |> compare_territory(expected) {%- else %} - expected = Ok { + expected = Ok({ black: {{ to_territory(case["expected"]["territoryBlack"]) }}, white: {{ to_territory(case["expected"]["territoryWhite"]) }}, none: {{ to_territory(case["expected"]["territoryNone"]) }}, - } - result |> compareTerritories expected + }) + result |> compare_territories(expected) {%- endif %} diff --git a/exercises/practice/go-counting/go-counting-test.roc b/exercises/practice/go-counting/go-counting-test.roc index b4244e78..5e76fc18 100644 --- a/exercises/practice/go-counting/go-counting-test.roc +++ b/exercises/practice/go-counting/go-counting-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/grains/.meta/template.j2 b/exercises/practice/grains/.meta/template.j2 index 72494f1d..70005fdf 100644 --- a/exercises/practice/grains/.meta/template.j2 +++ b/exercises/practice/grains/.meta/template.j2 @@ -16,11 +16,11 @@ expect {% for subcase in case["cases"] -%} # {{ subcase["description"] }} expect - result = grains_on_square {{ subcase["input"]["square"] }} + result = grains_on_square({{ subcase["input"]["square"] }}) {%- if subcase["expected"]["error"] %} - Result.is_err result + Result.is_err(result) {%- else %} - result == Ok {{ subcase["expected"] }} + result == Ok({{ subcase["expected"] }}) {%- endif %} {% endfor %} diff --git a/exercises/practice/grains/grains-test.roc b/exercises/practice/grains/grains-test.roc index f15a48a2..938d9bc1 100644 --- a/exercises/practice/grains/grains-test.roc +++ b/exercises/practice/grains/grains-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/grep/.meta/template.j2 b/exercises/practice/grep/.meta/template.j2 index 34afad90..77270f17 100644 --- a/exercises/practice/grep/.meta/template.j2 +++ b/exercises/practice/grep/.meta/template.j2 @@ -8,8 +8,8 @@ import {{ exercise | to_pascal }} exposing [grep] {% for innerCase in case["cases"] -%} # {{ case["description"] }} - {{ innerCase["description"] }} expect - 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) }} + 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 %} {% endfor %} diff --git a/exercises/practice/grep/grep-test.roc b/exercises/practice/grep/grep-test.roc index 2f3af7ba..bd999ae3 100644 --- a/exercises/practice/grep/grep-test.roc +++ b/exercises/practice/grep/grep-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/hamming/.meta/template.j2 b/exercises/practice/hamming/.meta/template.j2 index 5e5b85a9..3b6eb393 100644 --- a/exercises/practice/hamming/.meta/template.j2 +++ b/exercises/practice/hamming/.meta/template.j2 @@ -7,11 +7,11 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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.is_err result + Result.is_err(result) {%- else %} - result == Ok {{ case["expected"] }} + result == Ok({{ case["expected"] }}) {%- endif %} {% endfor %} diff --git a/exercises/practice/hamming/hamming-test.roc b/exercises/practice/hamming/hamming-test.roc index a62ea9fa..1f4cc25d 100644 --- a/exercises/practice/hamming/hamming-test.roc +++ b/exercises/practice/hamming/hamming-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/hello-world/hello-world-test.roc b/exercises/practice/hello-world/hello-world-test.roc index 177cefae..fe44c9db 100644 --- a/exercises/practice/hello-world/hello-world-test.roc +++ b/exercises/practice/hello-world/hello-world-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/high-scores/.meta/template.j2 b/exercises/practice/high-scores/.meta/template.j2 index 0b17d129..0c7b1cc5 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"] | to_snake }} {{ case["input"]["scores"] }} - result == {% if case["property"] != "personalTopThree" %}Ok {% endif %}{{ case["expected"] | to_roc }} + result = {{ case["property"] | to_snake }}({{ case["input"]["scores"] }}) + result == {% if case["property"] != "personalTopThree" %}Ok({{ case["expected"] | to_roc }}){%- else -%}{{ case["expected"] | to_roc }}{% endif %} {% endfor -%} {%- endfor %} diff --git a/exercises/practice/high-scores/high-scores-test.roc b/exercises/practice/high-scores/high-scores-test.roc index ae71026c..69eeb89e 100644 --- a/exercises/practice/high-scores/high-scores-test.roc +++ b/exercises/practice/high-scores/high-scores-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/house/.meta/template.j2 b/exercises/practice/house/.meta/template.j2 index a2c0bb06..1ad789e0 100644 --- a/exercises/practice/house/.meta/template.j2 +++ b/exercises/practice/house/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["startVerse"] }} {{ case["input"]["endVerse"] }} + 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 84381fee..a4a501eb 100644 --- a/exercises/practice/house/house-test.roc +++ b/exercises/practice/house/house-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/isbn-verifier/.meta/template.j2 b/exercises/practice/isbn-verifier/.meta/template.j2 index e3258a20..6cd86f30 100644 --- a/exercises/practice/isbn-verifier/.meta/template.j2 +++ b/exercises/practice/isbn-verifier/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [is_valid] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 862cb5a5..feb8f6a7 100644 --- a/exercises/practice/isbn-verifier/isbn-verifier-test.roc +++ b/exercises/practice/isbn-verifier/isbn-verifier-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/isogram/.meta/template.j2 b/exercises/practice/isogram/.meta/template.j2 index 35c5b095..86dc2d01 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_snake }} {{ 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 0e97b224..cd897f25 100644 --- a/exercises/practice/isogram/isogram-test.roc +++ b/exercises/practice/isogram/isogram-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/killer-sudoku-helper/.meta/template.j2 b/exercises/practice/killer-sudoku-helper/.meta/template.j2 index bf7ac864..8d4e33e3 100644 --- a/exercises/practice/killer-sudoku-helper/.meta/template.j2 +++ b/exercises/practice/killer-sudoku-helper/.meta/template.j2 @@ -23,7 +23,7 @@ import {{ exercise | to_pascal }} exposing [combinations] # {{ case["description"] }} {%- endif %} expect - result = {{ case["property"] }} {{ to_cage(case["input"]["cage"]) }} + result = {{ case["property"] }}({{ to_cage(case["input"]["cage"]) }}) result == {{ case["expected"] | to_roc }} {% endfor -%} 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 995e5618..57249442 100644 --- a/exercises/practice/killer-sudoku-helper/killer-sudoku-helper-test.roc +++ b/exercises/practice/killer-sudoku-helper/killer-sudoku-helper-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/kindergarten-garden/.meta/template.j2 b/exercises/practice/kindergarten-garden/.meta/template.j2 index 00bde51a..2a2355d8 100644 --- a/exercises/practice/kindergarten-garden/.meta/template.j2 +++ b/exercises/practice/kindergarten-garden/.meta/template.j2 @@ -21,8 +21,8 @@ import {{ exercise | to_pascal }} exposing [plants] # {{ subcase["description"] }} expect diagram = {{ subcase["input"]["diagram"] | to_roc_multiline_string | indent(8) }} - result = diagram |> {{ subcase["property"] | to_snake }} {{ subcase["input"]["student"] | to_pascal }} - result == Ok [{% for plant in subcase["expected"] %}{{ plant | to_pascal }}, {% endfor %}] + 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 47611dce..6d37f12a 100644 --- a/exercises/practice/kindergarten-garden/kindergarten-garden-test.roc +++ b/exercises/practice/kindergarten-garden/kindergarten-garden-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/knapsack/.meta/template.j2 b/exercises/practice/knapsack/.meta/template.j2 index 18c73583..a7a2d839 100644 --- a/exercises/practice/knapsack/.meta/template.j2 +++ b/exercises/practice/knapsack/.meta/template.j2 @@ -16,7 +16,7 @@ expect {%- endfor %} ] {%- endif %} - result = {{ case["property"] | to_snake }} { items, maximum_weight: {{ case["input"]["maximumWeight"] }} } + result = {{ case["property"] | to_snake }}({ items, maximum_weight: {{ case["input"]["maximumWeight"] }} }) result == {{ case["expected"] | to_roc }} {% endfor %} \ No newline at end of file diff --git a/exercises/practice/knapsack/knapsack-test.roc b/exercises/practice/knapsack/knapsack-test.roc index 6d363d4a..f4d0f401 100644 --- a/exercises/practice/knapsack/knapsack-test.roc +++ b/exercises/practice/knapsack/knapsack-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/largest-series-product/.meta/template.j2 b/exercises/practice/largest-series-product/.meta/template.j2 index 0c27be4a..c0cf1475 100644 --- a/exercises/practice/largest-series-product/.meta/template.j2 +++ b/exercises/practice/largest-series-product/.meta/template.j2 @@ -8,11 +8,11 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } # {{ case["description"] }} expect digits = {{ case["input"]["digits"] | to_roc }} - result = digits |> {{ case["property"] | to_snake }} {{ case["input"]["span"] | to_roc }} + result = digits |> {{ case["property"] | to_snake }}({{ case["input"]["span"] | to_roc }}) {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} - expected = Ok {{ case["expected"] | to_roc }} + expected = Ok({{ case["expected"] | to_roc }}) result == expected {%- endif %} diff --git a/exercises/practice/largest-series-product/.meta/tests.toml b/exercises/practice/largest-series-product/.meta/tests.toml index e7cfd095..e43d447f 100644 --- a/exercises/practice/largest-series-product/.meta/tests.toml +++ b/exercises/practice/largest-series-product/.meta/tests.toml @@ -38,6 +38,11 @@ description = "reports zero if all spans include zero" [5d81aaf7-4f67-4125-bf33-11493cc7eab7] description = "rejects span longer than string length" +include = false + +[0ae1ce53-d9ba-41bb-827f-2fceb64f058b] +description = "rejects span longer than string length" +reimplements = "5d81aaf7-4f67-4125-bf33-11493cc7eab7" [06bc8b90-0c51-4c54-ac22-3ec3893a079e] description = "reports 1 for empty string and empty product (0 span)" @@ -47,6 +52,11 @@ description = "reports 1 for nonempty string and empty product (0 span)" [6d96c691-4374-4404-80ee-2ea8f3613dd4] description = "rejects empty string and nonzero span" +include = false + +[6cf66098-a6af-4223-aab1-26aeeefc7402] +description = "rejects empty string and nonzero span" +reimplements = "6d96c691-4374-4404-80ee-2ea8f3613dd4" [7a38f2d6-3c35-45f6-8d6f-12e6e32d4d74] description = "rejects invalid character in digits" @@ -57,5 +67,5 @@ include = false [c859f34a-9bfe-4897-9c2f-6d7f8598e7f0] description = "rejects negative span" -reimplements = "5fe3c0e5-a945-49f2-b584-f0814b4dd1ef" include = false +reimplements = "5fe3c0e5-a945-49f2-b584-f0814b4dd1ef" 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 904451b6..85c69a15 100644 --- a/exercises/practice/largest-series-product/largest-series-product-test.roc +++ b/exercises/practice/largest-series-product/largest-series-product-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/leap/.meta/template.j2 b/exercises/practice/leap/.meta/template.j2 index e03fa3f8..c974c801 100644 --- a/exercises/practice/leap/.meta/template.j2 +++ b/exercises/practice/leap/.meta/template.j2 @@ -8,7 +8,7 @@ import Leap exposing [is_leap_year] {% for case in cases -%} # {{ case["description"] }} expect - result = (is_leap_year {{ case["input"]["year"] }}) + result = is_leap_year({{ case["input"]["year"] }}) result == {{ case ["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/leap/leap-test.roc b/exercises/practice/leap/leap-test.roc index 02ca8f19..111d743b 100644 --- a/exercises/practice/leap/leap-test.roc +++ b/exercises/practice/leap/leap-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/list-ops/.meta/template.j2 b/exercises/practice/list-ops/.meta/template.j2 index cc1bf906..aaa0c48f 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_snake }} {{ 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_snake }} {{ 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_snake }} {{ 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_snake }} {{ 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_snake }} {{ 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_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["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_snake }} {{ 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 648e9447..6ebd8ce3 100644 --- a/exercises/practice/list-ops/list-ops-test.roc +++ b/exercises/practice/list-ops/list-ops-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/luhn/.meta/template.j2 b/exercises/practice/luhn/.meta/template.j2 index 9003a9cd..2f2e4ef6 100644 --- a/exercises/practice/luhn/.meta/template.j2 +++ b/exercises/practice/luhn/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 acf0790a..0ae078a3 100644 --- a/exercises/practice/luhn/luhn-test.roc +++ b/exercises/practice/luhn/luhn-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/matching-brackets/matching-brackets-test.roc b/exercises/practice/matching-brackets/matching-brackets-test.roc index c40a1ad2..61821e0e 100644 --- a/exercises/practice/matching-brackets/matching-brackets-test.roc +++ b/exercises/practice/matching-brackets/matching-brackets-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/matrix/.meta/template.j2 b/exercises/practice/matrix/.meta/template.j2 index da16ff9f..465f298d 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_snake }} {{ case["input"]["index"] | to_roc }} - result == Ok {{ case["expected"] | 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 6d104da3..1a7d1344 100644 --- a/exercises/practice/matrix/matrix-test.roc +++ b/exercises/practice/matrix/matrix-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/meetup/.meta/template.j2 b/exercises/practice/meetup/.meta/template.j2 index 44e298e8..0519cd73 100644 --- a/exercises/practice/meetup/.meta/template.j2 +++ b/exercises/practice/meetup/.meta/template.j2 @@ -7,13 +7,13 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} { + result = {{ case["property"] | to_snake }}({ year: {{ case["input"]["year"] | to_roc }}, month: {{ case["input"]["month"] | to_roc }}, week: {{ case["input"]["week"] | to_pascal }}, day_of_week: {{ case["input"]["dayofweek"] | to_pascal }}, - } - expected = Ok {{ case["expected"] | to_roc }} + }) + expected = Ok({{ case["expected"] | to_roc }}) result == expected {% endfor %} diff --git a/exercises/practice/meetup/meetup-test.roc b/exercises/practice/meetup/meetup-test.roc index a081093b..79a956fd 100644 --- a/exercises/practice/meetup/meetup-test.roc +++ b/exercises/practice/meetup/meetup-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", isodate: "https://github.com/imclerran/roc-isodate/releases/download/v0.6.0/79DATSmwkFXMsS0dF7w1RTHeQCGwFNzh9zylic4Fw9w.tar.br", diff --git a/exercises/practice/micro-blog/.meta/template.j2 b/exercises/practice/micro-blog/.meta/template.j2 index f6874d2a..32cb0476 100644 --- a/exercises/practice/micro-blog/.meta/template.j2 +++ b/exercises/practice/micro-blog/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["phrase"] | to_roc }} - result == Ok {{ case["expected"] | 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 089cc9fb..5123de31 100644 --- a/exercises/practice/micro-blog/micro-blog-test.roc +++ b/exercises/practice/micro-blog/micro-blog-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", unicode: "https://github.com/roc-lang/unicode/releases/download/0.3.0/9KKFsA4CdOz0JIOL7iBSI_2jGIXQ6TsFBXgd086idpY.tar.br", diff --git a/exercises/practice/minesweeper/.meta/template.j2 b/exercises/practice/minesweeper/.meta/template.j2 index 6398b101..7e04ffab 100644 --- a/exercises/practice/minesweeper/.meta/template.j2 +++ b/exercises/practice/minesweeper/.meta/template.j2 @@ -7,9 +7,9 @@ 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.replace_each "·" " " - result = {{ case["property"] | to_snake }} minefield - expected = {{ case["expected"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replace_each "·" " " + minefield = {{ case["input"]["minefield"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replace_each("·", " ") + result = {{ case["property"] | to_snake }}(minefield) + expected = {{ case["expected"] | to_roc_multiline_string | replace(" ", "·") | indent(8) }} |> Str.replace_each("·", " ") result == expected {% endfor %} diff --git a/exercises/practice/minesweeper/minesweeper-test.roc b/exercises/practice/minesweeper/minesweeper-test.roc index aafb6cd1..87276176 100644 --- a/exercises/practice/minesweeper/minesweeper-test.roc +++ b/exercises/practice/minesweeper/minesweeper-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/nth-prime/.meta/template.j2 b/exercises/practice/nth-prime/.meta/template.j2 index dc61da84..e815e36b 100644 --- a/exercises/practice/nth-prime/.meta/template.j2 +++ b/exercises/practice/nth-prime/.meta/template.j2 @@ -7,11 +7,11 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["number"] }} + result = {{ case["property"] | to_snake }}({{ case["input"]["number"] }}) {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} - result == Ok {{ case["expected"] }} + result == Ok({{ case["expected"] }}) {%- endif %} {% endfor %} diff --git a/exercises/practice/nth-prime/nth-prime-test.roc b/exercises/practice/nth-prime/nth-prime-test.roc index 577c988e..53268158 100644 --- a/exercises/practice/nth-prime/nth-prime-test.roc +++ b/exercises/practice/nth-prime/nth-prime-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/nucleotide-count/.meta/template.j2 b/exercises/practice/nucleotide-count/.meta/template.j2 index 75efdd73..0594f9d9 100644 --- a/exercises/practice/nucleotide-count/.meta/template.j2 +++ b/exercises/practice/nucleotide-count/.meta/template.j2 @@ -7,11 +7,11 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["strand"] | to_roc }} + result = {{ case["property"] | to_snake }}({{ case["input"]["strand"] | to_roc }}) {%- if case["expected"]["error"] %} - Result.is_err result + Result.is_err(result) {%- else %} - result == Ok {{ case["expected"] | to_roc }} + result == Ok({{ case["expected"] | to_roc }}) {%- endif %} {% endfor %} diff --git a/exercises/practice/nucleotide-count/nucleotide-count-test.roc b/exercises/practice/nucleotide-count/nucleotide-count-test.roc index b1a47b9d..d38579c5 100644 --- a/exercises/practice/nucleotide-count/nucleotide-count-test.roc +++ b/exercises/practice/nucleotide-count/nucleotide-count-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/ocr-numbers/.meta/template.j2 b/exercises/practice/ocr-numbers/.meta/template.j2 index d284568d..85b49b0b 100644 --- a/exercises/practice/ocr-numbers/.meta/template.j2 +++ b/exercises/practice/ocr-numbers/.meta/template.j2 @@ -8,11 +8,11 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } # {{ case["description"] }} expect grid = {{ case["input"]["rows"] | to_roc_multiline_string | indent(8) }} - result = {{ case["property"] | to_snake }} grid + result = {{ case["property"] | to_snake }}(grid) {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} - expected = Ok {{ case["expected"] | to_roc }} + expected = Ok({{ case["expected"] | to_roc }}) result == expected {%- endif %} diff --git a/exercises/practice/ocr-numbers/ocr-numbers-test.roc b/exercises/practice/ocr-numbers/ocr-numbers-test.roc index ab12cca5..99565618 100644 --- a/exercises/practice/ocr-numbers/ocr-numbers-test.roc +++ b/exercises/practice/ocr-numbers/ocr-numbers-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/palindrome-products/.meta/template.j2 b/exercises/practice/palindrome-products/.meta/template.j2 index 0a466f7f..7c80bd28 100644 --- a/exercises/practice/palindrome-products/.meta/template.j2 +++ b/exercises/practice/palindrome-products/.meta/template.j2 @@ -4,27 +4,27 @@ import {{ exercise | to_pascal }} exposing [smallest, largest] -isEq = |result, expected| +is_eq = |result, expected| when (result, expected) is - (Ok {value, factors}, Ok {value: expectedValue, factors: expectedFactors}) -> - value == expectedValue && factors == expectedFactors + (Ok({value, factors}), Ok({value: expected_value, factors: expected_factors})) -> + value == expected_value && factors == expected_factors _ -> Bool.false {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"] | to_roc }} + result = {{ case["property"] | to_snake }}({{ case["input"] | to_roc }}) {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} - expected = Ok { + expected = Ok({ value: {% if case["expected"]["value"] is none %}0{% else %}{{ case["expected"]["value"] }}{% endif %}, - factors: Set.from_list [ + factors: Set.from_list([ {%- for pair in case["expected"]["factors"] %} ({{ pair[0] }}, {{ pair[1] }}),{% endfor %} - ] - } - result |> isEq expected + ]) + }) + result |> is_eq(expected) {%- endif %} {% endfor %} diff --git a/exercises/practice/palindrome-products/palindrome-products-test.roc b/exercises/practice/palindrome-products/palindrome-products-test.roc index b593715d..77613521 100644 --- a/exercises/practice/palindrome-products/palindrome-products-test.roc +++ b/exercises/practice/palindrome-products/palindrome-products-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/pangram/.meta/template.j2 b/exercises/practice/pangram/.meta/template.j2 index e0040de3..c0511911 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_snake }} {{ 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 c29c9f9b..ac1de933 100644 --- a/exercises/practice/pangram/pangram-test.roc +++ b/exercises/practice/pangram/pangram-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/pascals-triangle/.meta/template.j2 b/exercises/practice/pascals-triangle/.meta/template.j2 index ba5d20dc..db72aca9 100644 --- a/exercises/practice/pascals-triangle/.meta/template.j2 +++ b/exercises/practice/pascals-triangle/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [pascals_triangle] {% for case in cases -%} # {{ case["description"] }} expect - result = pascals_triangle {{ case["input"]["count"] | to_roc }} + result = pascals_triangle({{ case["input"]["count"] | to_roc }}) expected = [{%- for row in case["expected"] %} {{ row | to_roc }}, {%- endfor %}] diff --git a/exercises/practice/pascals-triangle/pascals-triangle-test.roc b/exercises/practice/pascals-triangle/pascals-triangle-test.roc index 4695a21e..e702adf3 100644 --- a/exercises/practice/pascals-triangle/pascals-triangle-test.roc +++ b/exercises/practice/pascals-triangle/pascals-triangle-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/perfect-numbers/.meta/template.j2 b/exercises/practice/perfect-numbers/.meta/template.j2 index 4c5ea305..ec51e9f2 100644 --- a/exercises/practice/perfect-numbers/.meta/template.j2 +++ b/exercises/practice/perfect-numbers/.meta/template.j2 @@ -12,11 +12,11 @@ import {{ exercise | to_pascal }} exposing [classify] {% for case in supercase["cases"] -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["number"] }} + result = {{ case["property"] | to_snake }}({{ case["input"]["number"] }}) {%- if case["expected"]["error"] %} - Result.is_err result + Result.is_err(result) {%- else %} - result == Ok {{ case["expected"] | to_pascal }} + result == Ok({{ case["expected"] | to_pascal }}) {%- endif %} {% endfor %} diff --git a/exercises/practice/perfect-numbers/perfect-numbers-test.roc b/exercises/practice/perfect-numbers/perfect-numbers-test.roc index 9ac8eaa0..2d183d1c 100644 --- a/exercises/practice/perfect-numbers/perfect-numbers-test.roc +++ b/exercises/practice/perfect-numbers/perfect-numbers-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/phone-number/.meta/template.j2 b/exercises/practice/phone-number/.meta/template.j2 index 0e3df4ab..45f4dec9 100644 --- a/exercises/practice/phone-number/.meta/template.j2 +++ b/exercises/practice/phone-number/.meta/template.j2 @@ -7,11 +7,11 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["phrase"] | to_roc }} + result = {{ case["property"] | to_snake }}({{ case["input"]["phrase"] | to_roc }}) {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} - expected = Ok {{ case["expected"] | to_roc }} + expected = Ok({{ case["expected"] | to_roc }}) result == expected {%- endif %} diff --git a/exercises/practice/phone-number/phone-number-test.roc b/exercises/practice/phone-number/phone-number-test.roc index adf9a71d..4175682f 100644 --- a/exercises/practice/phone-number/phone-number-test.roc +++ b/exercises/practice/phone-number/phone-number-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/pig-latin/.meta/template.j2 b/exercises/practice/pig-latin/.meta/template.j2 index a667978e..b4ae2f04 100644 --- a/exercises/practice/pig-latin/.meta/template.j2 +++ b/exercises/practice/pig-latin/.meta/template.j2 @@ -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_snake }} {{ 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/.meta/tests.toml b/exercises/practice/pig-latin/.meta/tests.toml index c29168c5..d524305b 100644 --- a/exercises/practice/pig-latin/.meta/tests.toml +++ b/exercises/practice/pig-latin/.meta/tests.toml @@ -39,6 +39,9 @@ description = "first letter and ay are moved to the end of words that start with [bce94a7a-a94e-4e2b-80f4-b2bb02e40f71] description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with q without a following u" +[e59dbbe8-ccee-4619-a8e9-ce017489bfc0] +description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with consonant and vowel containing qu" + [c01e049a-e3e2-451c-bf8e-e2abb7e438b8] description = "some letter clusters are treated like a single consonant -> word beginning with ch" diff --git a/exercises/practice/pig-latin/pig-latin-test.roc b/exercises/practice/pig-latin/pig-latin-test.roc index 86496c34..dcf77d52 100644 --- a/exercises/practice/pig-latin/pig-latin-test.roc +++ b/exercises/practice/pig-latin/pig-latin-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } @@ -70,6 +70,11 @@ expect result = translate("qat") result == "atqay" +# word beginning with consonant and vowel containing qu +expect + result = translate("liquid") + result == "iquidlay" + ## ## some letter clusters are treated like a single consonant ## diff --git a/exercises/practice/poker/.meta/template.j2 b/exercises/practice/poker/.meta/template.j2 index 37993dd9..b3dcde9d 100644 --- a/exercises/practice/poker/.meta/template.j2 +++ b/exercises/practice/poker/.meta/template.j2 @@ -8,7 +8,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } # {{ case["description"] }} expect hands = {{ case["input"]["hands"] | to_roc }} - result = {{ case["property"] | to_snake }} hands - result == Ok {{ case["expected"] | to_roc }} + 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 624c41bb..5903a9cb 100644 --- a/exercises/practice/poker/poker-test.roc +++ b/exercises/practice/poker/poker-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/prime-factors/.meta/template.j2 b/exercises/practice/prime-factors/.meta/template.j2 index a8cb222b..b4b90411 100644 --- a/exercises/practice/prime-factors/.meta/template.j2 +++ b/exercises/practice/prime-factors/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ exercise | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ exercise | to_snake }} {{ 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 80a245aa..9aa693bf 100644 --- a/exercises/practice/prime-factors/prime-factors-test.roc +++ b/exercises/practice/prime-factors/prime-factors-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/protein-translation/.meta/template.j2 b/exercises/practice/protein-translation/.meta/template.j2 index cb28adcf..9b602769 100644 --- a/exercises/practice/protein-translation/.meta/template.j2 +++ b/exercises/practice/protein-translation/.meta/template.j2 @@ -12,7 +12,7 @@ expect {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} - result == Ok [{%- for aminoAcid in case["expected"] -%}{{ aminoAcid | to_pascal }}, {%- endfor %}] + result == Ok([{%- for aminoAcid in case["expected"] -%}{{ aminoAcid | to_pascal }}, {%- endfor %}]) {%- endif %} {% endfor %} diff --git a/exercises/practice/protein-translation/protein-translation-test.roc b/exercises/practice/protein-translation/protein-translation-test.roc index 3e4d8576..58b71eaf 100644 --- a/exercises/practice/protein-translation/protein-translation-test.roc +++ b/exercises/practice/protein-translation/protein-translation-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/proverb/.meta/template.j2 b/exercises/practice/proverb/.meta/template.j2 index 3e054cec..5c274011 100644 --- a/exercises/practice/proverb/.meta/template.j2 +++ b/exercises/practice/proverb/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 c0f454eb..7e025b3e 100644 --- a/exercises/practice/proverb/proverb-test.roc +++ b/exercises/practice/proverb/proverb-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/pythagorean-triplet/.meta/template.j2 b/exercises/practice/pythagorean-triplet/.meta/template.j2 index c7359479..e7b51fc9 100644 --- a/exercises/practice/pythagorean-triplet/.meta/template.j2 +++ b/exercises/practice/pythagorean-triplet/.meta/template.j2 @@ -7,10 +7,10 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["n"] }} - expected = Set.from_list [{%- for triplet in case["expected"] %} + result = {{ case["property"] | to_snake }}({{ case["input"]["n"] }}) + expected = Set.from_list([{%- for triplet in case["expected"] %} ({{ triplet[0] }}, {{ triplet[1] }}, {{ triplet[2] }}), - {%- endfor %}] + {%- endfor %}]) result == expected {% endfor %} diff --git a/exercises/practice/pythagorean-triplet/pythagorean-triplet-test.roc b/exercises/practice/pythagorean-triplet/pythagorean-triplet-test.roc index 5731e48c..80db9e6d 100644 --- a/exercises/practice/pythagorean-triplet/pythagorean-triplet-test.roc +++ b/exercises/practice/pythagorean-triplet/pythagorean-triplet-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/queen-attack/.meta/template.j2 b/exercises/practice/queen-attack/.meta/template.j2 index 04d53c77..34720f73 100644 --- a/exercises/practice/queen-attack/.meta/template.j2 +++ b/exercises/practice/queen-attack/.meta/template.j2 @@ -14,28 +14,26 @@ import {{ exercise | to_pascal }} exposing [create, rank, file, queen_can_attack {%- if case["property"] == "create" %} {%- if case["expected"] == 0 %} expect - maybeSquare = create "{{ plugins.to_square(case["input"]["queen"]) }}" - result = maybeSquare |> Result.try \square -> - Ok (rank square) - result == Ok {{ plugins.to_rank(case["input"]["queen"]["position"]["row"]) }} + maybe_square = create("{{ plugins.to_square(case["input"]["queen"]) }}") + result = maybe_square |> Result.try( |square| Ok(rank square) ) + result == Ok({{ plugins.to_rank(case["input"]["queen"]["position"]["row"]) }}) expect - maybeSquare = create "{{ plugins.to_square(case["input"]["queen"]) }}" - result = maybeSquare |> Result.try \square -> - Ok (file square) - result == Ok '{{ plugins.to_file(case["input"]["queen"]["position"]["column"]) }}' + maybe_square = create("{{ plugins.to_square(case["input"]["queen"]) }}") + result = maybe_square |> Result.try( |square| Ok(file square) ) + result == Ok('{{ plugins.to_file(case["input"]["queen"]["position"]["column"]) }}') {%- else %} expect - result = create "{{ plugins.to_square(case["input"]["queen"]) }}" + result = create("{{ plugins.to_square(case["input"]["queen"]) }}") result |> Result.is_err {%- endif %} {%- elif case["property"] == "canAttack" %} expect - maybeSquare1 = create "{{ plugins.to_square(case["input"]["white_queen"]) }}" - maybeSquare2 = create "{{ plugins.to_square(case["input"]["black_queen"]) }}" - result = when (maybeSquare1, maybeSquare2) is - (Ok square1, Ok square2) -> - square1 |> queen_can_attack square2 + maybe_square1 = create("{{ plugins.to_square(case["input"]["white_queen"]) }}") + maybe_square2 = create("{{ plugins.to_square(case["input"]["black_queen"]) }}") + result = when (maybe_square1, maybe_square2) is + (Ok(square1), Ok(square2)) -> + square1 |> queen_can_attack(square2) _ -> crash "Unreachable: {{ plugins.to_square(case["input"]["white_queen"]) }} and {{ plugins.to_square(case["input"]["black_queen"]) }} are both valid squares" result == {{ case["expected"] | to_roc }} {%- endif %} diff --git a/exercises/practice/queen-attack/queen-attack-test.roc b/exercises/practice/queen-attack/queen-attack-test.roc index 250636f2..476b1f8b 100644 --- a/exercises/practice/queen-attack/queen-attack-test.roc +++ b/exercises/practice/queen-attack/queen-attack-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } @@ -19,22 +19,12 @@ import QueenAttack exposing [create, rank, file, queen_can_attack] # queen with a valid position expect maybe_square = create("C6") - result = - maybe_square - |> Result.try( - |square| - Ok(rank(square)), - ) + result = maybe_square |> Result.try(|square| Ok(rank square)) result == Ok(6) expect maybe_square = create("C6") - result = - maybe_square - |> Result.try( - |square| - Ok(file(square)), - ) + result = maybe_square |> Result.try(|square| Ok(file square)) result == Ok('C') # queen must have row on board @@ -60,7 +50,7 @@ expect (Ok(square1), Ok(square2)) -> square1 |> queen_can_attack(square2) - _ -> crash("Unreachable: E6 and G2 are both valid squares") + _ -> crash "Unreachable: E6 and G2 are both valid squares" result == Bool.false # can attack on same row @@ -72,7 +62,7 @@ expect (Ok(square1), Ok(square2)) -> square1 |> queen_can_attack(square2) - _ -> crash("Unreachable: E6 and G6 are both valid squares") + _ -> crash "Unreachable: E6 and G6 are both valid squares" result == Bool.true # can attack on same column @@ -84,7 +74,7 @@ expect (Ok(square1), Ok(square2)) -> square1 |> queen_can_attack(square2) - _ -> crash("Unreachable: F4 and F6 are both valid squares") + _ -> crash "Unreachable: F4 and F6 are both valid squares" result == Bool.true # can attack on first diagonal @@ -96,7 +86,7 @@ expect (Ok(square1), Ok(square2)) -> square1 |> queen_can_attack(square2) - _ -> crash("Unreachable: C6 and E8 are both valid squares") + _ -> crash "Unreachable: C6 and E8 are both valid squares" result == Bool.true # can attack on second diagonal @@ -108,7 +98,7 @@ expect (Ok(square1), Ok(square2)) -> square1 |> queen_can_attack(square2) - _ -> crash("Unreachable: C6 and B5 are both valid squares") + _ -> crash "Unreachable: C6 and B5 are both valid squares" result == Bool.true # can attack on third diagonal @@ -120,7 +110,7 @@ expect (Ok(square1), Ok(square2)) -> square1 |> queen_can_attack(square2) - _ -> crash("Unreachable: C6 and B7 are both valid squares") + _ -> crash "Unreachable: C6 and B7 are both valid squares" result == Bool.true # can attack on fourth diagonal @@ -132,7 +122,7 @@ expect (Ok(square1), Ok(square2)) -> square1 |> queen_can_attack(square2) - _ -> crash("Unreachable: H7 and G8 are both valid squares") + _ -> crash "Unreachable: H7 and G8 are both valid squares" result == Bool.true # cannot attack if falling diagonals are only the same when reflected across the longest falling diagonal @@ -144,6 +134,6 @@ expect (Ok(square1), Ok(square2)) -> square1 |> queen_can_attack(square2) - _ -> crash("Unreachable: B4 and F6 are both valid squares") + _ -> crash "Unreachable: B4 and F6 are both valid squares" result == Bool.false diff --git a/exercises/practice/rail-fence-cipher/.meta/template.j2 b/exercises/practice/rail-fence-cipher/.meta/template.j2 index 8507ae7c..c05a1a87 100644 --- a/exercises/practice/rail-fence-cipher/.meta/template.j2 +++ b/exercises/practice/rail-fence-cipher/.meta/template.j2 @@ -13,8 +13,8 @@ import {{ exercise | to_pascal }} exposing [encode, decode] # {{ case["description"] }} expect message = {{ case["input"]["msg"] | to_roc }} - result = message |> {{ case["property"] | to_snake }} {{ case["input"]["rails"] | to_roc }} - expected = Ok {{ case["expected"] | to_roc }} + result = message |> {{ case["property"] | to_snake }}({{ case["input"]["rails"] | to_roc }}) + expected = Ok({{ case["expected"] | to_roc }}) result == expected {% endfor %} 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 98d50090..5d9446db 100644 --- a/exercises/practice/rail-fence-cipher/rail-fence-cipher-test.roc +++ b/exercises/practice/rail-fence-cipher/rail-fence-cipher-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/raindrops/.meta/template.j2 b/exercises/practice/raindrops/.meta/template.j2 index 60457cf6..e8b3010e 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_snake }} {{ 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 851eaef6..c68ab387 100644 --- a/exercises/practice/raindrops/raindrops-test.roc +++ b/exercises/practice/raindrops/raindrops-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/rational-numbers/.meta/plugins.py b/exercises/practice/rational-numbers/.meta/plugins.py index b26258c4..26d36cee 100644 --- a/exercises/practice/rational-numbers/.meta/plugins.py +++ b/exercises/practice/rational-numbers/.meta/plugins.py @@ -1,2 +1,2 @@ def to_roc_rational(r): - return f"Rational {r[0]} {r[1]}" + return f"Rational({r[0]}, {r[1]})" diff --git a/exercises/practice/rational-numbers/.meta/template.j2 b/exercises/practice/rational-numbers/.meta/template.j2 index ede1f929..6d0855cf 100644 --- a/exercises/practice/rational-numbers/.meta/template.j2 +++ b/exercises/practice/rational-numbers/.meta/template.j2 @@ -20,12 +20,12 @@ 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_snake }} ({{ 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_snake }} ({{ 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_snake }} {{ 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_snake }} {%- endif %} @@ -35,7 +35,7 @@ expect {%- if case["expected"] is iterable %} result == {{ plugins.to_roc_rational(case["expected"]) }} {%- else %} - result |> Num.is_approx_eq {{ case["expected"] | to_roc }} {} + result |> Num.is_approx_eq({{ case["expected"] | to_roc }}, {}) {%- endif %} {% endmacro %} diff --git a/exercises/practice/rational-numbers/rational-numbers-test.roc b/exercises/practice/rational-numbers/rational-numbers-test.roc index 3eb5b5c7..abadf63c 100644 --- a/exercises/practice/rational-numbers/rational-numbers-test.roc +++ b/exercises/practice/rational-numbers/rational-numbers-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/rectangles/.meta/template.j2 b/exercises/practice/rectangles/.meta/template.j2 index 20dd6b49..53918371 100644 --- a/exercises/practice/rectangles/.meta/template.j2 +++ b/exercises/practice/rectangles/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 946323ce..4071ad2d 100644 --- a/exercises/practice/rectangles/rectangles-test.roc +++ b/exercises/practice/rectangles/rectangles-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/resistor-color-duo/.meta/template.j2 b/exercises/practice/resistor-color-duo/.meta/template.j2 index cd0e6e00..b548a358 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_snake }} {{ 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 85b25000..b8bfe65c 100644 --- a/exercises/practice/resistor-color-duo/resistor-color-duo-test.roc +++ b/exercises/practice/resistor-color-duo/resistor-color-duo-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/resistor-color/.meta/template.j2 b/exercises/practice/resistor-color/.meta/template.j2 index f6726327..c8e32f9f 100644 --- a/exercises/practice/resistor-color/.meta/template.j2 +++ b/exercises/practice/resistor-color/.meta/template.j2 @@ -20,8 +20,8 @@ expect {% for subcase in case["cases"] -%} # {{ subcase["description"] }} expect - result = {{ subcase["property"] | to_snake }} {{ subcase["input"]["color"] | to_roc }} - result == Ok {{ subcase["expected"] }} + result = {{ subcase["property"] | to_snake }}({{ subcase["input"]["color"] | to_roc }}) + result == Ok({{ subcase["expected"] }}) {% endfor %} {%- endif -%} diff --git a/exercises/practice/resistor-color/resistor-color-test.roc b/exercises/practice/resistor-color/resistor-color-test.roc index a5f4d511..0802bb88 100644 --- a/exercises/practice/resistor-color/resistor-color-test.roc +++ b/exercises/practice/resistor-color/resistor-color-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/rest-api/.meta/template.j2 b/exercises/practice/rest-api/.meta/template.j2 index d21b167c..109b5ee3 100644 --- a/exercises/practice/rest-api/.meta/template.j2 +++ b/exercises/practice/rest-api/.meta/template.j2 @@ -4,14 +4,17 @@ import {{ exercise | to_pascal }} exposing [get, post] -standardizeResult = |result| - result |> Result.try |string| - string - |> Str.replace_each ".0," "," - |> Str.replace_each ".0}" "}" - |> Str.to_utf8 - |> List.drop_if |c| [' ', '\t', '\n'] |> List.contains c - |> Str.from_utf8 +standardize_result = |result| + result + |> Result.try( + |string| + string + |> Str.replace_each(".0,", ",") + |> Str.replace_each(".0}", "}") + |> Str.to_utf8 + |> List.drop_if |c| [' ', '\t', '\n'] |> List.contains(c) + |> Str.from_utf8 + ) {% for supercase in cases %} ## @@ -26,28 +29,28 @@ expect {%- for user in case["input"]["database"]["users"] %} { name: {{ user["name"] | to_roc }}, - owes: Dict.from_list [ + owes: Dict.from_list([ {%- for (name, amount) in user["owes"].items() %} ({{ name | to_roc }}, {{ amount }}), {%- endfor -%} - ], - owed_by: Dict.from_list [ + ]), + owed_by: Dict.from_list([ {%- for (name, amount) in user["owed_by"].items() %} ({{ name | to_roc }}, {{ amount }}), {%- endfor -%} - ], + ]), balance: {{ user["balance"] }}, }, {%- endfor %} ] } - result = database |> {{ case["property"] | to_snake }} { + result = database |> {{ case["property"] | to_snake }}({ url: {{ case["input"]["url"] | to_roc }}, {%- if case["input"].get("payload", {}) != {} %} payload: {{ case["input"]["payload"] | tojson | to_roc }} {%- endif %} - } |> standardizeResult - expected = Ok {{ case["expected"] | tojson | replace(".0,", ",") | replace(".0}", "}") | replace(" ", "") | to_roc }} + }) |> standardize_result + expected = Ok({{ case["expected"] | tojson | replace(".0,", ",") | replace(".0}", "}") | replace(" ", "") | to_roc }}) result == expected {% endfor %} diff --git a/exercises/practice/rest-api/rest-api-test.roc b/exercises/practice/rest-api/rest-api-test.roc index 2d443166..d45aa8a2 100644 --- a/exercises/practice/rest-api/rest-api-test.roc +++ b/exercises/practice/rest-api/rest-api-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", json: "https://github.com/lukewilliamboswell/roc-json/releases/download/0.12.0/1trwx8sltQ-e9Y2rOB4LWUWLS_sFVyETK8Twl0i9qpw.tar.gz", @@ -21,7 +21,7 @@ standardize_result = |result| |> Str.replace_each(".0,", ",") |> Str.replace_each(".0}", "}") |> Str.to_utf8 - |> List.drop_if(|c| [' ', '\t', '\n'] |> List.contains(c)) + |> List.drop_if |c| [' ', '\t', '\n'] |> List.contains(c) |> Str.from_utf8, ) diff --git a/exercises/practice/reverse-string/.meta/template.j2 b/exercises/practice/reverse-string/.meta/template.j2 index 946f8506..07e0a8df 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_snake }} {{ 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 d296e117..8359486c 100644 --- a/exercises/practice/reverse-string/reverse-string-test.roc +++ b/exercises/practice/reverse-string/reverse-string-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", unicode: "https://github.com/roc-lang/unicode/releases/download/0.3.0/9KKFsA4CdOz0JIOL7iBSI_2jGIXQ6TsFBXgd086idpY.tar.br", diff --git a/exercises/practice/rna-transcription/.meta/template.j2 b/exercises/practice/rna-transcription/.meta/template.j2 index c8bcae59..f88481ec 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_snake }} {{ 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 9eef5626..b167a7fb 100644 --- a/exercises/practice/rna-transcription/rna-transcription-test.roc +++ b/exercises/practice/rna-transcription/rna-transcription-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/robot-simulator/.meta/template.j2 b/exercises/practice/robot-simulator/.meta/template.j2 index 29f2715c..71c11f7b 100644 --- a/exercises/practice/robot-simulator/.meta/template.j2 +++ b/exercises/practice/robot-simulator/.meta/template.j2 @@ -13,10 +13,10 @@ import {{ exercise | to_pascal }} exposing [create, move] # {{ case["description"] }} expect {%- if case["input"]["instructions"] %} - robot = create {{ plugins.to_robot(case["input"], with_defaults=True) }} - result = robot |> move {{ case["input"]["instructions"] | to_roc }} + robot = create({{ plugins.to_robot(case["input"], with_defaults=True) }}) + result = robot |> move({{ case["input"]["instructions"] | to_roc }}) {%- else %} - result = create {{ plugins.to_robot(case["input"], with_defaults=True) }} + result = create({{ plugins.to_robot(case["input"], with_defaults=True) }}) {%- endif %} result == {{ plugins.to_robot(case["expected"], with_defaults=False) }} diff --git a/exercises/practice/robot-simulator/robot-simulator-test.roc b/exercises/practice/robot-simulator/robot-simulator-test.roc index 8874979f..7d7138d7 100644 --- a/exercises/practice/robot-simulator/robot-simulator-test.roc +++ b/exercises/practice/robot-simulator/robot-simulator-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/roman-numerals/.meta/template.j2 b/exercises/practice/roman-numerals/.meta/template.j2 index bc1c769e..d2fb0f03 100644 --- a/exercises/practice/roman-numerals/.meta/template.j2 +++ b/exercises/practice/roman-numerals/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["number"] | to_roc }} - result == Ok {{ case["expected"] | 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 9912d64e..93602658 100644 --- a/exercises/practice/roman-numerals/roman-numerals-test.roc +++ b/exercises/practice/roman-numerals/roman-numerals-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/rotational-cipher/.meta/template.j2 b/exercises/practice/rotational-cipher/.meta/template.j2 index 26a225db..6fb226c6 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_snake }} {{ 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 7ca8aad4..72a1e639 100644 --- a/exercises/practice/rotational-cipher/rotational-cipher-test.roc +++ b/exercises/practice/rotational-cipher/rotational-cipher-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/run-length-encoding/.meta/template.j2 b/exercises/practice/run-length-encoding/.meta/template.j2 index b8176fd1..61c5c793 100644 --- a/exercises/practice/run-length-encoding/.meta/template.j2 +++ b/exercises/practice/run-length-encoding/.meta/template.j2 @@ -14,12 +14,12 @@ import {{ exercise | to_pascal }} exposing [encode, decode] expect string = {{ case["input"]["string"] | to_roc }} {%- if case["property"] == "consistency" %} - result = string |> encode |> Result.try decode - result == Ok string + result = string |> encode |> Result.try(decode) + result == Ok(string) {%- else %} result = string |> {{ case["property"] | to_snake }} expected = {{ case["expected"] | to_roc }} - result == Ok expected + result == Ok(expected) {%- endif %} {% endfor %} 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 0edabfe2..9f3e660d 100644 --- a/exercises/practice/run-length-encoding/run-length-encoding-test.roc +++ b/exercises/practice/run-length-encoding/run-length-encoding-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/saddle-points/.meta/template.j2 b/exercises/practice/saddle-points/.meta/template.j2 index 4d0d3995..f8b9d3ad 100644 --- a/exercises/practice/saddle-points/.meta/template.j2 +++ b/exercises/practice/saddle-points/.meta/template.j2 @@ -7,17 +7,17 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - treeHeights = [ + tree_heights = [ {%- for row in case["input"]["matrix"] %} {{ row | to_roc }}, {%- endfor %} ] - result = treeHeights |> {{ case["property"] | to_snake }} - expected = Set.from_list [ + result = tree_heights |> {{ case["property"] | to_snake }} + expected = Set.from_list([ {%- for tree in case["expected"] %} {{ tree | to_roc }}, {%- endfor %} - ] + ]) result == expected {% endfor %} diff --git a/exercises/practice/saddle-points/saddle-points-test.roc b/exercises/practice/saddle-points/saddle-points-test.roc index 6c0750e7..a9f2ddc3 100644 --- a/exercises/practice/saddle-points/saddle-points-test.roc +++ b/exercises/practice/saddle-points/saddle-points-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/say/.meta/template.j2 b/exercises/practice/say/.meta/template.j2 index 8e03ae6d..2e8c177e 100644 --- a/exercises/practice/say/.meta/template.j2 +++ b/exercises/practice/say/.meta/template.j2 @@ -7,11 +7,11 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["number"] | to_roc }} + result = {{ case["property"] | to_snake }}({{ case["input"]["number"] | to_roc }}) {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} - result == Ok {{ case["expected"] | to_roc }} + result == Ok({{ case["expected"] | to_roc }}) {% endif %} {% endfor %} diff --git a/exercises/practice/say/say-test.roc b/exercises/practice/say/say-test.roc index c3c39a9c..4ee13693 100644 --- a/exercises/practice/say/say-test.roc +++ b/exercises/practice/say/say-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/scrabble-score/.meta/template.j2 b/exercises/practice/scrabble-score/.meta/template.j2 index bbb6d670..26c059c0 100644 --- a/exercises/practice/scrabble-score/.meta/template.j2 +++ b/exercises/practice/scrabble-score/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 6230e9c8..e0221aa2 100644 --- a/exercises/practice/scrabble-score/scrabble-score-test.roc +++ b/exercises/practice/scrabble-score/scrabble-score-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/secret-handshake/.meta/template.j2 b/exercises/practice/secret-handshake/.meta/template.j2 index 72590767..a4eea5d5 100644 --- a/exercises/practice/secret-handshake/.meta/template.j2 +++ b/exercises/practice/secret-handshake/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 73175d0d..a84bb20a 100644 --- a/exercises/practice/secret-handshake/secret-handshake-test.roc +++ b/exercises/practice/secret-handshake/secret-handshake-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/series/.meta/template.j2 b/exercises/practice/series/.meta/template.j2 index 4e1b83c7..bc3bea6a 100644 --- a/exercises/practice/series/.meta/template.j2 +++ b/exercises/practice/series/.meta/template.j2 @@ -8,7 +8,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } # {{ case["description"] }} {%- if case["expected"]["error"] %} – just return an empty list{%- endif %} expect - result = {{ case["input"]["series"] | to_roc }} |> {{ case["property"] | to_snake }} {{ 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 5b2fc82b..4b956f3a 100644 --- a/exercises/practice/series/series-test.roc +++ b/exercises/practice/series/series-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/sgf-parsing/.meta/template.j2 b/exercises/practice/sgf-parsing/.meta/template.j2 index 452107a0..3f4e160d 100644 --- a/exercises/practice/sgf-parsing/.meta/template.j2 +++ b/exercises/practice/sgf-parsing/.meta/template.j2 @@ -5,16 +5,16 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake }}] {%- macro to_node(node) %} -GameNode { - properties: Dict.from_list [ +GameNode({ + properties: Dict.from_list([ {%- for name, values in node["properties"].items() %} ({{ name | to_roc }}, {{ values | to_roc }}), - {%- endfor %}], + {%- endfor %}]), children: [ {%- for child_node in node["children"] %} {{ to_node(child_node) }}, {%- endfor %}], -} +}) {%- endmacro %} @@ -22,12 +22,12 @@ GameNode { # {{ case["description"] }} expect sgf = {{ case["input"]["encoded"] | to_roc }} - result = {{ case["property"] | to_snake }} sgf + result = {{ case["property"] | to_snake }}(sgf) {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} expected = {{ to_node(case["expected"]) | indent(4) }} - result == Ok expected + result == Ok(expected) {%- endif %} diff --git a/exercises/practice/sgf-parsing/sgf-parsing-test.roc b/exercises/practice/sgf-parsing/sgf-parsing-test.roc index 5f9d712b..3f286558 100644 --- a/exercises/practice/sgf-parsing/sgf-parsing-test.roc +++ b/exercises/practice/sgf-parsing/sgf-parsing-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", parser: "https://github.com/lukewilliamboswell/roc-parser/releases/download/0.10.0/6eZYaXkrakq9fJ4oUc0VfdxU1Fap2iTuAN18q9OgQss.tar.br", diff --git a/exercises/practice/sieve/.meta/template.j2 b/exercises/practice/sieve/.meta/template.j2 index fb13bc79..353a7c2a 100644 --- a/exercises/practice/sieve/.meta/template.j2 +++ b/exercises/practice/sieve/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 9f4e5001..74eefd05 100644 --- a/exercises/practice/sieve/sieve-test.roc +++ b/exercises/practice/sieve/sieve-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/space-age/.meta/template.j2 b/exercises/practice/space-age/.meta/template.j2 index 278c2aa1..d589ff9d 100644 --- a/exercises/practice/space-age/.meta/template.j2 +++ b/exercises/practice/space-age/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["planet"] | to_pascal }} {{ case["input"]["seconds"] }} - Num.is_approx_eq result {{ case["expected"] }} { atol: 0.01 } + result = {{ case["property"] | to_snake }}({{ case["input"]["planet"] | to_pascal }}, {{ case["input"]["seconds"] }}) + Num.is_approx_eq(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 c89046e0..0766e91a 100644 --- a/exercises/practice/space-age/space-age-test.roc +++ b/exercises/practice/space-age/space-age-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/spiral-matrix/.meta/template.j2 b/exercises/practice/spiral-matrix/.meta/template.j2 index f9e1eaea..9f973930 100644 --- a/exercises/practice/spiral-matrix/.meta/template.j2 +++ b/exercises/practice/spiral-matrix/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 55347033..2cc84c85 100644 --- a/exercises/practice/spiral-matrix/spiral-matrix-test.roc +++ b/exercises/practice/spiral-matrix/spiral-matrix-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/square-root/.meta/template.j2 b/exercises/practice/square-root/.meta/template.j2 index 3bd17669..9f905aa8 100644 --- a/exercises/practice/square-root/.meta/template.j2 +++ b/exercises/practice/square-root/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ 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 626f055f..4d407995 100644 --- a/exercises/practice/square-root/square-root-test.roc +++ b/exercises/practice/square-root/square-root-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/strain/.meta/template.j2 b/exercises/practice/strain/.meta/template.j2 index 92f38777..4635e345 100644 --- a/exercises/practice/strain/.meta/template.j2 +++ b/exercises/practice/strain/.meta/template.j2 @@ -5,9 +5,9 @@ import {{ exercise | to_pascal }} exposing [keep, discard] {% set function_map = { - "fn(x) -> contains(x, 5)": "\\x -> x |> List.contains 5", + "fn(x) -> contains(x, 5)": "|x| x |> List.contains(5)", "fn(x) -> false": "\\_ -> Bool.false", - "fn(x) -> starts_with(x, 'z')": "\\x -> x |> Str.starts_with \"z\"", + "fn(x) -> starts_with(x, 'z')": "|x| x |> Str.starts_with(\"z\")", "fn(x) -> true": "\\_ -> Bool.true", "fn(x) -> x % 2 == 0": "\\x -> x % 2 == 0", "fn(x) -> x % 2 == 1": "\\x -> x % 2 == 1", @@ -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_snake }} {{ 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 5b2bfcbb..6d8483de 100644 --- a/exercises/practice/strain/strain-test.roc +++ b/exercises/practice/strain/strain-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/sublist/.meta/template.j2 b/exercises/practice/sublist/.meta/template.j2 index d197d628..9b1776c0 100644 --- a/exercises/practice/sublist/.meta/template.j2 +++ b/exercises/practice/sublist/.meta/template.j2 @@ -7,7 +7,7 @@ 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_snake }} {{ 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 d9081869..5ac4197d 100644 --- a/exercises/practice/sublist/sublist-test.roc +++ b/exercises/practice/sublist/sublist-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/sum-of-multiples/.meta/template.j2 b/exercises/practice/sum-of-multiples/.meta/template.j2 index 4ce89bda..52e64a81 100644 --- a/exercises/practice/sum-of-multiples/.meta/template.j2 +++ b/exercises/practice/sum-of-multiples/.meta/template.j2 @@ -7,7 +7,7 @@ import {{ exercise | to_pascal }} exposing [{{ exercise | to_snake }}] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["input"]["factors"] | to_roc }} |> {{ exercise | to_snake }} {{ 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 eb89ca60..1c07b3f3 100644 --- a/exercises/practice/sum-of-multiples/sum-of-multiples-test.roc +++ b/exercises/practice/sum-of-multiples/sum-of-multiples-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/tournament/.meta/template.j2 b/exercises/practice/tournament/.meta/template.j2 index 00f52ebf..0a8f88be 100644 --- a/exercises/practice/tournament/.meta/template.j2 +++ b/exercises/practice/tournament/.meta/template.j2 @@ -8,8 +8,8 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } # {{ case["description"] }} expect table = {{ case["input"]["rows"] | to_roc_multiline_string | indent(8) }} - result = {{ case["property"] | to_snake }} table - expected = Ok {{ case["expected"] | to_roc_multiline_string | indent(8) }} + result = {{ case["property"] | to_snake }}(table) + expected = Ok({{ case["expected"] | to_roc_multiline_string | indent(8) }}) result == expected {% endfor %} diff --git a/exercises/practice/tournament/tournament-test.roc b/exercises/practice/tournament/tournament-test.roc index 45f8b357..78e4c438 100644 --- a/exercises/practice/tournament/tournament-test.roc +++ b/exercises/practice/tournament/tournament-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/transpose/.meta/template.j2 b/exercises/practice/transpose/.meta/template.j2 index bbe9f773..4ea165d5 100644 --- a/exercises/practice/transpose/.meta/template.j2 +++ b/exercises/practice/transpose/.meta/template.j2 @@ -7,8 +7,8 @@ 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.replace_each "□" " " - result = {{ case["property"] | to_snake }} input |> Str.replace_each " " "□" + input = {{ case["input"]["lines"] | to_roc_multiline_string | replace(" ", "□") | indent(8) }} |> Str.replace_each("□", " ") + result = {{ case["property"] | to_snake }}(input) |> Str.replace_each(" ", "□") 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 fcf7aa42..8f42e735 100644 --- a/exercises/practice/transpose/transpose-test.roc +++ b/exercises/practice/transpose/transpose-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/triangle/.meta/template.j2 b/exercises/practice/triangle/.meta/template.j2 index 539bb233..d32731f6 100644 --- a/exercises/practice/triangle/.meta/template.j2 +++ b/exercises/practice/triangle/.meta/template.j2 @@ -12,7 +12,7 @@ import {{ exercise | to_pascal }} exposing [is_equilateral, is_isosceles, is_sca {% for case in supercase["cases"] -%} # {{ case["description"] }} expect - result = is_{{ case["property"] }} {{ case["input"]["sides"] | to_roc_tuple }} + result = is_{{ case["property"] }}({{ case["input"]["sides"] | to_roc_tuple }}) result == {{ case["expected"] | to_roc }} {% endfor %} diff --git a/exercises/practice/triangle/triangle-test.roc b/exercises/practice/triangle/triangle-test.roc index 6b4f0e65..64173744 100644 --- a/exercises/practice/triangle/triangle-test.roc +++ b/exercises/practice/triangle/triangle-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/two-bucket/.meta/template.j2 b/exercises/practice/two-bucket/.meta/template.j2 index 195a3bf1..0847d62c 100644 --- a/exercises/practice/two-bucket/.meta/template.j2 +++ b/exercises/practice/two-bucket/.meta/template.j2 @@ -7,20 +7,20 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} { + result = {{ case["property"] | to_snake }}({ bucket_one: {{ case["input"]["bucketOne"] }}, bucket_two: {{ case["input"]["bucketTwo"] }}, goal: {{ case["input"]["goal"] }}, start_bucket: {{ case["input"]["startBucket"] | to_pascal }}, - } + }) {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} - expected = Ok { + expected = Ok({ moves: {{ case["expected"]["moves"] }}, 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 a92ab69a..a0e48824 100644 --- a/exercises/practice/two-bucket/two-bucket-test.roc +++ b/exercises/practice/two-bucket/two-bucket-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/two-fer/.meta/template.j2 b/exercises/practice/two-fer/.meta/template.j2 index d343bb76..e1673c82 100644 --- a/exercises/practice/two-fer/.meta/template.j2 +++ b/exercises/practice/two-fer/.meta/template.j2 @@ -8,9 +8,9 @@ import {{ exercise | to_pascal }} exposing [{{ exercise | to_snake }}] # {{ case["description"] }} expect {%- if case["input"]["name"] == None %} - result = {{ case["property"] | to_snake }} Anonymous + result = {{ case["property"] | to_snake }}(Anonymous) {%- else %} - result = {{ case["property"] | to_snake }} (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 110915da..03d1d49b 100644 --- a/exercises/practice/two-fer/two-fer-test.roc +++ b/exercises/practice/two-fer/two-fer-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/variable-length-quantity/.meta/template.j2 b/exercises/practice/variable-length-quantity/.meta/template.j2 index 6b1121e2..98023e7d 100644 --- a/exercises/practice/variable-length-quantity/.meta/template.j2 +++ b/exercises/practice/variable-length-quantity/.meta/template.j2 @@ -14,7 +14,7 @@ import {{ exercise | to_pascal }} exposing [encode, decode] {%- if case["property"] == "encode" %} expect integers = {{ case["input"]["integers"] | to_roc }} - result = encode integers + result = encode(integers) expected = {{ case["expected"] | to_roc }} result == expected {%- else %} @@ -24,7 +24,7 @@ expect {%- if case["expected"]["error"] %} result |> Result.is_err {%- else %} - expected = Ok {{ case["expected"] | to_roc }} + expected = Ok({{ case["expected"] | to_roc }}) result == expected {%- endif %} {%- endif %} diff --git a/exercises/practice/variable-length-quantity/.meta/tests.toml b/exercises/practice/variable-length-quantity/.meta/tests.toml index c9af549f..53be789a 100644 --- a/exercises/practice/variable-length-quantity/.meta/tests.toml +++ b/exercises/practice/variable-length-quantity/.meta/tests.toml @@ -15,6 +15,9 @@ description = "Encode a series of integers, producing a series of bytes. -> zero [be44d299-a151-4604-a10e-d4b867f41540] description = "Encode a series of integers, producing a series of bytes. -> arbitrary single byte" +[890bc344-cb80-45af-b316-6806a6971e81] +description = "Encode a series of integers, producing a series of bytes. -> asymmetric single byte" + [ea399615-d274-4af6-bbef-a1c23c9e1346] description = "Encode a series of integers, producing a series of bytes. -> largest single byte" @@ -24,6 +27,9 @@ description = "Encode a series of integers, producing a series of bytes. -> smal [63955a49-2690-4e22-a556-0040648d6b2d] description = "Encode a series of integers, producing a series of bytes. -> arbitrary double byte" +[4977d113-251b-4d10-a3ad-2f5a7756bb58] +description = "Encode a series of integers, producing a series of bytes. -> asymmetric double byte" + [29da7031-0067-43d3-83a7-4f14b29ed97a] description = "Encode a series of integers, producing a series of bytes. -> largest double byte" @@ -33,6 +39,9 @@ description = "Encode a series of integers, producing a series of bytes. -> smal [5df0bc2d-2a57-4300-a653-a75ee4bd0bee] description = "Encode a series of integers, producing a series of bytes. -> arbitrary triple byte" +[6731045f-1e00-4192-b5ae-98b22e17e9f7] +description = "Encode a series of integers, producing a series of bytes. -> asymmetric triple byte" + [f51d8539-312d-4db1-945c-250222c6aa22] description = "Encode a series of integers, producing a series of bytes. -> largest triple byte" @@ -42,6 +51,9 @@ description = "Encode a series of integers, producing a series of bytes. -> smal [11ed3469-a933-46f1-996f-2231e05d7bb6] description = "Encode a series of integers, producing a series of bytes. -> arbitrary quadruple byte" +[b45ef770-cbba-48c2-bd3c-c6362679516e] +description = "Encode a series of integers, producing a series of bytes. -> asymmetric quadruple byte" + [d5f3f3c3-e0f1-4e7f-aad0-18a44f223d1c] description = "Encode a series of integers, producing a series of bytes. -> largest quadruple byte" @@ -51,6 +63,9 @@ description = "Encode a series of integers, producing a series of bytes. -> smal [5f34ff12-2952-4669-95fe-2d11b693d331] description = "Encode a series of integers, producing a series of bytes. -> arbitrary quintuple byte" +[9be46731-7cd5-415c-b960-48061cbc1154] +description = "Encode a series of integers, producing a series of bytes. -> asymmetric quintuple byte" + [7489694b-88c3-4078-9864-6fe802411009] description = "Encode a series of integers, producing a series of bytes. -> maximum 32-bit integer input" 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 2cce6f62..2afff9b2 100644 --- a/exercises/practice/variable-length-quantity/variable-length-quantity-test.roc +++ b/exercises/practice/variable-length-quantity/variable-length-quantity-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } @@ -30,6 +30,13 @@ expect expected = [64] result == expected +# asymmetric single byte +expect + integers = [83] + result = encode(integers) + expected = [83] + result == expected + # largest single byte expect integers = [127] @@ -51,6 +58,13 @@ expect expected = [192, 0] result == expected +# asymmetric double byte +expect + integers = [173] + result = encode(integers) + expected = [129, 45] + result == expected + # largest double byte expect integers = [16383] @@ -72,6 +86,13 @@ expect expected = [192, 128, 0] result == expected +# asymmetric triple byte +expect + integers = [120220] + result = encode(integers) + expected = [135, 171, 28] + result == expected + # largest triple byte expect integers = [2097151] @@ -93,6 +114,13 @@ expect expected = [192, 128, 128, 0] result == expected +# asymmetric quadruple byte +expect + integers = [3503876] + result = encode(integers) + expected = [129, 213, 238, 4] + result == expected + # largest quadruple byte expect integers = [268435455] @@ -114,6 +142,13 @@ expect expected = [143, 248, 128, 128, 0] result == expected +# asymmetric quintuple byte +expect + integers = [2254790917] + result = encode(integers) + expected = [136, 179, 149, 194, 5] + result == expected + # maximum 32-bit integer input expect integers = [4294967295] @@ -149,54 +184,54 @@ expect # one byte expect bytes = [127] - result = decode(bytes) + result = decode bytes expected = Ok([127]) result == expected # two bytes expect bytes = [192, 0] - result = decode(bytes) + result = decode bytes expected = Ok([8192]) result == expected # three bytes expect bytes = [255, 255, 127] - result = decode(bytes) + result = decode bytes expected = Ok([2097151]) result == expected # four bytes expect bytes = [129, 128, 128, 0] - result = decode(bytes) + result = decode bytes expected = Ok([2097152]) result == expected # maximum 32-bit integer expect bytes = [143, 255, 255, 255, 127] - result = decode(bytes) + result = decode bytes expected = Ok([4294967295]) result == expected # incomplete sequence causes error expect bytes = [255] - result = decode(bytes) + result = decode bytes result |> Result.is_err # incomplete sequence causes error, even if value is zero expect bytes = [128] - result = decode(bytes) + result = decode bytes result |> Result.is_err # multiple values expect bytes = [192, 0, 200, 232, 86, 255, 255, 255, 127, 0, 255, 127, 129, 128, 0] - result = decode(bytes) + result = decode bytes expected = Ok([8192, 1193046, 268435455, 0, 16383, 16384]) result == expected diff --git a/exercises/practice/word-count/.meta/template.j2 b/exercises/practice/word-count/.meta/template.j2 index cf7fb559..1a6dccc4 100644 --- a/exercises/practice/word-count/.meta/template.j2 +++ b/exercises/practice/word-count/.meta/template.j2 @@ -7,12 +7,12 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["sentence"] | to_roc }} - expected = Dict.from_list [ + result = {{ case["property"] | to_snake }}({{ case["input"]["sentence"] | to_roc }}) + expected = Dict.from_list([ {%- for word, count in case["expected"].items() %} ({{ word | to_roc }}, {{ count }}), {%- endfor %} - ] + ]) result == expected {% endfor %} diff --git a/exercises/practice/word-count/word-count-test.roc b/exercises/practice/word-count/word-count-test.roc index b4aa0a5c..f516712a 100644 --- a/exercises/practice/word-count/word-count-test.roc +++ b/exercises/practice/word-count/word-count-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/word-search/.meta/template.j2 b/exercises/practice/word-search/.meta/template.j2 index 946f8a58..40fcd147 100644 --- a/exercises/practice/word-search/.meta/template.j2 +++ b/exercises/practice/word-search/.meta/template.j2 @@ -9,8 +9,8 @@ import {{ exercise | to_pascal }} exposing [{{ cases[0]["property"] | to_snake } expect grid = {{ case["input"]["grid"] | to_roc_multiline_string | indent(8) }} words_to_search_for = {{ case["input"]["wordsToSearchFor"] | to_roc }} - result = grid |> {{ case["property"] | to_snake }} words_to_search_for - expected = Dict.from_list [ + result = grid |> {{ case["property"] | to_snake }}(words_to_search_for) + expected = Dict.from_list([ {%- for word, result in case["expected"].items() %} {%- if result is none %} # {{ word | to_roc }} is not in the grid @@ -18,7 +18,7 @@ expect ({{ word | to_roc }}, {{ result | to_roc }}), {%- endif %} {%- endfor %} - ] + ]) result == expected {% endfor %} diff --git a/exercises/practice/word-search/word-search-test.roc b/exercises/practice/word-search/word-search-test.roc index bd565ae7..6480ab66 100644 --- a/exercises/practice/word-search/word-search-test.roc +++ b/exercises/practice/word-search/word-search-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/wordy/.meta/template.j2 b/exercises/practice/wordy/.meta/template.j2 index 490fffd3..d814b72c 100644 --- a/exercises/practice/wordy/.meta/template.j2 +++ b/exercises/practice/wordy/.meta/template.j2 @@ -7,11 +7,11 @@ import {{ exercise | to_pascal }} exposing [answer] {% for case in cases -%} # {{ case["description"] }} expect - result = {{ case["property"] | to_snake }} {{ case["input"]["question"] | to_roc }} + result = {{ case["property"] | to_snake }}({{ case["input"]["question"] | to_roc }}) {%- if case["expected"]["error"] %} - Result.is_err result + Result.is_err(result) {%- else %} - result == Ok {{ case["expected"] }} + result == Ok({{ case["expected"] }}) {%- endif %} {% endfor %} diff --git a/exercises/practice/wordy/.meta/tests.toml b/exercises/practice/wordy/.meta/tests.toml index f812dfa9..a0a83ed0 100644 --- a/exercises/practice/wordy/.meta/tests.toml +++ b/exercises/practice/wordy/.meta/tests.toml @@ -12,9 +12,21 @@ [88bf4b28-0de3-4883-93c7-db1b14aa806e] description = "just a number" +[18983214-1dfc-4ebd-ac77-c110dde699ce] +description = "just a zero" + +[607c08ee-2241-4288-916d-dae5455c87e6] +description = "just a negative number" + [bb8c655c-cf42-4dfc-90e0-152fcfd8d4e0] description = "addition" +[bb9f2082-171c-46ad-ad4e-c3f72087c1b5] +description = "addition with a left hand zero" + +[6fa05f17-405a-4742-80ae-5d1a8edb0d5d] +description = "addition with a right hand zero" + [79e49e06-c5ae-40aa-a352-7a3a01f70015] description = "more addition" diff --git a/exercises/practice/wordy/wordy-test.roc b/exercises/practice/wordy/wordy-test.roc index 75ac7e10..d4b30112 100644 --- a/exercises/practice/wordy/wordy-test.roc +++ b/exercises/practice/wordy/wordy-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } @@ -17,11 +17,31 @@ expect result = answer("What is 5?") result == Ok(5) +# just a zero +expect + result = answer("What is 0?") + result == Ok(0) + +# just a negative number +expect + result = answer("What is -123?") + result == Ok(-123) + # addition expect result = answer("What is 1 plus 1?") result == Ok(2) +# addition with a left hand zero +expect + result = answer("What is 0 plus 2?") + result == Ok(2) + +# addition with a right hand zero +expect + result = answer("What is 3 plus 0?") + result == Ok(3) + # more addition expect result = answer("What is 53 plus 2?") diff --git a/exercises/practice/yacht/.meta/template.j2 b/exercises/practice/yacht/.meta/template.j2 index aa104614..a429ba1b 100644 --- a/exercises/practice/yacht/.meta/template.j2 +++ b/exercises/practice/yacht/.meta/template.j2 @@ -7,7 +7,7 @@ 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_snake }} {{ 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 1b86e9c6..f663e7c3 100644 --- a/exercises/practice/yacht/yacht-test.roc +++ b/exercises/practice/yacht/yacht-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", } diff --git a/exercises/practice/zebra-puzzle/.meta/template.j2 b/exercises/practice/zebra-puzzle/.meta/template.j2 index 80259686..70da5c15 100644 --- a/exercises/practice/zebra-puzzle/.meta/template.j2 +++ b/exercises/practice/zebra-puzzle/.meta/template.j2 @@ -8,6 +8,6 @@ import {{ exercise | to_pascal }} exposing [owns_zebra, drinks_water] # {{ case["description"] }} expect result = {{ case["property"] | to_snake }} - result == Ok {{ case["expected"] }} + 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 984e556a..09f924cc 100644 --- a/exercises/practice/zebra-puzzle/zebra-puzzle-test.roc +++ b/exercises/practice/zebra-puzzle/zebra-puzzle-test.roc @@ -1,6 +1,6 @@ # 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 2025-01-04 +# File last updated on 2025-07-26 app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br", }