From 552c6bec1d787d84bff016fc22279d15c6b9b104 Mon Sep 17 00:00:00 2001 From: Jon Calder Date: Fri, 8 Feb 2019 00:13:40 +0200 Subject: [PATCH 1/5] Add two-fer exercise, update config.json and run configlet --- config.json | 14 +++++++-- exercises/acronym/README.md | 2 +- exercises/bob/README.md | 2 -- exercises/crypto-square/README.md | 51 +++++++++++++++---------------- exercises/hamming/README.md | 7 ++--- exercises/sieve/README.md | 8 ++--- exercises/two-fer/README.md | 29 ++++++++++++++++++ exercises/two-fer/example.R | 3 ++ exercises/two-fer/test_two-fer.R | 18 +++++++++++ exercises/two-fer/two-fer.R | 3 ++ 10 files changed, 96 insertions(+), 41 deletions(-) create mode 100644 exercises/two-fer/README.md create mode 100644 exercises/two-fer/example.R create mode 100644 exercises/two-fer/test_two-fer.R create mode 100644 exercises/two-fer/two-fer.R diff --git a/config.json b/config.json index 00a7880a..96ab6b36 100644 --- a/config.json +++ b/config.json @@ -15,6 +15,16 @@ "text_formatting" ] }, + { + "slug": "two-fer", + "uuid": "34f6e27c-9f14-4311-bc71-1f24958795a2", + "core": true, + "unlocked_by": null, + "difficulty": 1, + "topics": [ + "strings" + ] + }, { "slug": "leap", "uuid": "4be11d9f-db6a-4edd-af35-7d33d2dc9c0f", @@ -368,8 +378,8 @@ "unlocked_by": null, "difficulty": 1, "topics": [ - "strings", - "filtering" + "filtering", + "strings" ] } ] diff --git a/exercises/acronym/README.md b/exercises/acronym/README.md index 9f15c706..aeca2acb 100644 --- a/exercises/acronym/README.md +++ b/exercises/acronym/README.md @@ -8,7 +8,7 @@ Help generate some jargon by writing a program that converts a long name like Portable Network Graphics to its acronym (PNG). ## Installation -See [this guide](https://github.com/exercism/xr/blob/master/docs/INSTALLATION.md) for instructions on how to setup your local R environment. +See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. ## How to implement your solution In each problem folder, there is a file named `.R` containing a function that returns a `NULL` value. Place your implementation inside the body of the function. diff --git a/exercises/bob/README.md b/exercises/bob/README.md index 82d56be3..68277c47 100644 --- a/exercises/bob/README.md +++ b/exercises/bob/README.md @@ -13,8 +13,6 @@ anything. He answers 'Whatever.' to anything else. -Bob's conversational partner is a purist when it comes to written communication and always follows normal rules regarding sentence punctuation in English. - ## Installation See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. diff --git a/exercises/crypto-square/README.md b/exercises/crypto-square/README.md index 57532873..cdbbc685 100644 --- a/exercises/crypto-square/README.md +++ b/exercises/crypto-square/README.md @@ -12,15 +12,11 @@ regarded as forming a rectangle when printed with intervening newlines. For example, the sentence -```text -"If man was meant to stay on the ground, god would have given us roots." -``` +> If man was meant to stay on the ground, god would have given us roots. is normalized to: -```text -"ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots" -``` +> ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots The plaintext should be organized in to a rectangle. The size of the rectangle (`r x c`) should be decided by the length of the message, @@ -31,13 +27,13 @@ Our normalized text is 54 characters long, dictating a rectangle with `c = 8` and `r = 7`: ```text -"ifmanwas" -"meanttos" -"tayonthe" -"groundgo" -"dwouldha" -"vegivenu" -"sroots " +ifmanwas +meanttos +tayonthe +groundgo +dwouldha +vegivenu +sroots ``` The coded message is obtained by reading down the columns going left to @@ -46,30 +42,31 @@ right. The message above is coded as: ```text -"imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau" +imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau ``` -Output the encoded text in chunks that fill perfect rectangles `(r X c)`, -with `c` chunks of `r` length, separated by spaces. For phrases that are -`n` characters short of the perfect rectangle, pad each of the last `n` -chunks with a single trailing space. +Output the encoded text in chunks. Phrases that fill perfect rectangles +`(r X c)` should be output `c` chunks of `r` length, separated by spaces. +Phrases that do not fill perfect rectangles will have `n` empty spaces. +Those spaces should be distributed evenly, added to the end of the last +`n` chunks. ```text -"imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau " +imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau ``` Notice that were we to stack these, we could visually decode the cyphertext back in to the original message: ```text -"imtgdvs" -"fearwer" -"mayoogo" -"anouuio" -"ntnnlvt" -"wttddes" -"aohghn " -"sseoau " +imtgdvs +fearwer +mayoogo +anouuio +ntnnlvt +wttddes +aohghn +sseoau ``` ## Installation diff --git a/exercises/hamming/README.md b/exercises/hamming/README.md index 2c1e77e4..2fea9109 100644 --- a/exercises/hamming/README.md +++ b/exercises/hamming/README.md @@ -31,10 +31,9 @@ The Hamming distance between these two DNA strands is 7. # Implementation notes -The Hamming distance is only defined for sequences of equal length, so -an attempt to calculate it between sequences of different lengths should -not work. The general handling of this situation (e.g., raising an -exception vs returning a special value) may differ between languages. +The Hamming distance is only defined for sequences of equal length. This means +that based on the definition, each language could deal with getting sequences +of equal length differently. ## Installation See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. diff --git a/exercises/sieve/README.md b/exercises/sieve/README.md index c46c21ba..a2c93297 100644 --- a/exercises/sieve/README.md +++ b/exercises/sieve/README.md @@ -5,8 +5,8 @@ number. The Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to any given limit. It does so by iteratively marking as -composite (i.e. not prime) the multiples of each prime, starting with the -multiples of 2. It does not use any division or remainder operation. +composite (i.e. not prime) the multiples of each prime, +starting with the multiples of 2. Create your range, starting at two and continuing up to and including the given limit. (i.e. [2, limit]) @@ -25,9 +25,7 @@ https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes Notice that this is a very specific algorithm, and the tests don't check that you've implemented the algorithm, only that you've come up with the -correct list of primes. A good first test is to check that you do not use -division or remainder operations (div, /, mod or % depending on the -language). +correct list of primes. ## Installation See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. diff --git a/exercises/two-fer/README.md b/exercises/two-fer/README.md new file mode 100644 index 00000000..8c5af4ee --- /dev/null +++ b/exercises/two-fer/README.md @@ -0,0 +1,29 @@ +# Two Fer + +`Two-fer` or `2-fer` is short for two for one. One for you and one for me. + +```text +"One for X, one for me." +``` + +When X is a name or "you". + +If the given name is "Alice", the result should be "One for Alice, one for me." +If no name is given, the result should be "One for you, one for me." + + +## Installation +See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. + +## How to implement your solution +In each problem folder, there is a file named `.R` containing a function that returns a `NULL` value. Place your implementation inside the body of the function. + +## How to run tests +Inside of RStudio, simply execute the `test_.R` script. This can be conveniently done with [testthat's `auto_test` function](https://www.rdocumentation.org/packages/testthat/topics/auto_test). Because exercism code and tests are in the same folder, use this same path for both `code_path` and `test_path` parameters. On the command-line, you can also run `Rscript test_.R`. + +## Source + +[https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer) + +## Submitting Incomplete Solutions +It's possible to submit an incomplete solution so you can see how others have completed the exercise. diff --git a/exercises/two-fer/example.R b/exercises/two-fer/example.R new file mode 100644 index 00000000..fab4af99 --- /dev/null +++ b/exercises/two-fer/example.R @@ -0,0 +1,3 @@ +two_fer <- function(input = "you") { + sprintf("One for %s, one for me.", input) +} diff --git a/exercises/two-fer/test_two-fer.R b/exercises/two-fer/test_two-fer.R new file mode 100644 index 00000000..3220d7db --- /dev/null +++ b/exercises/two-fer/test_two-fer.R @@ -0,0 +1,18 @@ +source("./two-fer.R") +library(testthat) + +context("two-fer") + +test_that("Abbreviate a phrase", { + expect_equal(two_fer(), "One for you, one for me.") +}) + +test_that("Abbreviate a phrase", { + expect_equal(two_fer("Alice"), "One for Alice, one for me.") +}) + +test_that("Abbreviate a phrase", { + expect_equal(two_fer("Bob"), "One for Bob, one for me.") +}) + +message("All tests passed for exercise: two-fer") \ No newline at end of file diff --git a/exercises/two-fer/two-fer.R b/exercises/two-fer/two-fer.R new file mode 100644 index 00000000..b99d253f --- /dev/null +++ b/exercises/two-fer/two-fer.R @@ -0,0 +1,3 @@ +two_fer <- function(input) { + +} From d0b04a1175a13695293d0791f1e4a346fedca1ed Mon Sep 17 00:00:00 2001 From: Katrin Leinweber <9948149+katrinleinweber@users.noreply.github.com> Date: Fri, 8 Feb 2019 18:07:48 +0100 Subject: [PATCH 2/5] Add newline to EOF --- exercises/two-fer/test_two-fer.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/two-fer/test_two-fer.R b/exercises/two-fer/test_two-fer.R index 3220d7db..7d8de0a4 100644 --- a/exercises/two-fer/test_two-fer.R +++ b/exercises/two-fer/test_two-fer.R @@ -15,4 +15,4 @@ test_that("Abbreviate a phrase", { expect_equal(two_fer("Bob"), "One for Bob, one for me.") }) -message("All tests passed for exercise: two-fer") \ No newline at end of file +message("All tests passed for exercise: two-fer") From 85549967ab38d7acf81e39fec78c3fe615e43e20 Mon Sep 17 00:00:00 2001 From: Katrin Leinweber <9948149+katrinleinweber@users.noreply.github.com> Date: Fri, 8 Feb 2019 18:24:18 +0100 Subject: [PATCH 3/5] Revert d0b04a11 & 552c6bec This reverts commits "Add newline to EOF" & "Add two-fer exercise, update config.json and run configlet" --- config.json | 14 ++------- exercises/acronym/README.md | 2 +- exercises/bob/README.md | 2 ++ exercises/crypto-square/README.md | 51 ++++++++++++++++--------------- exercises/hamming/README.md | 7 +++-- exercises/sieve/README.md | 8 +++-- exercises/two-fer/README.md | 29 ------------------ exercises/two-fer/example.R | 3 -- exercises/two-fer/test_two-fer.R | 18 ----------- exercises/two-fer/two-fer.R | 3 -- 10 files changed, 41 insertions(+), 96 deletions(-) delete mode 100644 exercises/two-fer/README.md delete mode 100644 exercises/two-fer/example.R delete mode 100644 exercises/two-fer/test_two-fer.R delete mode 100644 exercises/two-fer/two-fer.R diff --git a/config.json b/config.json index 96ab6b36..00a7880a 100644 --- a/config.json +++ b/config.json @@ -15,16 +15,6 @@ "text_formatting" ] }, - { - "slug": "two-fer", - "uuid": "34f6e27c-9f14-4311-bc71-1f24958795a2", - "core": true, - "unlocked_by": null, - "difficulty": 1, - "topics": [ - "strings" - ] - }, { "slug": "leap", "uuid": "4be11d9f-db6a-4edd-af35-7d33d2dc9c0f", @@ -378,8 +368,8 @@ "unlocked_by": null, "difficulty": 1, "topics": [ - "filtering", - "strings" + "strings", + "filtering" ] } ] diff --git a/exercises/acronym/README.md b/exercises/acronym/README.md index aeca2acb..9f15c706 100644 --- a/exercises/acronym/README.md +++ b/exercises/acronym/README.md @@ -8,7 +8,7 @@ Help generate some jargon by writing a program that converts a long name like Portable Network Graphics to its acronym (PNG). ## Installation -See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. +See [this guide](https://github.com/exercism/xr/blob/master/docs/INSTALLATION.md) for instructions on how to setup your local R environment. ## How to implement your solution In each problem folder, there is a file named `.R` containing a function that returns a `NULL` value. Place your implementation inside the body of the function. diff --git a/exercises/bob/README.md b/exercises/bob/README.md index 68277c47..82d56be3 100644 --- a/exercises/bob/README.md +++ b/exercises/bob/README.md @@ -13,6 +13,8 @@ anything. He answers 'Whatever.' to anything else. +Bob's conversational partner is a purist when it comes to written communication and always follows normal rules regarding sentence punctuation in English. + ## Installation See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. diff --git a/exercises/crypto-square/README.md b/exercises/crypto-square/README.md index cdbbc685..57532873 100644 --- a/exercises/crypto-square/README.md +++ b/exercises/crypto-square/README.md @@ -12,11 +12,15 @@ regarded as forming a rectangle when printed with intervening newlines. For example, the sentence -> If man was meant to stay on the ground, god would have given us roots. +```text +"If man was meant to stay on the ground, god would have given us roots." +``` is normalized to: -> ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots +```text +"ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots" +``` The plaintext should be organized in to a rectangle. The size of the rectangle (`r x c`) should be decided by the length of the message, @@ -27,13 +31,13 @@ Our normalized text is 54 characters long, dictating a rectangle with `c = 8` and `r = 7`: ```text -ifmanwas -meanttos -tayonthe -groundgo -dwouldha -vegivenu -sroots +"ifmanwas" +"meanttos" +"tayonthe" +"groundgo" +"dwouldha" +"vegivenu" +"sroots " ``` The coded message is obtained by reading down the columns going left to @@ -42,31 +46,30 @@ right. The message above is coded as: ```text -imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau +"imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau" ``` -Output the encoded text in chunks. Phrases that fill perfect rectangles -`(r X c)` should be output `c` chunks of `r` length, separated by spaces. -Phrases that do not fill perfect rectangles will have `n` empty spaces. -Those spaces should be distributed evenly, added to the end of the last -`n` chunks. +Output the encoded text in chunks that fill perfect rectangles `(r X c)`, +with `c` chunks of `r` length, separated by spaces. For phrases that are +`n` characters short of the perfect rectangle, pad each of the last `n` +chunks with a single trailing space. ```text -imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau +"imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau " ``` Notice that were we to stack these, we could visually decode the cyphertext back in to the original message: ```text -imtgdvs -fearwer -mayoogo -anouuio -ntnnlvt -wttddes -aohghn -sseoau +"imtgdvs" +"fearwer" +"mayoogo" +"anouuio" +"ntnnlvt" +"wttddes" +"aohghn " +"sseoau " ``` ## Installation diff --git a/exercises/hamming/README.md b/exercises/hamming/README.md index 2fea9109..2c1e77e4 100644 --- a/exercises/hamming/README.md +++ b/exercises/hamming/README.md @@ -31,9 +31,10 @@ The Hamming distance between these two DNA strands is 7. # Implementation notes -The Hamming distance is only defined for sequences of equal length. This means -that based on the definition, each language could deal with getting sequences -of equal length differently. +The Hamming distance is only defined for sequences of equal length, so +an attempt to calculate it between sequences of different lengths should +not work. The general handling of this situation (e.g., raising an +exception vs returning a special value) may differ between languages. ## Installation See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. diff --git a/exercises/sieve/README.md b/exercises/sieve/README.md index a2c93297..c46c21ba 100644 --- a/exercises/sieve/README.md +++ b/exercises/sieve/README.md @@ -5,8 +5,8 @@ number. The Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to any given limit. It does so by iteratively marking as -composite (i.e. not prime) the multiples of each prime, -starting with the multiples of 2. +composite (i.e. not prime) the multiples of each prime, starting with the +multiples of 2. It does not use any division or remainder operation. Create your range, starting at two and continuing up to and including the given limit. (i.e. [2, limit]) @@ -25,7 +25,9 @@ https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes Notice that this is a very specific algorithm, and the tests don't check that you've implemented the algorithm, only that you've come up with the -correct list of primes. +correct list of primes. A good first test is to check that you do not use +division or remainder operations (div, /, mod or % depending on the +language). ## Installation See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. diff --git a/exercises/two-fer/README.md b/exercises/two-fer/README.md deleted file mode 100644 index 8c5af4ee..00000000 --- a/exercises/two-fer/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Two Fer - -`Two-fer` or `2-fer` is short for two for one. One for you and one for me. - -```text -"One for X, one for me." -``` - -When X is a name or "you". - -If the given name is "Alice", the result should be "One for Alice, one for me." -If no name is given, the result should be "One for you, one for me." - - -## Installation -See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. - -## How to implement your solution -In each problem folder, there is a file named `.R` containing a function that returns a `NULL` value. Place your implementation inside the body of the function. - -## How to run tests -Inside of RStudio, simply execute the `test_.R` script. This can be conveniently done with [testthat's `auto_test` function](https://www.rdocumentation.org/packages/testthat/topics/auto_test). Because exercism code and tests are in the same folder, use this same path for both `code_path` and `test_path` parameters. On the command-line, you can also run `Rscript test_.R`. - -## Source - -[https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer) - -## Submitting Incomplete Solutions -It's possible to submit an incomplete solution so you can see how others have completed the exercise. diff --git a/exercises/two-fer/example.R b/exercises/two-fer/example.R deleted file mode 100644 index fab4af99..00000000 --- a/exercises/two-fer/example.R +++ /dev/null @@ -1,3 +0,0 @@ -two_fer <- function(input = "you") { - sprintf("One for %s, one for me.", input) -} diff --git a/exercises/two-fer/test_two-fer.R b/exercises/two-fer/test_two-fer.R deleted file mode 100644 index 7d8de0a4..00000000 --- a/exercises/two-fer/test_two-fer.R +++ /dev/null @@ -1,18 +0,0 @@ -source("./two-fer.R") -library(testthat) - -context("two-fer") - -test_that("Abbreviate a phrase", { - expect_equal(two_fer(), "One for you, one for me.") -}) - -test_that("Abbreviate a phrase", { - expect_equal(two_fer("Alice"), "One for Alice, one for me.") -}) - -test_that("Abbreviate a phrase", { - expect_equal(two_fer("Bob"), "One for Bob, one for me.") -}) - -message("All tests passed for exercise: two-fer") diff --git a/exercises/two-fer/two-fer.R b/exercises/two-fer/two-fer.R deleted file mode 100644 index b99d253f..00000000 --- a/exercises/two-fer/two-fer.R +++ /dev/null @@ -1,3 +0,0 @@ -two_fer <- function(input) { - -} From a1b0daba97361900e89e60570a98d7a5f1ee8397 Mon Sep 17 00:00:00 2001 From: Jon Calder Date: Fri, 8 Feb 2019 18:20:19 +0100 Subject: [PATCH 4/5] Add two-fer exercise --- config.json | 10 ++++++++++ exercises/two-fer/README.md | 29 +++++++++++++++++++++++++++++ exercises/two-fer/example.R | 3 +++ exercises/two-fer/test_two-fer.R | 18 ++++++++++++++++++ exercises/two-fer/two-fer.R | 3 +++ 5 files changed, 63 insertions(+) create mode 100644 exercises/two-fer/README.md create mode 100644 exercises/two-fer/example.R create mode 100644 exercises/two-fer/test_two-fer.R create mode 100644 exercises/two-fer/two-fer.R diff --git a/config.json b/config.json index 00a7880a..f2017125 100644 --- a/config.json +++ b/config.json @@ -15,6 +15,16 @@ "text_formatting" ] }, + { + "slug": "two-fer", + "uuid": "34f6e27c-9f14-4311-bc71-1f24958795a2", + "core": true, + "unlocked_by": null, + "difficulty": 1, + "topics": [ + "strings" + ] + }, { "slug": "leap", "uuid": "4be11d9f-db6a-4edd-af35-7d33d2dc9c0f", diff --git a/exercises/two-fer/README.md b/exercises/two-fer/README.md new file mode 100644 index 00000000..8c5af4ee --- /dev/null +++ b/exercises/two-fer/README.md @@ -0,0 +1,29 @@ +# Two Fer + +`Two-fer` or `2-fer` is short for two for one. One for you and one for me. + +```text +"One for X, one for me." +``` + +When X is a name or "you". + +If the given name is "Alice", the result should be "One for Alice, one for me." +If no name is given, the result should be "One for you, one for me." + + +## Installation +See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. + +## How to implement your solution +In each problem folder, there is a file named `.R` containing a function that returns a `NULL` value. Place your implementation inside the body of the function. + +## How to run tests +Inside of RStudio, simply execute the `test_.R` script. This can be conveniently done with [testthat's `auto_test` function](https://www.rdocumentation.org/packages/testthat/topics/auto_test). Because exercism code and tests are in the same folder, use this same path for both `code_path` and `test_path` parameters. On the command-line, you can also run `Rscript test_.R`. + +## Source + +[https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer) + +## Submitting Incomplete Solutions +It's possible to submit an incomplete solution so you can see how others have completed the exercise. diff --git a/exercises/two-fer/example.R b/exercises/two-fer/example.R new file mode 100644 index 00000000..fab4af99 --- /dev/null +++ b/exercises/two-fer/example.R @@ -0,0 +1,3 @@ +two_fer <- function(input = "you") { + sprintf("One for %s, one for me.", input) +} diff --git a/exercises/two-fer/test_two-fer.R b/exercises/two-fer/test_two-fer.R new file mode 100644 index 00000000..7d8de0a4 --- /dev/null +++ b/exercises/two-fer/test_two-fer.R @@ -0,0 +1,18 @@ +source("./two-fer.R") +library(testthat) + +context("two-fer") + +test_that("Abbreviate a phrase", { + expect_equal(two_fer(), "One for you, one for me.") +}) + +test_that("Abbreviate a phrase", { + expect_equal(two_fer("Alice"), "One for Alice, one for me.") +}) + +test_that("Abbreviate a phrase", { + expect_equal(two_fer("Bob"), "One for Bob, one for me.") +}) + +message("All tests passed for exercise: two-fer") diff --git a/exercises/two-fer/two-fer.R b/exercises/two-fer/two-fer.R new file mode 100644 index 00000000..b99d253f --- /dev/null +++ b/exercises/two-fer/two-fer.R @@ -0,0 +1,3 @@ +two_fer <- function(input) { + +} From bd3f28f942fa75185a73773b356636d6c5b13d59 Mon Sep 17 00:00:00 2001 From: Jon Calder Date: Fri, 8 Feb 2019 18:25:03 +0100 Subject: [PATCH 5/5] Run configlet --- config.json | 4 +-- exercises/acronym/README.md | 2 +- exercises/bob/README.md | 2 -- exercises/crypto-square/README.md | 51 +++++++++++++++---------------- exercises/hamming/README.md | 7 ++--- exercises/sieve/README.md | 8 ++--- 6 files changed, 33 insertions(+), 41 deletions(-) diff --git a/config.json b/config.json index f2017125..96ab6b36 100644 --- a/config.json +++ b/config.json @@ -378,8 +378,8 @@ "unlocked_by": null, "difficulty": 1, "topics": [ - "strings", - "filtering" + "filtering", + "strings" ] } ] diff --git a/exercises/acronym/README.md b/exercises/acronym/README.md index 9f15c706..aeca2acb 100644 --- a/exercises/acronym/README.md +++ b/exercises/acronym/README.md @@ -8,7 +8,7 @@ Help generate some jargon by writing a program that converts a long name like Portable Network Graphics to its acronym (PNG). ## Installation -See [this guide](https://github.com/exercism/xr/blob/master/docs/INSTALLATION.md) for instructions on how to setup your local R environment. +See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. ## How to implement your solution In each problem folder, there is a file named `.R` containing a function that returns a `NULL` value. Place your implementation inside the body of the function. diff --git a/exercises/bob/README.md b/exercises/bob/README.md index 82d56be3..68277c47 100644 --- a/exercises/bob/README.md +++ b/exercises/bob/README.md @@ -13,8 +13,6 @@ anything. He answers 'Whatever.' to anything else. -Bob's conversational partner is a purist when it comes to written communication and always follows normal rules regarding sentence punctuation in English. - ## Installation See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. diff --git a/exercises/crypto-square/README.md b/exercises/crypto-square/README.md index 57532873..cdbbc685 100644 --- a/exercises/crypto-square/README.md +++ b/exercises/crypto-square/README.md @@ -12,15 +12,11 @@ regarded as forming a rectangle when printed with intervening newlines. For example, the sentence -```text -"If man was meant to stay on the ground, god would have given us roots." -``` +> If man was meant to stay on the ground, god would have given us roots. is normalized to: -```text -"ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots" -``` +> ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots The plaintext should be organized in to a rectangle. The size of the rectangle (`r x c`) should be decided by the length of the message, @@ -31,13 +27,13 @@ Our normalized text is 54 characters long, dictating a rectangle with `c = 8` and `r = 7`: ```text -"ifmanwas" -"meanttos" -"tayonthe" -"groundgo" -"dwouldha" -"vegivenu" -"sroots " +ifmanwas +meanttos +tayonthe +groundgo +dwouldha +vegivenu +sroots ``` The coded message is obtained by reading down the columns going left to @@ -46,30 +42,31 @@ right. The message above is coded as: ```text -"imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau" +imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau ``` -Output the encoded text in chunks that fill perfect rectangles `(r X c)`, -with `c` chunks of `r` length, separated by spaces. For phrases that are -`n` characters short of the perfect rectangle, pad each of the last `n` -chunks with a single trailing space. +Output the encoded text in chunks. Phrases that fill perfect rectangles +`(r X c)` should be output `c` chunks of `r` length, separated by spaces. +Phrases that do not fill perfect rectangles will have `n` empty spaces. +Those spaces should be distributed evenly, added to the end of the last +`n` chunks. ```text -"imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau " +imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau ``` Notice that were we to stack these, we could visually decode the cyphertext back in to the original message: ```text -"imtgdvs" -"fearwer" -"mayoogo" -"anouuio" -"ntnnlvt" -"wttddes" -"aohghn " -"sseoau " +imtgdvs +fearwer +mayoogo +anouuio +ntnnlvt +wttddes +aohghn +sseoau ``` ## Installation diff --git a/exercises/hamming/README.md b/exercises/hamming/README.md index 2c1e77e4..2fea9109 100644 --- a/exercises/hamming/README.md +++ b/exercises/hamming/README.md @@ -31,10 +31,9 @@ The Hamming distance between these two DNA strands is 7. # Implementation notes -The Hamming distance is only defined for sequences of equal length, so -an attempt to calculate it between sequences of different lengths should -not work. The general handling of this situation (e.g., raising an -exception vs returning a special value) may differ between languages. +The Hamming distance is only defined for sequences of equal length. This means +that based on the definition, each language could deal with getting sequences +of equal length differently. ## Installation See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment. diff --git a/exercises/sieve/README.md b/exercises/sieve/README.md index c46c21ba..a2c93297 100644 --- a/exercises/sieve/README.md +++ b/exercises/sieve/README.md @@ -5,8 +5,8 @@ number. The Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to any given limit. It does so by iteratively marking as -composite (i.e. not prime) the multiples of each prime, starting with the -multiples of 2. It does not use any division or remainder operation. +composite (i.e. not prime) the multiples of each prime, +starting with the multiples of 2. Create your range, starting at two and continuing up to and including the given limit. (i.e. [2, limit]) @@ -25,9 +25,7 @@ https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes Notice that this is a very specific algorithm, and the tests don't check that you've implemented the algorithm, only that you've come up with the -correct list of primes. A good first test is to check that you do not use -division or remainder operations (div, /, mod or % depending on the -language). +correct list of primes. ## Installation See [this guide](https://exercism.io/tracks/r/installation) for instructions on how to setup your local R environment.