Skip to content

Commit

Permalink
Upgrade unicode package to 0.1.2 and update reverse-string exercise (#19
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ageron authored Aug 26, 2024
1 parent 1cef92f commit 30b9f38
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config/generator_macros.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ app [main] {
{%- if imports -%}
{%- for name in imports -%},
{% if name == "unicode" -%}
unicode: "https://github.com/roc-lang/unicode/releases/download/0.1.1/-FQDoegpSfMS-a7B0noOnZQs3-A2aq9RSOR5VVLMePg.tar.br"
unicode: "https://github.com/roc-lang/unicode/releases/download/0.1.2/vH5iqn04ShmqP-pNemgF773f86COePSqMWHzVGrAKNo.tar.br"
{%- elif name == "isodate" -%}
isodate: "https://github.com/imclerran/roc-isodate/releases/download/v0.4.1/OQwyjDUYQkmGRiaISkzBcw5dpnbi1OHi8KUDl7NZmC8.tar.br"
{%- endif -%}
Expand Down
10 changes: 3 additions & 7 deletions exercises/practice/reverse-string/.meta/Example.roc
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ import unicode.Grapheme
## To use the `unicode` package, its URL must be added to the app's header.
## Luckily, we've added it for you in reverse-string-test.roc. Take a look!
reverse = \string ->
if string == "" then
""
else
graphemes = string |> Grapheme.split
when graphemes is
Ok gs -> gs |> List.reverse |> Str.joinWith ""
Err _ -> "Unexpected error: could not split the string into graphemes"
when Grapheme.split string is
Ok graphemes -> graphemes |> List.reverse |> Str.joinWith ""
Err _ -> "Unexpected error: could not split the string into graphemes"

## This function reverses the input string, e.g., "hello" -> "olleh". It is
## faster and simpler than the implementation above, plus it does not require an
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/reverse-string/reverse-string-test.roc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# File last updated on 2024-08-25
app [main] {
pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.14.0/dC5ceT962N_4jmoyoffVdphJ_4GlW3YMhAPyGPr-nU0.tar.br",
unicode: "https://github.com/roc-lang/unicode/releases/download/0.1.1/-FQDoegpSfMS-a7B0noOnZQs3-A2aq9RSOR5VVLMePg.tar.br",
unicode: "https://github.com/roc-lang/unicode/releases/download/0.1.2/vH5iqn04ShmqP-pNemgF773f86COePSqMWHzVGrAKNo.tar.br",
}

import pf.Task exposing [Task]
Expand Down

0 comments on commit 30b9f38

Please sign in to comment.