Skip to content

Commit

Permalink
Fix reverse-string code format (#16)
Browse files Browse the repository at this point in the history
* Clarify message in case of Grapheme.split error

* Run `roc format` on reverse-string code
  • Loading branch information
ageron authored Aug 26, 2024
1 parent 20e01db commit 32c5767
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion exercises/practice/reverse-string/.meta/Example.roc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ reverse = \string ->
Ok gs -> gs |> 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
## external package, but it is only guaranteed to work on ASCII strings.
Expand Down
6 changes: 3 additions & 3 deletions exercises/practice/reverse-string/ReverseString.roc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module [reverse]
reverse = \string ->
crash "Please implement the `reverse` function"

# HINT: we have added the `unicode` package to the app's header in
# reverse-string-test.roc, so you can use it here if you need to.
# For example, you could use unicode.Grapheme, just sayin'.
# HINT: we have added the `unicode` package to the app's header in
# reverse-string-test.roc, so you can use it here if you need to.
# For example, you could use unicode.Grapheme, just sayin'.
3 changes: 1 addition & 2 deletions 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.1/-FQDoegpSfMS-a7B0noOnZQs3-A2aq9RSOR5VVLMePg.tar.br",
}

import pf.Task exposing [Task]
Expand Down Expand Up @@ -40,4 +40,3 @@ expect reverse "Würstchenstand" == "dnatsnehctsrüW"
# grapheme clusters
expect reverse "ผู้เขียนโปรแกรม" == "มรกแรปโนยขีเผู้"


0 comments on commit 32c5767

Please sign in to comment.