-
Notifications
You must be signed in to change notification settings - Fork 543
Revert removing deprecated exercises #832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
coriolinus
merged 4 commits into
exercism:master
from
coriolinus:revert-remove-deprecated
May 11, 2019
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ed1191f
Revert "two-fer, hexadecimal, nucleotide-codons: Removed the deprecat…
coriolinus 0f94c91
Revert "Forego formerly deprecated exercises"
coriolinus 8a68502
Fix CI complaints about deprecated exercises
coriolinus 92fe95f
regeneate twofer readme (again?)
coriolinus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Generated by Cargo | ||
| # will have compiled files and executables | ||
| /target/ | ||
| **/*.rs.bk | ||
|
|
||
| # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
| # More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock | ||
| Cargo.lock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [package] | ||
| name = "hexadecimal" | ||
| version = "0.0.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # Hexadecimal | ||
|
|
||
| Convert a hexadecimal number, represented as a string (e.g. "10af8c"), to its decimal equivalent using first principles (i.e. no, you may not use built-in or external libraries to accomplish the conversion). | ||
|
|
||
| On the web we use hexadecimal to represent colors, e.g. green: 008000, | ||
| teal: 008080, navy: 000080). | ||
|
|
||
| The program should handle invalid hexadecimal strings. | ||
|
|
||
| ## Rust Installation | ||
|
|
||
| Refer to the [exercism help page][help-page] for Rust installation and learning | ||
| resources. | ||
|
|
||
| ## Writing the Code | ||
|
|
||
| Execute the tests with: | ||
|
|
||
| ```bash | ||
| $ cargo test | ||
| ``` | ||
|
|
||
| All but the first test have been ignored. After you get the first test to | ||
| pass, open the tests source file which is located in the `tests` directory | ||
| and remove the `#[ignore]` flag from the next test and get the tests to pass | ||
| again. Each separate test is a function with `#[test]` flag above it. | ||
| Continue, until you pass every test. | ||
|
|
||
| If you wish to run all tests without editing the tests source file, use: | ||
|
|
||
| ```bash | ||
| $ cargo test -- --ignored | ||
| ``` | ||
|
|
||
| To run a specific test, for example `some_test`, you can use: | ||
|
|
||
| ```bash | ||
| $ cargo test some_test | ||
| ``` | ||
|
|
||
| If the specific test is ignored use: | ||
|
|
||
| ```bash | ||
| $ cargo test some_test -- --ignored | ||
| ``` | ||
|
|
||
| To learn more about Rust tests refer to the [online test documentation][rust-tests] | ||
|
|
||
| Make sure to read the [Modules](https://doc.rust-lang.org/book/ch07-02-modules-and-use-to-control-scope-and-privacy.html) chapter if you | ||
| haven't already, it will help you with organizing your files. | ||
|
|
||
| ## Further improvements | ||
|
|
||
| After you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution. | ||
|
|
||
| To format your solution, inside the solution directory use | ||
|
|
||
| ```bash | ||
| cargo fmt | ||
| ``` | ||
|
|
||
| To see, if your solution contains some common ineffective use cases, inside the solution directory use | ||
|
|
||
| ```bash | ||
| cargo clippy --all-targets | ||
| ``` | ||
|
|
||
| ## Submitting the solution | ||
|
|
||
| Generally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer. | ||
|
|
||
| ## Feedback, Issues, Pull Requests | ||
|
|
||
| The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help! | ||
|
|
||
| If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md). | ||
|
|
||
| [help-page]: https://exercism.io/tracks/rust/learning | ||
| [modules]: https://doc.rust-lang.org/book/ch07-02-modules-and-use-to-control-scope-and-privacy.html | ||
| [cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html | ||
| [rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html | ||
|
|
||
| ## Source | ||
|
|
||
| All of Computer Science [http://www.wolframalpha.com/examples/NumberBases.html](http://www.wolframalpha.com/examples/NumberBases.html) | ||
|
|
||
| ## Submitting Incomplete Solutions | ||
| It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| fn parse_hex_digit(c: char) -> Option<i64> { | ||
| match c { | ||
| '0' => Some(0), | ||
| '1' => Some(1), | ||
| '2' => Some(2), | ||
| '3' => Some(3), | ||
| '4' => Some(4), | ||
| '5' => Some(5), | ||
| '6' => Some(6), | ||
| '7' => Some(7), | ||
| '8' => Some(8), | ||
| '9' => Some(9), | ||
| 'a' => Some(10), | ||
| 'b' => Some(11), | ||
| 'c' => Some(12), | ||
| 'd' => Some(13), | ||
| 'e' => Some(14), | ||
| 'f' => Some(15), | ||
| _ => None, | ||
| } | ||
| } | ||
|
|
||
| pub fn hex_to_int(string: &str) -> Option<i64> { | ||
| let base: i64 = 16; | ||
|
|
||
| string | ||
| .chars() | ||
| .rev() | ||
| .enumerate() | ||
| .fold(Some(0), |acc, (pos, c)| { | ||
| parse_hex_digit(c).and_then(|n| acc.map(|acc| acc + n * base.pow(pos as u32))) | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| fn parse_hex_digit(c: char) -> Option<i64> { | ||
| match c { | ||
| '0' => Some(0), | ||
| '1' => Some(1), | ||
| '2' => Some(2), | ||
| '3' => Some(3), | ||
| '4' => Some(4), | ||
| '5' => Some(5), | ||
| '6' => Some(6), | ||
| '7' => Some(7), | ||
| '8' => Some(8), | ||
| '9' => Some(9), | ||
| 'a' => Some(10), | ||
| 'b' => Some(11), | ||
| 'c' => Some(12), | ||
| 'd' => Some(13), | ||
| 'e' => Some(14), | ||
| 'f' => Some(15), | ||
| _ => None, | ||
| } | ||
| } | ||
|
|
||
| pub fn hex_to_int(string: &str) -> Option<i64> { | ||
| let base: i64 = 16; | ||
|
|
||
| string | ||
| .chars() | ||
| .rev() | ||
| .enumerate() | ||
| .fold(Some(0), |acc, (pos, c)| { | ||
| parse_hex_digit(c).and_then(|n| acc.map(|acc| acc + n * base.pow(pos as u32))) | ||
| }) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| extern crate hexadecimal; | ||
|
|
||
| #[test] | ||
| fn test_hex_1_is_decimal_1() { | ||
| assert_eq!(Some(1), hexadecimal::hex_to_int("1")); | ||
| } | ||
|
|
||
| #[test] | ||
| #[ignore] | ||
| fn test_hex_c_is_decimal_12() { | ||
| assert_eq!(Some(12), hexadecimal::hex_to_int("c")); | ||
| } | ||
|
|
||
| #[test] | ||
| #[ignore] | ||
| fn test_hex_10_is_decimal_16() { | ||
| assert_eq!(Some(16), hexadecimal::hex_to_int("10")); | ||
| } | ||
|
|
||
| #[test] | ||
| #[ignore] | ||
| fn test_hex_af_is_decimal_175() { | ||
| assert_eq!(Some(175), hexadecimal::hex_to_int("af")); | ||
| } | ||
|
|
||
| #[test] | ||
| #[ignore] | ||
| fn test_hex_100_is_decimal_256() { | ||
| assert_eq!(Some(256), hexadecimal::hex_to_int("100")); | ||
| } | ||
|
|
||
| #[test] | ||
| #[ignore] | ||
| fn test_hex_19ace_is_decimal_105166() { | ||
| assert_eq!(Some(105166), hexadecimal::hex_to_int("19ace")); | ||
| } | ||
|
|
||
| #[test] | ||
| #[ignore] | ||
| fn test_invalid_hex_is_none() { | ||
| assert_eq!(None, hexadecimal::hex_to_int("carrot")); | ||
| } | ||
|
|
||
| #[test] | ||
| #[ignore] | ||
| fn test_black() { | ||
| assert_eq!(Some(0), hexadecimal::hex_to_int("0000000")); | ||
| } | ||
|
|
||
| #[test] | ||
| #[ignore] | ||
| fn test_white() { | ||
| assert_eq!(Some(16777215), hexadecimal::hex_to_int("ffffff")); | ||
| } | ||
|
|
||
| #[test] | ||
| #[ignore] | ||
| fn test_yellow() { | ||
| assert_eq!(Some(16776960), hexadecimal::hex_to_int("ffff00")); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Generated by Cargo | ||
| # will have compiled files and executables | ||
| /target/ | ||
| **/*.rs.bk | ||
|
|
||
| # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
| # More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock | ||
| Cargo.lock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [package] | ||
| name = "nucleotide_codons" | ||
| version = "0.1.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| # Nucleotide Codons | ||
|
|
||
| Write a function that returns the name of an amino acid a particular codon, | ||
| possibly using shorthand, encodes for. | ||
|
|
||
| In DNA sequences of 3 nucleotides, called codons, encode for amino acids. Often | ||
| several codons encode for the same amino acid. The International Union of Pure | ||
| and Applied Chemistry developed a shorthand system for designating groups of | ||
| codons that encode for the same amino acid. | ||
|
|
||
| Simply put they've expanded the four letters A, C, G and T with a bunch of | ||
| letters that stand for different possibilities. For example R means A and G. | ||
| So TAR stands for TAA and TAG (think of "TAR" as "TA[AG]" in regex notation). | ||
|
|
||
| Write some code that given a codon, which may use shorthand, returns the | ||
| name of the amino acid that that codon encodes for. You will be given | ||
| a list of non-shorthand-codon/name pairs to base your computation on. | ||
|
|
||
| See: [wikipedia](https://en.wikipedia.org/wiki/DNA_codon_table). | ||
|
|
||
| ## Rust Installation | ||
|
|
||
| Refer to the [exercism help page][help-page] for Rust installation and learning | ||
| resources. | ||
|
|
||
| ## Writing the Code | ||
|
|
||
| Execute the tests with: | ||
|
|
||
| ```bash | ||
| $ cargo test | ||
| ``` | ||
|
|
||
| All but the first test have been ignored. After you get the first test to | ||
| pass, open the tests source file which is located in the `tests` directory | ||
| and remove the `#[ignore]` flag from the next test and get the tests to pass | ||
| again. Each separate test is a function with `#[test]` flag above it. | ||
| Continue, until you pass every test. | ||
|
|
||
| If you wish to run all tests without editing the tests source file, use: | ||
|
|
||
| ```bash | ||
| $ cargo test -- --ignored | ||
| ``` | ||
|
|
||
| To run a specific test, for example `some_test`, you can use: | ||
|
|
||
| ```bash | ||
| $ cargo test some_test | ||
| ``` | ||
|
|
||
| If the specific test is ignored use: | ||
|
|
||
| ```bash | ||
| $ cargo test some_test -- --ignored | ||
| ``` | ||
|
|
||
| To learn more about Rust tests refer to the [online test documentation][rust-tests] | ||
|
|
||
| Make sure to read the [Modules](https://doc.rust-lang.org/book/ch07-02-modules-and-use-to-control-scope-and-privacy.html) chapter if you | ||
| haven't already, it will help you with organizing your files. | ||
|
|
||
| ## Further improvements | ||
|
|
||
| After you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution. | ||
|
|
||
| To format your solution, inside the solution directory use | ||
|
|
||
| ```bash | ||
| cargo fmt | ||
| ``` | ||
|
|
||
| To see, if your solution contains some common ineffective use cases, inside the solution directory use | ||
|
|
||
| ```bash | ||
| cargo clippy --all-targets | ||
| ``` | ||
|
|
||
| ## Submitting the solution | ||
|
|
||
| Generally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer. | ||
|
|
||
| ## Feedback, Issues, Pull Requests | ||
|
|
||
| The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help! | ||
|
|
||
| If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md). | ||
|
|
||
| [help-page]: https://exercism.io/tracks/rust/learning | ||
| [modules]: https://doc.rust-lang.org/book/ch07-02-modules-and-use-to-control-scope-and-privacy.html | ||
| [cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html | ||
| [rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html | ||
|
|
||
| ## Submitting Incomplete Solutions | ||
| It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although it does not hurt to have it since it's deprecated, this lib.rs doesn't necessarily need to have a complete implementation (and we would want it not to have one if it were non-deprecated)