-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate static exercise README templates
We are working towards making exercises stand-alone. That is to say: no more generating READMEs on the fly. This will give maintainers more control over each individual exercise README, and it will also make some of the backend logic for delivering exercises simpler. The README template uses the Go text/template package, and the default templates generate the same READMEs as we have been generating on the fly. See the documentation in [regenerating exercise readmes][regenerate-docs] for details. The READMEs can be generated at any time using a new 'generate' command in configlet. This command has not yet landed in master or been released, but can be built from source in the generate-readmes branch on [configlet][]. [configlet]: https://github.com/exercism/configlet [regenerate-docs]: https://github.com/exercism/docs/blob/master/maintaining-a-track/regenerating-exercise-readmes.md
- Loading branch information
Showing
8 changed files
with
331 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,49 @@ | ||
# 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. | ||
|
||
## Running the tests | ||
|
||
Even though there are multiple implementations, we encourage to use Poly/ML. | ||
|
||
``` | ||
$ poly -q < test_{ exercise }.sml | ||
``` | ||
|
||
If you want to start an interactive session: | ||
``` | ||
$ poly --use test_{ exercise }.sml | ||
``` | ||
|
||
## 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,51 @@ | ||
# 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. | ||
|
||
|
||
## Running the tests | ||
|
||
Even though there are multiple implementations, we encourage to use Poly/ML. | ||
|
||
``` | ||
$ poly -q < test_{ exercise }.sml | ||
``` | ||
|
||
If you want to start an interactive session: | ||
``` | ||
$ poly --use test_{ exercise }.sml | ||
``` | ||
|
||
## 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,27 @@ | ||
# 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"`. | ||
|
||
## Running the tests | ||
|
||
Even though there are multiple implementations, we encourage to use Poly/ML. | ||
|
||
``` | ||
$ poly -q < test_{ exercise }.sml | ||
``` | ||
|
||
If you want to start an interactive session: | ||
``` | ||
$ poly --use test_{ exercise }.sml | ||
``` | ||
|
||
## 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. |
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,49 @@ | ||
# Binary | ||
|
||
Convert a binary number, represented as a string (e.g. '101010'), to its decimal equivalent using first principles. | ||
|
||
Implement binary to decimal conversion. Given a binary input | ||
string, your program should produce a decimal output. The | ||
program should handle invalid inputs. | ||
|
||
## Note | ||
- Implement the conversion yourself. | ||
Do not use something else to perform the conversion for you. | ||
|
||
## About Binary (Base-2) | ||
Decimal is a base-10 system. | ||
|
||
A number 23 in base 10 notation can be understood | ||
as a linear combination of powers of 10: | ||
|
||
- The rightmost digit gets multiplied by 10^0 = 1 | ||
- The next number gets multiplied by 10^1 = 10 | ||
- ... | ||
- The *n*th number gets multiplied by 10^*(n-1)*. | ||
- All these values are summed. | ||
|
||
So: `23 => 2*10^1 + 3*10^0 => 2*10 + 3*1 = 23 base 10` | ||
|
||
Binary is similar, but uses powers of 2 rather than powers of 10. | ||
|
||
So: `101 => 1*2^2 + 0*2^1 + 1*2^0 => 1*4 + 0*2 + 1*1 => 4 + 1 => 5 base 10`. | ||
|
||
## Running the tests | ||
|
||
Even though there are multiple implementations, we encourage to use Poly/ML. | ||
|
||
``` | ||
$ poly -q < test_{ exercise }.sml | ||
``` | ||
|
||
If you want to start an interactive session: | ||
``` | ||
$ poly --use test_{ exercise }.sml | ||
``` | ||
|
||
## Source | ||
|
||
All of Computer Science [http://www.wolframalpha.com/input/?i=binary&a=*C.binary-_*MathWorld-](http://www.wolframalpha.com/input/?i=binary&a=*C.binary-_*MathWorld-) | ||
|
||
## 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,32 @@ | ||
# Flatten Array | ||
|
||
Take a nested list and return a single flattened list with all values except nil/null. | ||
|
||
The challenge is to write a function that accepts an arbitrarily-deep nested list-like structure and returns a flattened structure without any nil/null values. | ||
|
||
For Example | ||
|
||
input: [1,[2,3,null,4],[null],5] | ||
|
||
output: [1,2,3,4,5] | ||
|
||
|
||
## Running the tests | ||
|
||
Even though there are multiple implementations, we encourage to use Poly/ML. | ||
|
||
``` | ||
$ poly -q < test_{ exercise }.sml | ||
``` | ||
|
||
If you want to start an interactive session: | ||
``` | ||
$ poly --use test_{ exercise }.sml | ||
``` | ||
|
||
## Source | ||
|
||
Interview Question [https://reference.wolfram.com/language/ref/Flatten.html](https://reference.wolfram.com/language/ref/Flatten.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 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,56 @@ | ||
# Hamming | ||
|
||
Calculate the Hamming difference between two DNA strands. | ||
|
||
A mutation is simply a mistake that occurs during the creation or | ||
copying of a nucleic acid, in particular DNA. Because nucleic acids are | ||
vital to cellular functions, mutations tend to cause a ripple effect | ||
throughout the cell. Although mutations are technically mistakes, a very | ||
rare mutation may equip the cell with a beneficial attribute. In fact, | ||
the macro effects of evolution are attributable by the accumulated | ||
result of beneficial microscopic mutations over many generations. | ||
|
||
The simplest and most common type of nucleic acid mutation is a point | ||
mutation, which replaces one base with another at a single nucleotide. | ||
|
||
By counting the number of differences between two homologous DNA strands | ||
taken from different genomes with a common ancestor, we get a measure of | ||
the minimum number of point mutations that could have occurred on the | ||
evolutionary path between the two strands. | ||
|
||
This is called the 'Hamming distance'. | ||
|
||
It is found by comparing two DNA strands and counting how many of the | ||
nucleotides are different from their equivalent in the other string. | ||
|
||
GAGCCTACTAACGGGAT | ||
CATCGTAATGACGGCCT | ||
^ ^ ^ ^ ^ ^^ | ||
|
||
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. | ||
|
||
## Running the tests | ||
|
||
Even though there are multiple implementations, we encourage to use Poly/ML. | ||
|
||
``` | ||
$ poly -q < test_{ exercise }.sml | ||
``` | ||
|
||
If you want to start an interactive session: | ||
``` | ||
$ poly --use test_{ exercise }.sml | ||
``` | ||
|
||
## Source | ||
|
||
The Calculating Point Mutations problem at Rosalind [http://rosalind.info/problems/hamm/](http://rosalind.info/problems/hamm/) | ||
|
||
## 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,29 @@ | ||
# Nth Prime | ||
|
||
Given a number n, determine what the nth prime is. | ||
|
||
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that | ||
the 6th prime is 13. | ||
|
||
If your language provides methods in the standard library to deal with prime | ||
numbers, pretend they don't exist and implement them yourself. | ||
|
||
## Running the tests | ||
|
||
Even though there are multiple implementations, we encourage to use Poly/ML. | ||
|
||
``` | ||
$ poly -q < test_{ exercise }.sml | ||
``` | ||
|
||
If you want to start an interactive session: | ||
``` | ||
$ poly --use test_{ exercise }.sml | ||
``` | ||
|
||
## Source | ||
|
||
A variation on Problem 7 at Project Euler [http://projecteuler.net/problem=7](http://projecteuler.net/problem=7) | ||
|
||
## 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,38 @@ | ||
# Raindrops | ||
|
||
Convert a number to a string, the contents of which depend on the number's factors. | ||
|
||
- If the number has 3 as a factor, output 'Pling'. | ||
- If the number has 5 as a factor, output 'Plang'. | ||
- If the number has 7 as a factor, output 'Plong'. | ||
- If the number does not have 3, 5, or 7 as a factor, | ||
just pass the number's digits straight through. | ||
|
||
## Examples | ||
|
||
- 28's factors are 1, 2, 4, **7**, 14, 28. | ||
- In raindrop-speak, this would be a simple "Plong". | ||
- 30's factors are 1, 2, **3**, **5**, 6, 10, 15, 30. | ||
- In raindrop-speak, this would be a "PlingPlang". | ||
- 34 has four factors: 1, 2, 17, and 34. | ||
- In raindrop-speak, this would be "34". | ||
|
||
## Running the tests | ||
|
||
Even though there are multiple implementations, we encourage to use Poly/ML. | ||
|
||
``` | ||
$ poly -q < test_{ exercise }.sml | ||
``` | ||
|
||
If you want to start an interactive session: | ||
``` | ||
$ poly --use test_{ exercise }.sml | ||
``` | ||
|
||
## Source | ||
|
||
A variation on a famous interview question intended to weed out potential candidates. [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. |