diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9386b8d..46d7e08 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,6 +1,9 @@ # Code owners .github/CODEOWNERS @exercism/maintainers-admin +# The code sample shown in the code check when people sign up to Exercism +docs/SIGN_UP_SNIPPET.txt @exercism/maintainers-admin + # Changes to `fetch-configlet` should be made in the `exercism/configlet` repo bin/fetch-configlet @exercism/maintainers-admin bin/fetch-configlet.ps1 @exercism/maintainers-admin diff --git a/docs/SIGN_UP_SNIPPET.txt b/docs/SIGN_UP_SNIPPET.txt new file mode 100644 index 0000000..73b9c1e --- /dev/null +++ b/docs/SIGN_UP_SNIPPET.txt @@ -0,0 +1,17 @@ +let mostCommonWord = text => { + let counts = Dict.make() + let best = ref("") + let bestCount = ref(0) + text + ->String.toLowerCase + ->String.split(" ") + ->Array.forEach(word => { + let count = counts->Dict.get(word)->Option.getOr(0) + 1 + counts->Dict.set(word, count) + if count > bestCount.contents { + best := word + bestCount := count + } + }) + `"${best.contents}" appears ${bestCount.contents->Int.toString} times` +}