-
-
Notifications
You must be signed in to change notification settings - Fork 544
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #690 from exercism/generate-readme
Generate static exercise README templates
- Loading branch information
Showing
88 changed files
with
5,774 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,16 @@ | ||
# {{ .Spec.Name }} | ||
|
||
{{ .Spec.Description -}} | ||
{{- with .Hints }} | ||
{{ . }} | ||
{{ end }} | ||
{{- with .TrackInsert }} | ||
{{ . }} | ||
{{ end }} | ||
{{- with .Spec.Credits -}} | ||
## Source | ||
|
||
{{ . }} | ||
{{ end }} | ||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains 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,76 @@ | ||
# Accumulate | ||
|
||
Implement the `accumulate` operation, which, given a collection and an | ||
operation to perform on each element of the collection, returns a new | ||
collection containing the result of applying that operation to each element of | ||
the input collection. | ||
|
||
Given the collection of numbers: | ||
|
||
- 1, 2, 3, 4, 5 | ||
|
||
And the operation: | ||
|
||
- square a number (`x => x * x`) | ||
|
||
Your code should be able to produce the collection of squares: | ||
|
||
- 1, 4, 9, 16, 25 | ||
|
||
Check out the test suite to see the expected function signature. | ||
|
||
## Restrictions | ||
|
||
Keep your hands off that collect/map/fmap/whatchamacallit functionality | ||
provided by your standard library! | ||
Solve this one yourself using other basic tools instead. | ||
|
||
Lisp specific: it's perfectly fine to use `MAPCAR` or the equivalent, | ||
as this is idiomatic Lisp, not a library function. | ||
|
||
## Advanced | ||
|
||
It is typical to call [#to_enum](http://ruby-doc.org/core-2.3.1/Object.html#method-i-to_enum) when defining methods for a generic Enumerable, in case no block is passed. | ||
|
||
Here is an additional test you could add: | ||
|
||
```ruby | ||
def test_no_block_is_passed | ||
skip | ||
result = [1, 2, 3].accumulate | ||
assert_instance_of Enumerator, result | ||
end | ||
``` | ||
|
||
|
||
* * * * | ||
|
||
For installation and learning resources, refer to the | ||
[exercism help page](http://exercism.io/languages/ruby). | ||
|
||
For running the tests provided, you will need the Minitest gem. Open a | ||
terminal window and run the following command to install minitest: | ||
|
||
gem install minitest | ||
|
||
If you would like color output, you can `require 'minitest/pride'` in | ||
the test file, or note the alternative instruction, below, for running | ||
the test file. | ||
|
||
In order to run the test, you can run the test file from the exercise | ||
directory. For example, if the test suite is called | ||
`hello_world_test.rb`, you can run the following command: | ||
|
||
ruby hello_world_test.rb | ||
|
||
To include color from the command line: | ||
|
||
ruby -r minitest/pride hello_world_test.rb | ||
|
||
|
||
## Source | ||
|
||
Conversation with James Edward Gray II [https://twitter.com/jeg2](https://twitter.com/jeg2) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains 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,41 @@ | ||
# Acronym | ||
|
||
Convert a phrase to its acronym. | ||
|
||
Techies love their TLA (Three Letter Acronyms)! | ||
|
||
Help generate some jargon by writing a program that converts a long name | ||
like Portable Network Graphics to its acronym (PNG). | ||
|
||
|
||
* * * * | ||
|
||
For installation and learning resources, refer to the | ||
[exercism help page](http://exercism.io/languages/ruby). | ||
|
||
For running the tests provided, you will need the Minitest gem. Open a | ||
terminal window and run the following command to install minitest: | ||
|
||
gem install minitest | ||
|
||
If you would like color output, you can `require 'minitest/pride'` in | ||
the test file, or note the alternative instruction, below, for running | ||
the test file. | ||
|
||
In order to run the test, you can run the test file from the exercise | ||
directory. For example, if the test suite is called | ||
`hello_world_test.rb`, you can run the following command: | ||
|
||
ruby hello_world_test.rb | ||
|
||
To include color from the command line: | ||
|
||
ruby -r minitest/pride hello_world_test.rb | ||
|
||
|
||
## Source | ||
|
||
Julien Vanier [https://github.com/monkbroc](https://github.com/monkbroc) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains 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,61 @@ | ||
# All Your Base | ||
|
||
Convert a number, represented as a sequence of digits in one base, to any other base. | ||
|
||
Implement general base conversion. Given a number in base **a**, | ||
represented as a sequence of digits, convert it to base **b**. | ||
|
||
## Note | ||
- Try to implement the conversion yourself. | ||
Do not use something else to perform the conversion for you. | ||
|
||
## About [Positional Notation](https://en.wikipedia.org/wiki/Positional_notation) | ||
|
||
In positional notation, a number in base **b** can be understood as a linear | ||
combination of powers of **b**. | ||
|
||
The number 42, *in base 10*, means: | ||
|
||
(4 * 10^1) + (2 * 10^0) | ||
|
||
The number 101010, *in base 2*, means: | ||
|
||
(1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0) | ||
|
||
The number 1120, *in base 3*, means: | ||
|
||
(1 * 3^3) + (1 * 3^2) + (2 * 3^1) + (0 * 3^0) | ||
|
||
I think you got the idea! | ||
|
||
|
||
*Yes. Those three numbers above are exactly the same. Congratulations!* | ||
|
||
* * * * | ||
|
||
For installation and learning resources, refer to the | ||
[exercism help page](http://exercism.io/languages/ruby). | ||
|
||
For running the tests provided, you will need the Minitest gem. Open a | ||
terminal window and run the following command to install minitest: | ||
|
||
gem install minitest | ||
|
||
If you would like color output, you can `require 'minitest/pride'` in | ||
the test file, or note the alternative instruction, below, for running | ||
the test file. | ||
|
||
In order to run the test, you can run the test file from the exercise | ||
directory. For example, if the test suite is called | ||
`hello_world_test.rb`, you can run the following command: | ||
|
||
ruby hello_world_test.rb | ||
|
||
To include color from the command line: | ||
|
||
ruby -r minitest/pride hello_world_test.rb | ||
|
||
|
||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains 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,63 @@ | ||
# Allergies | ||
|
||
Given a person's allergy score, determine whether or not they're allergic to a given item, and their full list of allergies. | ||
|
||
An allergy test produces a single numeric score which contains the | ||
information about all the allergies the person has (that they were | ||
tested for). | ||
|
||
The list of items (and their value) that were tested are: | ||
|
||
* eggs (1) | ||
* peanuts (2) | ||
* shellfish (4) | ||
* strawberries (8) | ||
* tomatoes (16) | ||
* chocolate (32) | ||
* pollen (64) | ||
* cats (128) | ||
|
||
So if Tom is allergic to peanuts and chocolate, he gets a score of 34. | ||
|
||
Now, given just that score of 34, your program should be able to say: | ||
|
||
- Whether Tom is allergic to any one of those allergens listed above. | ||
- All the allergens Tom is allergic to. | ||
|
||
Note: a given score may include allergens **not** listed above (i.e. | ||
allergens that score 256, 512, 1024, etc.). Your program should | ||
ignore those components of the score. For example, if the allergy | ||
score is 257, your program should only report the eggs (1) allergy. | ||
|
||
|
||
* * * * | ||
|
||
For installation and learning resources, refer to the | ||
[exercism help page](http://exercism.io/languages/ruby). | ||
|
||
For running the tests provided, you will need the Minitest gem. Open a | ||
terminal window and run the following command to install minitest: | ||
|
||
gem install minitest | ||
|
||
If you would like color output, you can `require 'minitest/pride'` in | ||
the test file, or note the alternative instruction, below, for running | ||
the test file. | ||
|
||
In order to run the test, you can run the test file from the exercise | ||
directory. For example, if the test suite is called | ||
`hello_world_test.rb`, you can run the following command: | ||
|
||
ruby hello_world_test.rb | ||
|
||
To include color from the command line: | ||
|
||
ruby -r minitest/pride hello_world_test.rb | ||
|
||
|
||
## Source | ||
|
||
Jumpstart Lab Warm-up [http://jumpstartlab.com](http://jumpstartlab.com) | ||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains 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,61 @@ | ||
# Alphametics | ||
|
||
Write a function to solve alphametics puzzles. | ||
|
||
[Alphametics](https://en.wikipedia.org/wiki/Alphametics) is a puzzle where | ||
letters in words are replaced with numbers. | ||
|
||
For example `SEND + MORE = MONEY`: | ||
|
||
``` | ||
S E N D | ||
M O R E + | ||
----------- | ||
M O N E Y | ||
``` | ||
|
||
Replacing these with valid numbers gives: | ||
|
||
``` | ||
9 5 6 7 | ||
1 0 8 5 + | ||
----------- | ||
1 0 6 5 2 | ||
``` | ||
|
||
This is correct because every letter is replaced by a different number and the | ||
words, translated into numbers, then make a valid sum. | ||
|
||
Each letter must represent a different digit, and the leading digit of | ||
a multi-digit number must not be zero. | ||
|
||
Write a function to solve alphametics puzzles. | ||
|
||
* * * * | ||
|
||
For installation and learning resources, refer to the | ||
[exercism help page](http://exercism.io/languages/ruby). | ||
|
||
For running the tests provided, you will need the Minitest gem. Open a | ||
terminal window and run the following command to install minitest: | ||
|
||
gem install minitest | ||
|
||
If you would like color output, you can `require 'minitest/pride'` in | ||
the test file, or note the alternative instruction, below, for running | ||
the test file. | ||
|
||
In order to run the test, you can run the test file from the exercise | ||
directory. For example, if the test suite is called | ||
`hello_world_test.rb`, you can run the following command: | ||
|
||
ruby hello_world_test.rb | ||
|
||
To include color from the command line: | ||
|
||
ruby -r minitest/pride hello_world_test.rb | ||
|
||
|
||
|
||
## Submitting Incomplete Solutions | ||
It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
This file contains 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,39 @@ | ||
# Anagram | ||
|
||
Given a word and a list of possible anagrams, select the correct sublist. | ||
|
||
Given `"listen"` and a list of candidates like `"enlists" "google" | ||
"inlets" "banana"` the program should return a list containing | ||
`"inlets"`. | ||
|
||
* * * * | ||
|
||
For installation and learning resources, refer to the | ||
[exercism help page](http://exercism.io/languages/ruby). | ||
|
||
For running the tests provided, you will need the Minitest gem. Open a | ||
terminal window and run the following command to install minitest: | ||
|
||
gem install minitest | ||
|
||
If you would like color output, you can `require 'minitest/pride'` in | ||
the test file, or note the alternative instruction, below, for running | ||
the test file. | ||
|
||
In order to run the test, you can run the test file from the exercise | ||
directory. For example, if the test suite is called | ||
`hello_world_test.rb`, you can run the following command: | ||
|
||
ruby hello_world_test.rb | ||
|
||
To include color from the command line: | ||
|
||
ruby -r minitest/pride hello_world_test.rb | ||
|
||
|
||
## Source | ||
|
||
Inspired by the Extreme Startup game [https://github.com/rchatley/extreme_startup](https://github.com/rchatley/extreme_startup) | ||
|
||
## 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.