diff --git a/config.json b/config.json index 14fb3312a..2093e250b 100644 --- a/config.json +++ b/config.json @@ -23,6 +23,7 @@ "slug": "hello-world", "name": "Hello World", "uuid": "c97d9dda-c7ee-4595-b447-693559d03ba5", + "practices": [], "prerequisites": [], "difficulty": 1, "topics": [ @@ -33,6 +34,7 @@ "slug": "leap", "name": "Leap", "uuid": "0ad7d756-1cbd-44f4-a64f-0dc7e9eb40f4", + "practices": [], "prerequisites": [], "difficulty": 1, "topics": [ @@ -44,6 +46,7 @@ "slug": "space-age", "name": "Space Age", "uuid": "6cbb7841-9d96-4528-88e3-6e98a450fd7c", + "practices": [], "prerequisites": [], "difficulty": 1, "topics": [ @@ -54,6 +57,7 @@ "slug": "pangram", "name": "Pangram", "uuid": "42cb6880-0c4b-4455-815b-aac94c05db18", + "practices": [], "prerequisites": [], "difficulty": 1, "topics": [ @@ -65,6 +69,7 @@ "slug": "bob", "name": "Bob", "uuid": "e570c730-12e5-4b9e-adb0-eae85360e1b5", + "practices": [], "prerequisites": [], "difficulty": 1, "topics": [ @@ -76,6 +81,7 @@ "slug": "collatz-conjecture", "name": "Collatz Conjecture", "uuid": "6eba4eac-8395-4ad6-ac21-3651a11ab4b4", + "practices": [], "prerequisites": [], "difficulty": 1, "topics": [ @@ -89,6 +95,7 @@ "slug": "rna-transcription", "name": "Rna Transcription", "uuid": "85d77b8e-9b87-4d02-9fba-81f843bd66f1", + "practices": [], "prerequisites": [], "difficulty": 1, "topics": [ @@ -100,6 +107,7 @@ "slug": "nucleotide-count", "name": "Nucleotide Count", "uuid": "00feb0e9-ae1e-43fc-a0ea-8f2d0d0b9f49", + "practices": [], "prerequisites": [], "difficulty": 2, "topics": [ @@ -112,6 +120,7 @@ "slug": "sum-of-multiples", "name": "Sum Of Multiples", "uuid": "e125a32e-60ca-4e59-ae35-01f3b1907ccd", + "practices": [], "prerequisites": [], "difficulty": 1, "topics": [ @@ -123,6 +132,7 @@ "slug": "grains", "name": "Grains", "uuid": "197a543c-d9c7-41c3-814c-4b1ece3db568", + "practices": [], "prerequisites": [], "difficulty": 2, "topics": [ @@ -133,6 +143,7 @@ "slug": "acronym", "name": "Acronym", "uuid": "4b5b2254-1c68-449a-8150-c1d33b8de9d1", + "practices": [], "prerequisites": [], "difficulty": 2, "topics": [ @@ -143,6 +154,7 @@ "slug": "strain", "name": "Strain", "uuid": "b66851aa-c05e-4a52-aaab-387f193c1dc7", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -154,6 +166,7 @@ "slug": "anagram", "name": "Anagram", "uuid": "67c53230-82e8-4207-a811-abec27bef381", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -166,6 +179,7 @@ "slug": "clock", "name": "Clock", "uuid": "fa84dc6c-a212-431a-b4c1-752be5c99af7", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -177,6 +191,7 @@ "slug": "crypto-square", "name": "Crypto Square", "uuid": "dde7cf64-7e3b-4e5c-8a65-5d639fa8a307", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [] @@ -185,6 +200,7 @@ "slug": "luhn", "name": "Luhn", "uuid": "a602f191-581d-48ea-9441-1d6e8a51e71c", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -196,6 +212,7 @@ "slug": "nth-prime", "name": "Nth Prime", "uuid": "ddfc0435-5378-4865-bbcb-a07754014db4", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -208,6 +225,7 @@ "slug": "minesweeper", "name": "Minesweeper", "uuid": "821f2081-dfc2-40c6-8e12-2907daa04416", + "practices": [], "prerequisites": [], "difficulty": 7, "topics": [] @@ -216,6 +234,7 @@ "slug": "perfect-numbers", "name": "Perfect Numbers", "uuid": "928b22c5-f2bd-4496-8605-fcff2dad2c3a", + "practices": [], "prerequisites": [], "difficulty": 2, "topics": [ @@ -228,6 +247,7 @@ "slug": "phone-number", "name": "Phone Number", "uuid": "fd372449-0f01-4b2c-b42d-b56ede6f58fe", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -238,6 +258,7 @@ "slug": "secret-handshake", "name": "Secret Handshake", "uuid": "36d2d7f0-8e9c-4493-979c-080f7067494f", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -248,6 +269,7 @@ "slug": "pascals-triangle", "name": "Pascals Triangle", "uuid": "ff0a20ef-1828-42f1-8c10-4bf53b488993", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -259,6 +281,7 @@ "slug": "binary-search-tree", "name": "Binary Search Tree", "uuid": "91887e6e-e935-441a-9cd1-754a877dc2be", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -270,6 +293,7 @@ "slug": "queen-attack", "name": "Queen Attack", "uuid": "7e1cd145-0bdb-4f52-89e3-b21f98068a1f", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -280,6 +304,7 @@ "slug": "word-count", "name": "Word Count", "uuid": "5d36ba0a-3c57-471a-8956-e324e0384183", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -290,6 +315,7 @@ "slug": "wordy", "name": "Wordy", "uuid": "0869734e-0629-4db9-8e62-af246e5f91ff", + "practices": [], "prerequisites": [], "difficulty": 7, "topics": [ @@ -300,6 +326,7 @@ "slug": "hamming", "name": "Hamming", "uuid": "30686585-eb09-4514-8b2e-c9a0d9983133", + "practices": [], "prerequisites": [], "difficulty": 2, "topics": [ @@ -310,6 +337,7 @@ "slug": "robot-simulator", "name": "Robot Simulator", "uuid": "c456adbd-fa8c-4ffe-aa8c-60a1fd1f429e", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -320,6 +348,7 @@ "slug": "twelve-days", "name": "Twelve Days", "uuid": "d1dc946d-a142-42ed-abec-e53605635c0d", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -330,6 +359,7 @@ "slug": "saddle-points", "name": "Saddle Points", "uuid": "00b6c83b-e652-4f71-a094-b3034f77fd7b", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [] @@ -338,6 +368,7 @@ "slug": "food-chain", "name": "Food Chain", "uuid": "0b6af91e-8e1f-4ca5-bf30-53b427638e2b", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -348,6 +379,7 @@ "slug": "ocr-numbers", "name": "Ocr Numbers", "uuid": "90ac04fb-42d3-4666-b26a-2279057f6ef2", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -358,6 +390,7 @@ "slug": "change", "name": "Change", "uuid": "5af27112-48f2-423c-9607-03911ccc8049", + "practices": [], "prerequisites": [], "difficulty": 7, "topics": [ @@ -368,6 +401,7 @@ "slug": "go-counting", "name": "Go Counting", "uuid": "8f1854d7-b8cb-4dfa-9e6a-8811b0891798", + "practices": [], "prerequisites": [], "difficulty": 9, "topics": [ @@ -378,6 +412,7 @@ "slug": "resistor-color-duo", "name": "Resistor Color Duo", "uuid": "61be7bcd-42fb-44b7-a51d-1d081173f876", + "practices": [], "prerequisites": [], "difficulty": 2, "topics": [ @@ -388,6 +423,7 @@ "slug": "dnd-character", "name": "Dnd Character", "uuid": "138db4fc-ee70-11e8-8eb2-f2801f1b9fd1", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -398,6 +434,7 @@ "slug": "resistor-color-trio", "name": "Resistor Color Trio", "uuid": "946a2c88-fd0c-4dbc-a5cf-75ad9147e80c", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -409,6 +446,7 @@ "slug": "run-length-encoding", "name": "Run Length Encoding", "uuid": "6eba4eac-8395-4ad6-ac21-3651a11ab4b5", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -420,6 +458,7 @@ "slug": "house", "name": "House", "uuid": "2ab43e18-085b-4493-b51d-71274481d960", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -430,6 +469,7 @@ "slug": "proverb", "name": "Proverb", "uuid": "17ba80b8-1ca6-426b-880a-15de1d413032", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -441,6 +481,7 @@ "slug": "simple-linked-list", "name": "Simple Linked List", "uuid": "896dfe3d-f3c9-4c42-bc8d-8de49a8c7766", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -452,6 +493,7 @@ "slug": "custom-set", "name": "Custom Set", "uuid": "c875009a-c8a0-47d0-bef6-d6f278565fe5", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -463,6 +505,7 @@ "slug": "bowling", "name": "Bowling", "uuid": "cf896e0f-7971-4a4e-a164-412dd9176573", + "practices": [], "prerequisites": [], "difficulty": 7, "topics": [ @@ -473,6 +516,7 @@ "slug": "isbn-verifier", "name": "Isbn Verifier", "uuid": "e5a0bed3-90ca-4caa-a73f-2124940f84c9", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -483,6 +527,7 @@ "slug": "protein-translation", "name": "Protein Translation", "uuid": "f750e380-fe16-42c0-8b3d-8acd7e443a6e", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -493,6 +538,7 @@ "slug": "yacht", "name": "Yacht", "uuid": "8e129e54-6b5c-4696-84bc-588bc1c7f0f7", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -504,6 +550,7 @@ "slug": "pythagorean-triplet", "name": "Pythagorean Triplet", "uuid": "eb01573e-36bb-4093-bf16-4bccd8a36909", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -515,6 +562,7 @@ "slug": "rotational-cipher", "name": "Rotational Cipher", "uuid": "cd5ce9ad-b627-46e3-b6d8-872baf476bf1", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -525,6 +573,7 @@ "slug": "spiral-matrix", "name": "Spiral Matrix", "uuid": "781325ec-c772-4b56-80b0-2c56c5953122", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -535,6 +584,7 @@ "slug": "alphametics", "name": "Alphametics", "uuid": "154c2191-7746-497c-bf4e-37a5a5ffbb0b", + "practices": [], "prerequisites": [], "difficulty": 7, "topics": [ @@ -545,6 +595,7 @@ "slug": "beer-song", "name": "Beer Song", "uuid": "382e4fbd-99d6-400b-962c-ebb4a411bcea", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -555,6 +606,7 @@ "slug": "list-ops", "name": "List Ops", "uuid": "fd106381-478d-43b0-bdd2-c39e7044e01a", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -567,6 +619,7 @@ "slug": "matrix", "name": "Matrix", "uuid": "46502471-d2f8-4f25-a220-55b0caff435c", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -577,6 +630,7 @@ "slug": "binary-search", "name": "Binary Search", "uuid": "e714ed04-e633-4814-8885-323968f39046", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -587,6 +641,7 @@ "slug": "parallel-letter-frequency", "name": "Parallel Letter Frequency", "uuid": "a3442b20-e2a7-4fc6-8bff-0e61d25b2bf3", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -597,6 +652,7 @@ "slug": "transpose", "name": "Transpose", "uuid": "f58e07ae-08e9-4e64-b1d7-16033e46509b", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -607,6 +663,7 @@ "slug": "poker", "name": "Poker", "uuid": "35bf659b-b139-4d09-bdae-326319160a27", + "practices": [], "prerequisites": [], "difficulty": 7, "topics": [ @@ -617,6 +674,7 @@ "slug": "lens-person", "name": "Lens Person", "uuid": "056d6e6c-4d07-4bc0-b0d0-fb76a9ec8672", + "practices": [], "prerequisites": [], "difficulty": 9, "topics": [ @@ -627,6 +685,7 @@ "slug": "triangle", "name": "Triangle", "uuid": "28bf351c-0417-4113-83c9-e1e00992cd37", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -638,6 +697,7 @@ "slug": "meetup", "name": "Meetup", "uuid": "01401d15-6667-4f94-bcd2-ec5a70df1cc6", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [] @@ -646,6 +706,7 @@ "slug": "sieve", "name": "Sieve", "uuid": "1ed4a7af-76eb-4b42-89b2-dcb97e509443", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -657,6 +718,7 @@ "slug": "palindrome-products", "name": "Palindrome Products", "uuid": "3a0f1014-8829-4b7e-aab7-f23f2fad22a2", + "practices": [], "prerequisites": [], "difficulty": 6, "topics": [ @@ -669,6 +731,7 @@ "slug": "simple-cipher", "name": "Simple Cipher", "uuid": "2429b6d1-2ce8-487e-b0f7-a4d11970e6bd", + "practices": [], "prerequisites": [], "difficulty": 6, "topics": [ @@ -681,6 +744,7 @@ "slug": "connect", "name": "Connect", "uuid": "2c009c74-fbf2-49f7-b626-0d9da10c18ea", + "practices": [], "prerequisites": [], "difficulty": 8, "topics": [ @@ -691,6 +755,7 @@ "slug": "pov", "name": "Pov", "uuid": "010582a2-4c44-44fb-ac6b-bf1546d303a3", + "practices": [], "prerequisites": [], "difficulty": 10, "topics": [ @@ -701,6 +766,7 @@ "slug": "difference-of-squares", "name": "Difference Of Squares", "uuid": "c8953b81-97f2-4c26-b2b8-aa7ef95c5ff1", + "practices": [], "prerequisites": [], "difficulty": 1, "topics": [ @@ -712,6 +778,7 @@ "slug": "raindrops", "name": "Raindrops", "uuid": "39d5aa74-6e4a-4579-810e-b4430bc172e8", + "practices": [], "prerequisites": [], "difficulty": 2, "topics": [ @@ -722,6 +789,7 @@ "slug": "kindergarten-garden", "name": "Kindergarten Garden", "uuid": "f3e12dd1-d3c7-4955-975f-bfc471d689c7", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -732,6 +800,7 @@ "slug": "all-your-base", "name": "All Your Base", "uuid": "69b6b2d8-7d28-4fa1-84af-3c41857c1d16", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -743,6 +812,7 @@ "slug": "allergies", "name": "Allergies", "uuid": "3630c60f-3e18-42c2-bce4-10dc62d11b25", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -754,6 +824,7 @@ "slug": "series", "name": "Series", "uuid": "4c111498-9248-4f4a-9950-98fdac736d3b", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -765,6 +836,7 @@ "slug": "bank-account", "name": "Bank Account", "uuid": "44f2cb4d-1965-4d11-9373-bc3b5a624a8c", + "practices": [], "prerequisites": [], "difficulty": 6, "topics": [ @@ -778,6 +850,7 @@ "slug": "rail-fence-cipher", "name": "Rail Fence Cipher", "uuid": "5bf7612c-427e-484d-bc67-8553fac4f64d", + "practices": [], "prerequisites": [], "difficulty": 6, "topics": [ @@ -789,6 +862,7 @@ "slug": "sublist", "name": "Sublist", "uuid": "f49d76f7-f826-4b6a-a514-47af7e84144a", + "practices": [], "prerequisites": [], "difficulty": 6, "topics": [] @@ -797,6 +871,7 @@ "slug": "sgf-parsing", "name": "Sgf Parsing", "uuid": "033adeae-d94a-4832-ae99-8dd98acd6044", + "practices": [], "prerequisites": [], "difficulty": 9, "topics": [ @@ -807,6 +882,7 @@ "slug": "zipper", "name": "Zipper", "uuid": "e585c482-2088-40bf-bc97-bc6fac6a7a72", + "practices": [], "prerequisites": [], "difficulty": 10, "topics": [ @@ -818,6 +894,7 @@ "slug": "armstrong-numbers", "name": "Armstrong Numbers", "uuid": "8d643e12-54dd-40ff-9919-e89b301e2112", + "practices": [], "prerequisites": [], "difficulty": 1, "topics": [ @@ -828,6 +905,7 @@ "slug": "etl", "name": "Etl", "uuid": "8082b1fb-7e3b-4a7f-b857-479bdb0d65e3", + "practices": [], "prerequisites": [], "difficulty": 2, "topics": [ @@ -839,6 +917,7 @@ "slug": "scrabble-score", "name": "Scrabble Score", "uuid": "7157a846-5846-47a4-97c2-daad7f763512", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [] @@ -847,6 +926,7 @@ "slug": "roman-numerals", "name": "Roman Numerals", "uuid": "1c575894-ea99-4443-90c2-8172eaff7fea", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -857,6 +937,7 @@ "slug": "atbash-cipher", "name": "Atbash Cipher", "uuid": "4b6d04f4-8cfc-4d8a-ac6e-77f3889f27c3", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -868,6 +949,7 @@ "slug": "pig-latin", "name": "Pig Latin", "uuid": "03bb14fb-d677-47fb-b283-b79c75c93855", + "practices": [], "prerequisites": [], "difficulty": 6, "topics": [ @@ -878,6 +960,7 @@ "slug": "robot-name", "name": "Robot Name", "uuid": "aec901e4-482f-4f00-8a26-a0c09fdb1365", + "practices": [], "prerequisites": [], "difficulty": 6, "topics": [ @@ -890,6 +973,7 @@ "slug": "say", "name": "Say", "uuid": "76384e4a-3d3e-4369-9a0d-55c47f91f17e", + "practices": [], "prerequisites": [], "difficulty": 6, "topics": [ @@ -900,6 +984,7 @@ "slug": "dominoes", "name": "Dominoes", "uuid": "14f8190f-c711-4399-b176-6efc5e3e71d1", + "practices": [], "prerequisites": [], "difficulty": 8, "topics": [ @@ -910,6 +995,7 @@ "slug": "accumulate", "name": "Accumulate", "uuid": "5c5a9256-a55e-4bda-baf3-96d052732e11", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -922,6 +1008,7 @@ "slug": "complex-numbers", "name": "Complex Numbers", "uuid": "4e10e864-2fe4-4926-b908-f70645698999", + "practices": [], "prerequisites": [], "difficulty": 3, "topics": [ @@ -934,6 +1021,7 @@ "slug": "largest-series-product", "name": "Largest Series Product", "uuid": "5f92b1d3-b2cb-463e-b6da-347473ef4c30", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -945,6 +1033,7 @@ "slug": "prime-factors", "name": "Prime Factors", "uuid": "8cc9254d-cda5-4a7d-ad50-921a99f1432d", + "practices": [], "prerequisites": [], "difficulty": 4, "topics": [ @@ -956,6 +1045,7 @@ "slug": "matching-brackets", "name": "Matching Brackets", "uuid": "be179655-b1a2-4e57-a3f1-4834c467ef41", + "practices": [], "prerequisites": [], "difficulty": 5, "topics": [ @@ -966,6 +1056,7 @@ "slug": "linked-list", "name": "Linked List", "uuid": "34b8a4fe-6761-4675-a5a9-e8c92c93fd8f", + "practices": [], "prerequisites": [], "difficulty": 6, "topics": [ @@ -980,6 +1071,7 @@ "slug": "zebra-puzzle", "name": "Zebra Puzzle", "uuid": "893da7e3-1e7f-48d0-a8c2-8d84b9ec064f", + "practices": [], "prerequisites": [], "difficulty": 7, "topics": [ @@ -991,6 +1083,7 @@ "slug": "forth", "name": "Forth", "uuid": "04c86a05-4d34-4a20-9489-db744c205bb6", + "practices": [], "prerequisites": [], "difficulty": 10, "topics": [ @@ -1003,6 +1096,7 @@ "slug": "binary", "name": "Binary", "uuid": "48ca1682-ca1b-4a2c-be55-624620f336a7", + "practices": [], "prerequisites": [], "difficulty": 0, "topics": null, @@ -1012,6 +1106,7 @@ "slug": "gigasecond", "name": "Gigasecond", "uuid": "317ef3e7-67ce-4940-bc90-eed1c4a27c19", + "practices": [], "prerequisites": [], "difficulty": 0, "topics": null, @@ -1021,6 +1116,7 @@ "slug": "hexadecimal", "name": "Hexadecimal", "uuid": "964c07aa-abca-49b8-8428-1b81ee39066d", + "practices": [], "prerequisites": [], "difficulty": 0, "topics": null, @@ -1030,6 +1126,7 @@ "slug": "octal", "name": "Octal", "uuid": "2566f8ee-28cf-4429-9ced-42759c810d7c", + "practices": [], "prerequisites": [], "difficulty": 0, "topics": null, @@ -1039,6 +1136,7 @@ "slug": "trinary", "name": "Trinary", "uuid": "d5997b60-e54c-4caa-beae-8614f0da3fb3", + "practices": [], "prerequisites": [], "difficulty": 0, "topics": null, @@ -1048,6 +1146,7 @@ "slug": "diamond", "name": "Diamond", "uuid": "40d4aa74-6e4a-4579-810e-b4430bc172e8", + "practices": [], "prerequisites": [], "difficulty": 2, "topics": [ @@ -1058,6 +1157,7 @@ "slug": "grade-school", "name": "Grade School", "uuid": "ba13fdf3-9a36-4286-8b78-75964d1aa373", + "practices": [], "prerequisites": [], "difficulty": 2, "topics": [ @@ -1068,6 +1168,7 @@ "slug": "isogram", "name": "Isogram", "uuid": "6eba4eac-6665-4ad6-ac21-3651a11ab4b4", + "practices": [], "prerequisites": [], "difficulty": 2, "topics": [ diff --git a/exercises/practice/accumulate/.docs/instructions.md b/exercises/practice/accumulate/.docs/instructions.md new file mode 100644 index 000000000..435e0b324 --- /dev/null +++ b/exercises/practice/accumulate/.docs/instructions.md @@ -0,0 +1,26 @@ +# Instructions + +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. diff --git a/exercises/practice/accumulate/.meta/config.json b/exercises/practice/accumulate/.meta/config.json new file mode 100644 index 000000000..70e106389 --- /dev/null +++ b/exercises/practice/accumulate/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Conversation with James Edward Gray II", + "source_url": "https://twitter.com/jeg2" +} diff --git a/exercises/practice/accumulate/README.md b/exercises/practice/accumulate/README.md deleted file mode 100644 index cda5524cb..000000000 --- a/exercises/practice/accumulate/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# 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. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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. diff --git a/exercises/practice/acronym/.meta/hints.md b/exercises/practice/acronym/.docs/instructions.append.md similarity index 100% rename from exercises/practice/acronym/.meta/hints.md rename to exercises/practice/acronym/.docs/instructions.append.md diff --git a/exercises/practice/acronym/.docs/instructions.md b/exercises/practice/acronym/.docs/instructions.md new file mode 100644 index 000000000..e0515b4d1 --- /dev/null +++ b/exercises/practice/acronym/.docs/instructions.md @@ -0,0 +1,8 @@ +# Instructions + +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). diff --git a/exercises/practice/acronym/.meta/config.json b/exercises/practice/acronym/.meta/config.json new file mode 100644 index 000000000..dd6747143 --- /dev/null +++ b/exercises/practice/acronym/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Julien Vanier", + "source_url": "https://github.com/monkbroc" +} diff --git a/exercises/practice/acronym/README.md b/exercises/practice/acronym/README.md deleted file mode 100644 index ff8419818..000000000 --- a/exercises/practice/acronym/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# 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). - -## Hints - -This exercise works with textual data. For historical reasons, Haskell's -`String` type is synonymous with `[Char]`, a list of characters. For more -efficient handling of textual data, the `Text` type can be used. - -As an optional extension to this exercise, you can - -- Read about [string types](https://haskell-lang.org/tutorial/string-types) in Haskell. -- Add `- text` to your list of dependencies in package.yaml. -- Import `Data.Text` in [the following way](https://hackernoon.com/4-steps-to-a-better-imports-list-in-haskell-43a3d868273c): - - import qualified Data.Text as T - import Data.Text (Text) - -- You can now write e.g. `abbreviate :: Text -> Text` and refer to `Data.Text` combinators as e.g. `T.filter`. -- Look up the documentation for [`Data.Text`](https://hackage.haskell.org/package/text/docs/Data-Text.html). - -This part is entirely optional. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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. diff --git a/exercises/practice/all-your-base/.docs/instructions.md b/exercises/practice/all-your-base/.docs/instructions.md new file mode 100644 index 000000000..c39686f28 --- /dev/null +++ b/exercises/practice/all-your-base/.docs/instructions.md @@ -0,0 +1,32 @@ +# Instructions + +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!* diff --git a/exercises/practice/all-your-base/.meta/config.json b/exercises/practice/all-your-base/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/all-your-base/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/all-your-base/README.md b/exercises/practice/all-your-base/README.md deleted file mode 100644 index 253b89be4..000000000 --- a/exercises/practice/all-your-base/README.md +++ /dev/null @@ -1,88 +0,0 @@ -# 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!* - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/allergies/.meta/hints.md b/exercises/practice/allergies/.docs/instructions.append.md similarity index 100% rename from exercises/practice/allergies/.meta/hints.md rename to exercises/practice/allergies/.docs/instructions.append.md diff --git a/exercises/practice/allergies/.docs/instructions.md b/exercises/practice/allergies/.docs/instructions.md new file mode 100644 index 000000000..b8bbd5a3f --- /dev/null +++ b/exercises/practice/allergies/.docs/instructions.md @@ -0,0 +1,30 @@ +# Instructions + +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. diff --git a/exercises/practice/allergies/.meta/config.json b/exercises/practice/allergies/.meta/config.json new file mode 100644 index 000000000..bffe8b341 --- /dev/null +++ b/exercises/practice/allergies/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Jumpstart Lab Warm-up", + "source_url": "http://jumpstartlab.com" +} diff --git a/exercises/practice/allergies/README.md b/exercises/practice/allergies/README.md deleted file mode 100644 index 4c878e47b..000000000 --- a/exercises/practice/allergies/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# 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. - -## Hints - -To complete this exercise you need to to create the data type `Allergen`, -with `Eq` and `Show` instances, and implement the following functions: - -- `allergies` -- `isAllergicTo` - -You will find a dummy data declaration and type signatures already in place, -but it is up to you to define the functions and create a meaningful data type, -newtype or type synonym. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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. diff --git a/exercises/practice/alphametics/.meta/hints.md b/exercises/practice/alphametics/.docs/instructions.append.md similarity index 100% rename from exercises/practice/alphametics/.meta/hints.md rename to exercises/practice/alphametics/.docs/instructions.append.md diff --git a/exercises/practice/alphametics/.docs/instructions.md b/exercises/practice/alphametics/.docs/instructions.md new file mode 100644 index 000000000..6936c192d --- /dev/null +++ b/exercises/practice/alphametics/.docs/instructions.md @@ -0,0 +1,32 @@ +# Instructions + +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`: + +```text + S E N D + M O R E + +----------- +M O N E Y +``` + +Replacing these with valid numbers gives: + +```text + 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. diff --git a/exercises/practice/alphametics/.meta/config.json b/exercises/practice/alphametics/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/alphametics/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/alphametics/README.md b/exercises/practice/alphametics/README.md deleted file mode 100644 index 32ca6116e..000000000 --- a/exercises/practice/alphametics/README.md +++ /dev/null @@ -1,95 +0,0 @@ -# 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`: - -```text - S E N D - M O R E + ------------ -M O N E Y -``` - -Replacing these with valid numbers gives: - -```text - 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. - -## Hints - -You can solve this exercise with a brute force algorithm, but this will possibly have a poor runtime performance. -Try to find a more sophisticated solution. Hint: You could try the column-wise addition algorithm that is usually taught in high school. - - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/anagram/.meta/hints.md b/exercises/practice/anagram/.docs/instructions.append.md similarity index 100% rename from exercises/practice/anagram/.meta/hints.md rename to exercises/practice/anagram/.docs/instructions.append.md diff --git a/exercises/practice/anagram/.docs/instructions.md b/exercises/practice/anagram/.docs/instructions.md new file mode 100644 index 000000000..2675b5836 --- /dev/null +++ b/exercises/practice/anagram/.docs/instructions.md @@ -0,0 +1,8 @@ +# Instructions + +An anagram is a rearrangement of letters to form a new word. +Given a word and a list of candidates, select the sublist of anagrams of the given word. + +Given `"listen"` and a list of candidates like `"enlists" "google" +"inlets" "banana"` the program should return a list containing +`"inlets"`. diff --git a/exercises/practice/anagram/.meta/config.json b/exercises/practice/anagram/.meta/config.json new file mode 100644 index 000000000..8591c6609 --- /dev/null +++ b/exercises/practice/anagram/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Inspired by the Extreme Startup game", + "source_url": "https://github.com/rchatley/extreme_startup" +} diff --git a/exercises/practice/anagram/README.md b/exercises/practice/anagram/README.md deleted file mode 100644 index e0c6091cb..000000000 --- a/exercises/practice/anagram/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# Anagram - -An anagram is a rearrangement of letters to form a new word. -Given a word and a list of candidates, select the sublist of anagrams of the given word. - -Given `"listen"` and a list of candidates like `"enlists" "google" -"inlets" "banana"` the program should return a list containing -`"inlets"`. - -## Hints - -To complete this exercise you need to implement the function `anagramsFor`, -that takes a *word* and a group of *words*, returning the ones that are -anagrams of the given *word*. - -If it is your first time solving this exercise, it is recommended that you -stick to the provided signature: - -```haskell -anagramsFor :: String -> [String] -> [String] -``` - -Later, it may be a good idea to revisit this problem and play with other data -types and libraries: - -- `Text`, from package *text*. -- `Sequence` and `Set`, from package *containers*. -- `MultiSet`, from package *multiset* - -The test suite was intentionally designed to accept almost any type signature -that makes sense, so you are encouraged to find the one you think is the best. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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. diff --git a/exercises/practice/armstrong-numbers/.docs/instructions.md b/exercises/practice/armstrong-numbers/.docs/instructions.md new file mode 100644 index 000000000..452a996fb --- /dev/null +++ b/exercises/practice/armstrong-numbers/.docs/instructions.md @@ -0,0 +1,12 @@ +# Instructions + +An [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that is the sum of its own digits each raised to the power of the number of digits. + +For example: + +- 9 is an Armstrong number, because `9 = 9^1 = 9` +- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1` +- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153` +- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190` + +Write some code to determine whether a number is an Armstrong number. diff --git a/exercises/practice/armstrong-numbers/.meta/config.json b/exercises/practice/armstrong-numbers/.meta/config.json new file mode 100644 index 000000000..562a04c42 --- /dev/null +++ b/exercises/practice/armstrong-numbers/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Narcissistic_number" +} diff --git a/exercises/practice/armstrong-numbers/README.md b/exercises/practice/armstrong-numbers/README.md deleted file mode 100644 index 78640c4ed..000000000 --- a/exercises/practice/armstrong-numbers/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# Armstrong Numbers - -An [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that is the sum of its own digits each raised to the power of the number of digits. - -For example: - -- 9 is an Armstrong number, because `9 = 9^1 = 9` -- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1` -- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153` -- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190` - -Write some code to determine whether a number is an Armstrong number. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [https://en.wikipedia.org/wiki/Narcissistic_number](https://en.wikipedia.org/wiki/Narcissistic_number) - -## 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/practice/atbash-cipher/.meta/hints.md b/exercises/practice/atbash-cipher/.docs/instructions.append.md similarity index 100% rename from exercises/practice/atbash-cipher/.meta/hints.md rename to exercises/practice/atbash-cipher/.docs/instructions.append.md diff --git a/exercises/practice/atbash-cipher/.docs/instructions.md b/exercises/practice/atbash-cipher/.docs/instructions.md new file mode 100644 index 000000000..2f712b159 --- /dev/null +++ b/exercises/practice/atbash-cipher/.docs/instructions.md @@ -0,0 +1,29 @@ +# Instructions + +Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East. + +The Atbash cipher is a simple substitution cipher that relies on +transposing all the letters in the alphabet such that the resulting +alphabet is backwards. The first letter is replaced with the last +letter, the second with the second-last, and so on. + +An Atbash cipher for the Latin alphabet would be as follows: + +```text +Plain: abcdefghijklmnopqrstuvwxyz +Cipher: zyxwvutsrqponmlkjihgfedcba +``` + +It is a very weak cipher because it only has one possible key, and it is +a simple monoalphabetic substitution cipher. However, this may not have +been an issue in the cipher's time. + +Ciphertext is written out in groups of fixed length, the traditional group size +being 5 letters, and punctuation is excluded. This is to make it harder to guess +things based on word boundaries. + +## Examples + +- Encoding `test` gives `gvhg` +- Decoding `gvhg` gives `test` +- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog` diff --git a/exercises/practice/atbash-cipher/.meta/config.json b/exercises/practice/atbash-cipher/.meta/config.json new file mode 100644 index 000000000..44cb2faac --- /dev/null +++ b/exercises/practice/atbash-cipher/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "http://en.wikipedia.org/wiki/Atbash" +} diff --git a/exercises/practice/atbash-cipher/README.md b/exercises/practice/atbash-cipher/README.md deleted file mode 100644 index 45b306be3..000000000 --- a/exercises/practice/atbash-cipher/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# Atbash Cipher - -Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East. - -The Atbash cipher is a simple substitution cipher that relies on -transposing all the letters in the alphabet such that the resulting -alphabet is backwards. The first letter is replaced with the last -letter, the second with the second-last, and so on. - -An Atbash cipher for the Latin alphabet would be as follows: - -```text -Plain: abcdefghijklmnopqrstuvwxyz -Cipher: zyxwvutsrqponmlkjihgfedcba -``` - -It is a very weak cipher because it only has one possible key, and it is -a simple monoalphabetic substitution cipher. However, this may not have -been an issue in the cipher's time. - -Ciphertext is written out in groups of fixed length, the traditional group size -being 5 letters, and punctuation is excluded. This is to make it harder to guess -things based on word boundaries. - -## Examples - -- Encoding `test` gives `gvhg` -- Decoding `gvhg` gives `test` -- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog` - -## Hints - -You need to implement the `decode` and `encode` functions, which decode and encode a `String` using an Atbash cipher. -You can use the provided signature if you are unsure about the types, but don't let it restrict your creativity. - -This exercise works with textual data. For historical reasons, Haskell's -`String` type is synonymous with `[Char]`, a list of characters. For more -efficient handling of textual data, the `Text` type can be used. - -As an optional extension to this exercise, you can - -- read about [string types](https://haskell-lang.org/tutorial/string-types) in - Haskell. -- add `- text` to your list of dependencies in package.yaml. -- import `Data.Text` in [the following - way](https://hackernoon.com/4-steps-to-a-better-imports-list-in-haskell-43a3d868273c): - -```haskell -import qualified Data.Text as T -import Data.Text (Text) -``` - -- use the `Text` type e.g. `decode :: Text -> Text` and refer to - `Data.Text` combinators as e.g. `T.pack`. -- look up the documentation for - [`Data.Text`](https://hackage.haskell.org/package/text/docs/Data-Text.html). -- replace all occurrences of `String` with `Text` in Atbash.hs, i.e.: - -```haskell -decode :: Text -> Text -decode cipherText = ... - -encode :: Text -> Text -encode plainText = ... -``` - -This part is entirely optional. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [http://en.wikipedia.org/wiki/Atbash](http://en.wikipedia.org/wiki/Atbash) - -## 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/practice/bank-account/.meta/hints.md b/exercises/practice/bank-account/.docs/instructions.append.md similarity index 100% rename from exercises/practice/bank-account/.meta/hints.md rename to exercises/practice/bank-account/.docs/instructions.append.md diff --git a/exercises/practice/bank-account/.docs/instructions.md b/exercises/practice/bank-account/.docs/instructions.md new file mode 100644 index 000000000..1265ac8b3 --- /dev/null +++ b/exercises/practice/bank-account/.docs/instructions.md @@ -0,0 +1,27 @@ +# Instructions + +Simulate a bank account supporting opening/closing, withdrawals, and deposits +of money. Watch out for concurrent transactions! + +A bank account can be accessed in multiple ways. Clients can make +deposits and withdrawals using the internet, mobile phones, etc. Shops +can charge against the account. + +Create an account that can be accessed from multiple threads/processes +(terminology depends on your programming language). + +It should be possible to close an account; operations against a closed +account must fail. + +## Instructions + +Run the test file, and fix each of the errors in turn. When you get the +first test to pass, go to the first pending or skipped test, and make +that pass as well. When all of the tests are passing, feel free to +submit. + +Remember that passing code is just the first step. The goal is to work +towards a solution that is as readable and expressive as you can make +it. + +Have fun! diff --git a/exercises/practice/bank-account/.meta/config.json b/exercises/practice/bank-account/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/bank-account/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/bank-account/README.md b/exercises/practice/bank-account/README.md deleted file mode 100644 index 89c68f815..000000000 --- a/exercises/practice/bank-account/README.md +++ /dev/null @@ -1,106 +0,0 @@ -# Bank Account - -Simulate a bank account supporting opening/closing, withdrawals, and deposits -of money. Watch out for concurrent transactions! - -A bank account can be accessed in multiple ways. Clients can make -deposits and withdrawals using the internet, mobile phones, etc. Shops -can charge against the account. - -Create an account that can be accessed from multiple threads/processes -(terminology depends on your programming language). - -It should be possible to close an account; operations against a closed -account must fail. - -## Instructions - -Run the test file, and fix each of the errors in turn. When you get the -first test to pass, go to the first pending or skipped test, and make -that pass as well. When all of the tests are passing, feel free to -submit. - -Remember that passing code is just the first step. The goal is to work -towards a solution that is as readable and expressive as you can make -it. - -Have fun! - -## Hints - -To complete this exercise you need to implement the following functions: - -- `openAccount` - Called at the start of each test. Returns a BankAccount. -- `closeAccount` - Called at the end of each test. -- `getBalance` - Get the balance of the bank account. -- `updateBalance` - Increment the balance of the bank account by the given amount. - -The amount may be negative for a withdrawal. - -The initial balance of the bank account should be 0. - -You will find a dummy data declaration and type signatures already in place, -but it is up to you to define the functions and create a meaningful data type, -newtype or type synonym. - -If you need help, here are some additional resources: - -- Read about [concurrency](https://en.wikipedia.org/wiki/Concurrent_Haskell) in Haskell. -- Look into the [Software Transactional Memory](https://hackage.haskell.org/package/stm) package and its Transactional Variables. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/beer-song/.meta/hints.md b/exercises/practice/beer-song/.docs/instructions.append.md similarity index 100% rename from exercises/practice/beer-song/.meta/hints.md rename to exercises/practice/beer-song/.docs/instructions.append.md diff --git a/exercises/practice/beer-song/README.md b/exercises/practice/beer-song/.docs/instructions.md similarity index 86% rename from exercises/practice/beer-song/README.md rename to exercises/practice/beer-song/.docs/instructions.md index a23e499f3..57429d8ab 100644 --- a/exercises/practice/beer-song/README.md +++ b/exercises/practice/beer-song/.docs/instructions.md @@ -1,4 +1,4 @@ -# Beer Song +# Instructions Recite the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall. @@ -319,83 +319,3 @@ are some additional things you could try: Then please share your thoughts in a comment on the submission. Did this experiment make the code better? Worse? Did you learn anything from it? - -## Hints - -This exercise is about [code refactoring](https://en.wikipedia.org/wiki/Refactoring), -so we are providing you with a solution that already passes the tests. - -The challenge is to rewrite it until you are proud of it, and learn -something in the process. - -If you don't know where to start, here are some ideas: - -- Try to reduce repetition to a minimum. -- Try to make the code readable. - -Take your time. - -Change one thing at a time and check if your solution still passes the tests. - -Have fun! - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Learn to Program by Chris Pine [http://pine.fm/LearnToProgram/?Chapter=06](http://pine.fm/LearnToProgram/?Chapter=06) - -## 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/practice/beer-song/.meta/config.json b/exercises/practice/beer-song/.meta/config.json new file mode 100644 index 000000000..edb5b2d03 --- /dev/null +++ b/exercises/practice/beer-song/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Learn to Program by Chris Pine", + "source_url": "http://pine.fm/LearnToProgram/?Chapter=06" +} diff --git a/exercises/practice/binary-search-tree/.meta/hints.md b/exercises/practice/binary-search-tree/.docs/instructions.append.md similarity index 100% rename from exercises/practice/binary-search-tree/.meta/hints.md rename to exercises/practice/binary-search-tree/.docs/instructions.append.md diff --git a/exercises/practice/binary-search-tree/.docs/instructions.md b/exercises/practice/binary-search-tree/.docs/instructions.md new file mode 100644 index 000000000..ba3c42eb6 --- /dev/null +++ b/exercises/practice/binary-search-tree/.docs/instructions.md @@ -0,0 +1,54 @@ +# Instructions + +Insert and search for numbers in a binary tree. + +When we need to represent sorted data, an array does not make a good +data structure. + +Say we have the array `[1, 3, 4, 5]`, and we add 2 to it so it becomes +`[1, 3, 4, 5, 2]` now we must sort the entire array again! We can +improve on this by realizing that we only need to make space for the new +item `[1, nil, 3, 4, 5]`, and then adding the item in the space we +added. But this still requires us to shift many elements down by one. + +Binary Search Trees, however, can operate on sorted data much more +efficiently. + +A binary search tree consists of a series of connected nodes. Each node +contains a piece of data (e.g. the number 3), a variable named `left`, +and a variable named `right`. The `left` and `right` variables point at +`nil`, or other nodes. Since these other nodes in turn have other nodes +beneath them, we say that the left and right variables are pointing at +subtrees. All data in the left subtree is less than or equal to the +current node's data, and all data in the right subtree is greater than +the current node's data. + +For example, if we had a node containing the data 4, and we added the +data 2, our tree would look like this: + + 4 + / + 2 + +If we then added 6, it would look like this: + + 4 + / \ + 2 6 + +If we then added 3, it would look like this + + 4 + / \ + 2 6 + \ + 3 + +And if we then added 1, 5, and 7, it would look like this + + 4 + / \ + / \ + 2 6 + / \ / \ + 1 3 5 7 diff --git a/exercises/practice/binary-search-tree/.meta/config.json b/exercises/practice/binary-search-tree/.meta/config.json new file mode 100644 index 000000000..ad89e2735 --- /dev/null +++ b/exercises/practice/binary-search-tree/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Josh Cheek", + "source_url": "https://twitter.com/josh_cheek" +} diff --git a/exercises/practice/binary-search-tree/README.md b/exercises/practice/binary-search-tree/README.md deleted file mode 100644 index 222d41561..000000000 --- a/exercises/practice/binary-search-tree/README.md +++ /dev/null @@ -1,133 +0,0 @@ -# Binary Search Tree - -Insert and search for numbers in a binary tree. - -When we need to represent sorted data, an array does not make a good -data structure. - -Say we have the array `[1, 3, 4, 5]`, and we add 2 to it so it becomes -`[1, 3, 4, 5, 2]` now we must sort the entire array again! We can -improve on this by realizing that we only need to make space for the new -item `[1, nil, 3, 4, 5]`, and then adding the item in the space we -added. But this still requires us to shift many elements down by one. - -Binary Search Trees, however, can operate on sorted data much more -efficiently. - -A binary search tree consists of a series of connected nodes. Each node -contains a piece of data (e.g. the number 3), a variable named `left`, -and a variable named `right`. The `left` and `right` variables point at -`nil`, or other nodes. Since these other nodes in turn have other nodes -beneath them, we say that the left and right variables are pointing at -subtrees. All data in the left subtree is less than or equal to the -current node's data, and all data in the right subtree is greater than -the current node's data. - -For example, if we had a node containing the data 4, and we added the -data 2, our tree would look like this: - - 4 - / - 2 - -If we then added 6, it would look like this: - - 4 - / \ - 2 6 - -If we then added 3, it would look like this - - 4 - / \ - 2 6 - \ - 3 - -And if we then added 1, 5, and 7, it would look like this - - 4 - / \ - / \ - 2 6 - / \ / \ - 1 3 5 7 - -## Hints - -To complete this exercise you need to create the data type `BST`, -with `Eq` and `Show` instances, and implement the functions: - -- `bstLeft` -- `bstRight` -- `bstValue` -- `empty` -- `fromList` -- `insert` -- `singleton` -- `toList` - -You will find a dummy data declaration and type signatures already in place, -but it is up to you to define the functions and create a meaningful data type, -newtype or type synonym. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Josh Cheek [https://twitter.com/josh_cheek](https://twitter.com/josh_cheek) - -## 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/practice/binary-search/.meta/hints.md b/exercises/practice/binary-search/.docs/instructions.append.md similarity index 100% rename from exercises/practice/binary-search/.meta/hints.md rename to exercises/practice/binary-search/.docs/instructions.append.md diff --git a/exercises/practice/binary-search/.docs/instructions.md b/exercises/practice/binary-search/.docs/instructions.md new file mode 100644 index 000000000..4dcaba726 --- /dev/null +++ b/exercises/practice/binary-search/.docs/instructions.md @@ -0,0 +1,35 @@ +# Instructions + +Implement a binary search algorithm. + +Searching a sorted collection is a common task. A dictionary is a sorted +list of word definitions. Given a word, one can find its definition. A +telephone book is a sorted list of people's names, addresses, and +telephone numbers. Knowing someone's name allows one to quickly find +their telephone number and address. + +If the list to be searched contains more than a few items (a dozen, say) +a binary search will require far fewer comparisons than a linear search, +but it imposes the requirement that the list be sorted. + +In computer science, a binary search or half-interval search algorithm +finds the position of a specified input value (the search "key") within +an array sorted by key value. + +In each step, the algorithm compares the search key value with the key +value of the middle element of the array. + +If the keys match, then a matching element has been found and its index, +or position, is returned. + +Otherwise, if the search key is less than the middle element's key, then +the algorithm repeats its action on the sub-array to the left of the +middle element or, if the search key is greater, on the sub-array to the +right. + +If the remaining array to be searched is empty, then the key cannot be +found in the array and a special "not found" indication is returned. + +A binary search halves the number of items to check with each iteration, +so locating an item (or determining its absence) takes logarithmic time. +A binary search is a dichotomic divide and conquer search algorithm. diff --git a/exercises/practice/binary-search/.meta/config.json b/exercises/practice/binary-search/.meta/config.json new file mode 100644 index 000000000..dbb9aaed4 --- /dev/null +++ b/exercises/practice/binary-search/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "http://en.wikipedia.org/wiki/Binary_search_algorithm" +} diff --git a/exercises/practice/binary-search/README.md b/exercises/practice/binary-search/README.md deleted file mode 100644 index a07d96123..000000000 --- a/exercises/practice/binary-search/README.md +++ /dev/null @@ -1,112 +0,0 @@ -# Binary Search - -Implement a binary search algorithm. - -Searching a sorted collection is a common task. A dictionary is a sorted -list of word definitions. Given a word, one can find its definition. A -telephone book is a sorted list of people's names, addresses, and -telephone numbers. Knowing someone's name allows one to quickly find -their telephone number and address. - -If the list to be searched contains more than a few items (a dozen, say) -a binary search will require far fewer comparisons than a linear search, -but it imposes the requirement that the list be sorted. - -In computer science, a binary search or half-interval search algorithm -finds the position of a specified input value (the search "key") within -an array sorted by key value. - -In each step, the algorithm compares the search key value with the key -value of the middle element of the array. - -If the keys match, then a matching element has been found and its index, -or position, is returned. - -Otherwise, if the search key is less than the middle element's key, then -the algorithm repeats its action on the sub-array to the left of the -middle element or, if the search key is greater, on the sub-array to the -right. - -If the remaining array to be searched is empty, then the key cannot be -found in the array and a special "not found" indication is returned. - -A binary search halves the number of items to check with each iteration, -so locating an item (or determining its absence) takes logarithmic time. -A binary search is a dichotomic divide and conquer search algorithm. - -## Hints - -Haskell has support for many types of arrays. This exercise uses immutable, -boxed, non-strict arrays from `Data.Array`. You can read more about the use of -these arrays on: - -- [A Gentle Introduction to Haskell: Arrays][1] -- The documentation for [`Data.Array`][2] - -As an optional extension to this exercise, try and make the `find` function -work for arrays with arbitrary bounds, e.g. arrays for which the first index is -not necessarily 0. - -[1]: https://www.haskell.org/tutorial/arrays.html -[2]: http://hackage.haskell.org/package/array/docs/Data-Array.html - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [http://en.wikipedia.org/wiki/Binary_search_algorithm](http://en.wikipedia.org/wiki/Binary_search_algorithm) - -## 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/practice/binary/.docs/instructions.md b/exercises/practice/binary/.docs/instructions.md new file mode 100644 index 000000000..3cfde215f --- /dev/null +++ b/exercises/practice/binary/.docs/instructions.md @@ -0,0 +1,31 @@ +# Instructions + +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`. diff --git a/exercises/practice/binary/.meta/config.json b/exercises/practice/binary/.meta/config.json new file mode 100644 index 000000000..669f8779a --- /dev/null +++ b/exercises/practice/binary/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "All of Computer Science", + "source_url": "http://www.wolframalpha.com/input/?i=binary&a=*C.binary-_*MathWorld-" +} diff --git a/exercises/practice/binary/README.md b/exercises/practice/binary/README.md deleted file mode 100644 index 3c55dd016..000000000 --- a/exercises/practice/binary/README.md +++ /dev/null @@ -1,91 +0,0 @@ -# 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`. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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. diff --git a/exercises/practice/bob/.meta/hints.md b/exercises/practice/bob/.docs/instructions.append.md similarity index 100% rename from exercises/practice/bob/.meta/hints.md rename to exercises/practice/bob/.docs/instructions.append.md diff --git a/exercises/practice/bob/.docs/instructions.md b/exercises/practice/bob/.docs/instructions.md new file mode 100644 index 000000000..edddb1413 --- /dev/null +++ b/exercises/practice/bob/.docs/instructions.md @@ -0,0 +1,16 @@ +# Instructions + +Bob is a lackadaisical teenager. In conversation, his responses are very limited. + +Bob answers 'Sure.' if you ask him a question, such as "How are you?". + +He answers 'Whoa, chill out!' if you YELL AT HIM (in all capitals). + +He answers 'Calm down, I know what I'm doing!' if you yell a question at him. + +He says 'Fine. Be that way!' if you address him without actually saying +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. diff --git a/exercises/practice/bob/.meta/config.json b/exercises/practice/bob/.meta/config.json new file mode 100644 index 000000000..c98bfb899 --- /dev/null +++ b/exercises/practice/bob/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Inspired by the 'Deaf Grandma' exercise in Chris Pine's Learn to Program tutorial.", + "source_url": "http://pine.fm/LearnToProgram/?Chapter=06" +} diff --git a/exercises/practice/bob/README.md b/exercises/practice/bob/README.md deleted file mode 100644 index ee35f7f7d..000000000 --- a/exercises/practice/bob/README.md +++ /dev/null @@ -1,118 +0,0 @@ -# Bob - -Bob is a lackadaisical teenager. In conversation, his responses are very limited. - -Bob answers 'Sure.' if you ask him a question, such as "How are you?". - -He answers 'Whoa, chill out!' if you YELL AT HIM (in all capitals). - -He answers 'Calm down, I know what I'm doing!' if you yell a question at him. - -He says 'Fine. Be that way!' if you address him without actually saying -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. - -## Hints - -You need to implement the `responseFor` function that returns Bob's response -for a given input. You can use the provided signature if you are unsure -about the types, but don't let it restrict your creativity: - -```haskell -responseFor :: String -> String -``` - -To solve this exercise you may read up on: - -- [Guards][guards] - -[guards]: https://www.futurelearn.com/courses/functional-programming-haskell/0/steps/27226 - -This exercise works with textual data. For historical reasons, Haskell's -`String` type is synonymous with `[Char]`, a list of characters. For more -efficient handling of textual data, the `Text` type can be used. - -As an optional extension to this exercise, you can - -- Read about [string types](https://haskell-lang.org/tutorial/string-types) in Haskell. -- Add `- text` to your list of dependencies in package.yaml. -- Import `Data.Text` in [the following way](https://hackernoon.com/4-steps-to-a-better-imports-list-in-haskell-43a3d868273c): - - ```haskell - import qualified Data.Text as T - import Data.Text (Text) - ``` - -- You can now write e.g. `responseFor :: Text -> Text` and refer to `Data.Text` combinators as e.g. `T.isSuffixOf`. -- Look up the documentation for [`Data.Text`](https://hackage.haskell.org/package/text/docs/Data-Text.html), -- You can then replace all occurrences of `String` with `Text` in Bob.hs: - - ```haskell - responseFor :: Text -> Text - ``` - -This part is entirely optional. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Inspired by the 'Deaf Grandma' exercise in Chris Pine's Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=06](http://pine.fm/LearnToProgram/?Chapter=06) - -## 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/practice/bowling/.meta/hints.md b/exercises/practice/bowling/.docs/instructions.append.md similarity index 100% rename from exercises/practice/bowling/.meta/hints.md rename to exercises/practice/bowling/.docs/instructions.append.md diff --git a/exercises/practice/bowling/README.md b/exercises/practice/bowling/.docs/instructions.md similarity index 51% rename from exercises/practice/bowling/README.md rename to exercises/practice/bowling/.docs/instructions.md index d4eb9d271..be9b27faf 100644 --- a/exercises/practice/bowling/README.md +++ b/exercises/practice/bowling/.docs/instructions.md @@ -1,4 +1,4 @@ -# Bowling +# Instructions Score a bowling game. @@ -59,84 +59,3 @@ support two operations: argument is the number of pins knocked down. * `score() : int` is called only at the very end of the game. It returns the total score for that game. - -## Hints - -To complete this exercise you need to implement the function `score`, -that takes a sequence of bowling *rolls* and returns the final score or -the appropriate error: - -```haskell -score :: [Int] -> Either BowlingError Int - -data BowlingError = IncompleteGame - | InvalidRoll { rollIndex :: Int, rollValue :: Int } - deriving (Eq, Show) -``` - -You will find these definitions already in place, but it is up to you -to define the function. - -Keep in mind that the test suite expects the rolls to be numbered -starting from zero. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -The Bowling Game Kata at but UncleBob [http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata](http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata) - -## 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/practice/bowling/.meta/config.json b/exercises/practice/bowling/.meta/config.json new file mode 100644 index 000000000..5c26c43c0 --- /dev/null +++ b/exercises/practice/bowling/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "The Bowling Game Kata at but UncleBob", + "source_url": "http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata" +} diff --git a/exercises/practice/change/.docs/instructions.md b/exercises/practice/change/.docs/instructions.md new file mode 100644 index 000000000..59f4f4f90 --- /dev/null +++ b/exercises/practice/change/.docs/instructions.md @@ -0,0 +1,17 @@ +# Instructions + +Correctly determine the fewest number of coins to be given to a customer such +that the sum of the coins' value would equal the correct amount of change. + +## For example + +- An input of 15 with [1, 5, 10, 25, 100] should return one nickel (5) + and one dime (10) or [5, 10] +- An input of 40 with [1, 5, 10, 25, 100] should return one nickel (5) + and one dime (10) and one quarter (25) or [5, 10, 25] + +## Edge cases + +- Does your algorithm work for any given set of coins? +- Can you ask for negative change? +- Can you ask for a change value smaller than the smallest coin value? diff --git a/exercises/practice/change/.meta/config.json b/exercises/practice/change/.meta/config.json new file mode 100644 index 000000000..c4bce7058 --- /dev/null +++ b/exercises/practice/change/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Software Craftsmanship - Coin Change Kata", + "source_url": "https://web.archive.org/web/20130115115225/http://craftsmanship.sv.cmu.edu:80/exercises/coin-change-kata" +} diff --git a/exercises/practice/change/README.md b/exercises/practice/change/README.md deleted file mode 100644 index 56b178132..000000000 --- a/exercises/practice/change/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# Change - -Correctly determine the fewest number of coins to be given to a customer such -that the sum of the coins' value would equal the correct amount of change. - -## For example - -- An input of 15 with [1, 5, 10, 25, 100] should return one nickel (5) - and one dime (10) or [5, 10] -- An input of 40 with [1, 5, 10, 25, 100] should return one nickel (5) - and one dime (10) and one quarter (25) or [5, 10, 25] - -## Edge cases - -- Does your algorithm work for any given set of coins? -- Can you ask for negative change? -- Can you ask for a change value smaller than the smallest coin value? - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Software Craftsmanship - Coin Change Kata [https://web.archive.org/web/20130115115225/http://craftsmanship.sv.cmu.edu:80/exercises/coin-change-kata](https://web.archive.org/web/20130115115225/http://craftsmanship.sv.cmu.edu:80/exercises/coin-change-kata) - -## 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/practice/clock/.meta/hints.md b/exercises/practice/clock/.docs/instructions.append.md similarity index 100% rename from exercises/practice/clock/.meta/hints.md rename to exercises/practice/clock/.docs/instructions.append.md diff --git a/exercises/practice/clock/.docs/instructions.md b/exercises/practice/clock/.docs/instructions.md new file mode 100644 index 000000000..a1efc7890 --- /dev/null +++ b/exercises/practice/clock/.docs/instructions.md @@ -0,0 +1,7 @@ +# Instructions + +Implement a clock that handles times without dates. + +You should be able to add and subtract minutes to it. + +Two clocks that represent the same time should be equal to each other. diff --git a/exercises/practice/clock/.meta/config.json b/exercises/practice/clock/.meta/config.json new file mode 100644 index 000000000..dbc9a1d67 --- /dev/null +++ b/exercises/practice/clock/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Pairing session with Erin Drummond", + "source_url": "https://twitter.com/ebdrummond" +} diff --git a/exercises/practice/clock/README.md b/exercises/practice/clock/README.md deleted file mode 100644 index ba3812763..000000000 --- a/exercises/practice/clock/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# Clock - -Implement a clock that handles times without dates. - -You should be able to add and subtract minutes to it. - -Two clocks that represent the same time should be equal to each other. - -## Hints - -It's a 24 hour clock going from "00:00" to "23:59". - -To complete this exercise you need to define the data type `Clock`, -add an `Eq` instance, and implement the functions: - -- addDelta -- fromHourMin -- toString - -`addDelta` adds a duration, expressed in hours and minutes, to a given time, -represented by an instance of `Clock`. - -`fromHourMin` takes an hour and minute, and returns an instance of `Clock` with -those hours and minutes. - -`toString` takes an instance of `Clock` and returns a string representation -of the clock, in 0-padded format like "08:03" or "22:35" - -You will find a dummy data declaration and type signatures already in place, -but it is up to you to define the functions and create a meaningful data type, -newtype or type synonym. - -If you need help getting started with types, take a look at: -- [Data Types in 5 Steps][types] - -[types]: https://mmhaskell.com/blog/2017/12/24/haskell-data-types-in-5-steps - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Pairing session with Erin Drummond [https://twitter.com/ebdrummond](https://twitter.com/ebdrummond) - -## 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/practice/collatz-conjecture/.docs/instructions.md b/exercises/practice/collatz-conjecture/.docs/instructions.md new file mode 100644 index 000000000..f8c76e7f1 --- /dev/null +++ b/exercises/practice/collatz-conjecture/.docs/instructions.md @@ -0,0 +1,27 @@ +# Instructions + +The Collatz Conjecture or 3x+1 problem can be summarized as follows: + +Take any positive integer n. If n is even, divide n by 2 to get n / 2. If n is +odd, multiply n by 3 and add 1 to get 3n + 1. Repeat the process indefinitely. +The conjecture states that no matter which number you start with, you will +always reach 1 eventually. + +Given a number n, return the number of steps required to reach 1. + +## Examples + +Starting with n = 12, the steps would be as follows: + +0. 12 +1. 6 +2. 3 +3. 10 +4. 5 +5. 16 +6. 8 +7. 4 +8. 2 +9. 1 + +Resulting in 9 steps. So for input n = 12, the return value would be 9. diff --git a/exercises/practice/collatz-conjecture/.meta/config.json b/exercises/practice/collatz-conjecture/.meta/config.json new file mode 100644 index 000000000..c638ce658 --- /dev/null +++ b/exercises/practice/collatz-conjecture/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "An unsolved problem in mathematics named after mathematician Lothar Collatz", + "source_url": "https://en.wikipedia.org/wiki/3x_%2B_1_problem" +} diff --git a/exercises/practice/collatz-conjecture/README.md b/exercises/practice/collatz-conjecture/README.md deleted file mode 100644 index 0a65b999b..000000000 --- a/exercises/practice/collatz-conjecture/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# Collatz Conjecture - -The Collatz Conjecture or 3x+1 problem can be summarized as follows: - -Take any positive integer n. If n is even, divide n by 2 to get n / 2. If n is -odd, multiply n by 3 and add 1 to get 3n + 1. Repeat the process indefinitely. -The conjecture states that no matter which number you start with, you will -always reach 1 eventually. - -Given a number n, return the number of steps required to reach 1. - -## Examples - -Starting with n = 12, the steps would be as follows: - -0. 12 -1. 6 -2. 3 -3. 10 -4. 5 -5. 16 -6. 8 -7. 4 -8. 2 -9. 1 - -Resulting in 9 steps. So for input n = 12, the return value would be 9. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -An unsolved problem in mathematics named after mathematician Lothar Collatz [https://en.wikipedia.org/wiki/3x_%2B_1_problem](https://en.wikipedia.org/wiki/3x_%2B_1_problem) - -## 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/practice/complex-numbers/README.md b/exercises/practice/complex-numbers/.docs/instructions.md similarity index 51% rename from exercises/practice/complex-numbers/README.md rename to exercises/practice/complex-numbers/.docs/instructions.md index 91b20a39b..267ff6151 100644 --- a/exercises/practice/complex-numbers/README.md +++ b/exercises/practice/complex-numbers/.docs/instructions.md @@ -1,4 +1,4 @@ -# Complex Numbers +# Instructions A complex number is a number in the form `a + b * i` where `a` and `b` are real and `i` satisfies `i^2 = -1`. @@ -27,63 +27,3 @@ Implement the following operations: Assume the programming language you are using does not have an implementation of complex numbers. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [https://en.wikipedia.org/wiki/Complex_number](https://en.wikipedia.org/wiki/Complex_number) - -## 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/practice/complex-numbers/.meta/config.json b/exercises/practice/complex-numbers/.meta/config.json new file mode 100644 index 000000000..9c209d8b9 --- /dev/null +++ b/exercises/practice/complex-numbers/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Complex_number" +} diff --git a/exercises/practice/connect/.docs/instructions.md b/exercises/practice/connect/.docs/instructions.md new file mode 100644 index 000000000..2fa003a83 --- /dev/null +++ b/exercises/practice/connect/.docs/instructions.md @@ -0,0 +1,31 @@ +# Instructions + +Compute the result for a game of Hex / Polygon. + +The abstract boardgame known as +[Hex](https://en.wikipedia.org/wiki/Hex_%28board_game%29) / Polygon / +CON-TAC-TIX is quite simple in rules, though complex in practice. Two players +place stones on a parallelogram with hexagonal fields. The player to connect his/her +stones to the opposite side first wins. The four sides of the parallelogram are +divided between the two players (i.e. one player gets assigned a side and the +side directly opposite it and the other player gets assigned the two other +sides). + +Your goal is to build a program that given a simple representation of a board +computes the winner (or lack thereof). Note that all games need not be "fair". +(For example, players may have mismatched piece counts or the game's board might +have a different width and height.) + +The boards look like this: + +```text +. O . X . + . X X O . + O O O X . + . X O X O + X O O O X +``` + +"Player `O`" plays from top to bottom, "Player `X`" plays from left to right. In +the above example `O` has made a connection from left to right but nobody has +won since `O` didn't connect top and bottom. diff --git a/exercises/practice/connect/.meta/config.json b/exercises/practice/connect/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/connect/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/connect/README.md b/exercises/practice/connect/README.md deleted file mode 100644 index 3954328fd..000000000 --- a/exercises/practice/connect/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# Connect - -Compute the result for a game of Hex / Polygon. - -The abstract boardgame known as -[Hex](https://en.wikipedia.org/wiki/Hex_%28board_game%29) / Polygon / -CON-TAC-TIX is quite simple in rules, though complex in practice. Two players -place stones on a parallelogram with hexagonal fields. The player to connect his/her -stones to the opposite side first wins. The four sides of the parallelogram are -divided between the two players (i.e. one player gets assigned a side and the -side directly opposite it and the other player gets assigned the two other -sides). - -Your goal is to build a program that given a simple representation of a board -computes the winner (or lack thereof). Note that all games need not be "fair". -(For example, players may have mismatched piece counts or the game's board might -have a different width and height.) - -The boards look like this: - -```text -. O . X . - . X X O . - O O O X . - . X O X O - X O O O X -``` - -"Player `O`" plays from top to bottom, "Player `X`" plays from left to right. In -the above example `O` has made a connection from left to right but nobody has -won since `O` didn't connect top and bottom. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/crypto-square/README.md b/exercises/practice/crypto-square/.docs/instructions.md similarity index 53% rename from exercises/practice/crypto-square/README.md rename to exercises/practice/crypto-square/.docs/instructions.md index 961ae02ac..41615f819 100644 --- a/exercises/practice/crypto-square/README.md +++ b/exercises/practice/crypto-square/.docs/instructions.md @@ -1,4 +1,4 @@ -# Crypto Square +# Instructions Implement the classic method for composing secret messages called a square code. @@ -71,63 +71,3 @@ ciphertext back in to the original message: "aohghn " "sseoau " ``` - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -J Dalbey's Programming Practice problems [http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html](http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html) - -## 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/practice/crypto-square/.meta/config.json b/exercises/practice/crypto-square/.meta/config.json new file mode 100644 index 000000000..4f6d17a38 --- /dev/null +++ b/exercises/practice/crypto-square/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "J Dalbey's Programming Practice problems", + "source_url": "http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html" +} diff --git a/exercises/practice/custom-set/.meta/hints.md b/exercises/practice/custom-set/.docs/instructions.append.md similarity index 100% rename from exercises/practice/custom-set/.meta/hints.md rename to exercises/practice/custom-set/.docs/instructions.append.md diff --git a/exercises/practice/custom-set/.docs/instructions.md b/exercises/practice/custom-set/.docs/instructions.md new file mode 100644 index 000000000..e4931b058 --- /dev/null +++ b/exercises/practice/custom-set/.docs/instructions.md @@ -0,0 +1,8 @@ +# Instructions + +Create a custom set type. + +Sometimes it is necessary to define a custom data structure of some +type, like a set. In this exercise you will define your own set. How it +works internally doesn't matter, as long as it behaves like a set of +unique elements. diff --git a/exercises/practice/custom-set/.meta/config.json b/exercises/practice/custom-set/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/custom-set/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/custom-set/README.md b/exercises/practice/custom-set/README.md deleted file mode 100644 index be05cf2cc..000000000 --- a/exercises/practice/custom-set/README.md +++ /dev/null @@ -1,93 +0,0 @@ -# Custom Set - -Create a custom set type. - -Sometimes it is necessary to define a custom data structure of some -type, like a set. In this exercise you will define your own set. How it -works internally doesn't matter, as long as it behaves like a set of -unique elements. - -## Hints - -To complete this exercise, you need to create the data type `CustomSet`, -with `Eq` and `Show` instances, and implement the following functions: - -- `delete` -- `difference` -- `empty` -- `fromList` -- `insert` -- `intersection` -- `isDisjointFrom` -- `isSubsetOf` -- `member` -- `null` -- `size` -- `toList` -- `union` - -You will find a dummy data declaration and type signatures already in place, -but it is up to you to define the functions and create a meaningful data type, -newtype or type synonym. - -If you're interested in writing an efficient implementation but don't quite -know where to start, the best primer I know of is Chris Okasaki's -"Purely Functional Data Structures", which you can read a version of here: -https://www.cs.cmu.edu/~rwh/theses/okasaki.pdf - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/diamond/.meta/hints.md b/exercises/practice/diamond/.docs/instructions.append.md similarity index 100% rename from exercises/practice/diamond/.meta/hints.md rename to exercises/practice/diamond/.docs/instructions.append.md diff --git a/exercises/practice/diamond/.docs/instructions.md b/exercises/practice/diamond/.docs/instructions.md new file mode 100644 index 000000000..1de7016f0 --- /dev/null +++ b/exercises/practice/diamond/.docs/instructions.md @@ -0,0 +1,53 @@ +# Instructions + +The diamond kata takes as its input a letter, and outputs it in a diamond +shape. Given a letter, it prints a diamond starting with 'A', with the +supplied letter at the widest point. + +## Requirements + +* The first row contains one 'A'. +* The last row contains one 'A'. +* All rows, except the first and last, have exactly two identical letters. +* All rows have as many trailing spaces as leading spaces. (This might be 0). +* The diamond is horizontally symmetric. +* The diamond is vertically symmetric. +* The diamond has a square shape (width equals height). +* The letters form a diamond shape. +* The top half has the letters in ascending order. +* The bottom half has the letters in descending order. +* The four corners (containing the spaces) are triangles. + +## Examples + +In the following examples, spaces are indicated by `·` characters. + +Diamond for letter 'A': + +```text +A +``` + +Diamond for letter 'C': + +```text +··A·· +·B·B· +C···C +·B·B· +··A·· +``` + +Diamond for letter 'E': + +```text +····A···· +···B·B··· +··C···C·· +·D·····D· +E·······E +·D·····D· +··C···C·· +···B·B··· +····A···· +``` diff --git a/exercises/practice/diamond/.meta/config.json b/exercises/practice/diamond/.meta/config.json new file mode 100644 index 000000000..6fdcc7af8 --- /dev/null +++ b/exercises/practice/diamond/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Seb Rose", + "source_url": "http://claysnow.co.uk/recycling-tests-in-tdd/" +} diff --git a/exercises/practice/diamond/README.md b/exercises/practice/diamond/README.md deleted file mode 100644 index 88e684e63..000000000 --- a/exercises/practice/diamond/README.md +++ /dev/null @@ -1,154 +0,0 @@ -# Diamond - -The diamond kata takes as its input a letter, and outputs it in a diamond -shape. Given a letter, it prints a diamond starting with 'A', with the -supplied letter at the widest point. - -## Requirements - -* The first row contains one 'A'. -* The last row contains one 'A'. -* All rows, except the first and last, have exactly two identical letters. -* All rows have as many trailing spaces as leading spaces. (This might be 0). -* The diamond is horizontally symmetric. -* The diamond is vertically symmetric. -* The diamond has a square shape (width equals height). -* The letters form a diamond shape. -* The top half has the letters in ascending order. -* The bottom half has the letters in descending order. -* The four corners (containing the spaces) are triangles. - -## Examples - -In the following examples, spaces are indicated by `·` characters. - -Diamond for letter 'A': - -```text -A -``` - -Diamond for letter 'C': - -```text -··A·· -·B·B· -C···C -·B·B· -··A·· -``` - -Diamond for letter 'E': - -```text -····A···· -···B·B··· -··C···C·· -·D·····D· -E·······E -·D·····D· -··C···C·· -···B·B··· -····A···· -``` - -## Hints - -You need to implement the `diamond` function which prints a diamond starting at -`A` with the given character at its widest points. You can use the provided -signature if you are unsure about the types, but don't let it restrict your -creativity: - -```haskell -diamond :: Char -> Maybe [String] -``` - -This exercise works with textual data. For historical reasons, Haskell's -`String` type is synonymous with `[Char]`, a list of characters. For more -efficient handling of textual data, the `Text` type can be used. - -As an optional extension to this exercise, you can - -- Read about [string types](https://haskell-lang.org/tutorial/string-types) in - Haskell. -- Add `- text` to your list of dependencies in package.yaml. -- Import `Data.Text` in [the following - way](https://hackernoon.com/4-steps-to-a-better-imports-list-in-haskell-43a3d868273c): - -```haskell -import qualified Data.Text as T -import Data.Text (Text) -``` - -- You can now write e.g. `diamond :: Char -> Maybe [Text]` and refer to - `Data.Text` combinators as e.g. `T.pack`, -- Look up the documentation for - [`Data.Text`](https://hackage.haskell.org/package/text/docs/Data-Text.html), -- You can then replace all occurrences of `String` with `Text` in Diamond.hs: - -```haskell -diamond :: Char -> Maybe [Text] -``` - -This part is entirely optional. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Seb Rose [http://claysnow.co.uk/recycling-tests-in-tdd/](http://claysnow.co.uk/recycling-tests-in-tdd/) - -## 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/practice/difference-of-squares/.docs/instructions.md b/exercises/practice/difference-of-squares/.docs/instructions.md new file mode 100644 index 000000000..c3999e86a --- /dev/null +++ b/exercises/practice/difference-of-squares/.docs/instructions.md @@ -0,0 +1,17 @@ +# Instructions + +Find the difference between the square of the sum and the sum of the squares of the first N natural numbers. + +The square of the sum of the first ten natural numbers is +(1 + 2 + ... + 10)² = 55² = 3025. + +The sum of the squares of the first ten natural numbers is +1² + 2² + ... + 10² = 385. + +Hence the difference between the square of the sum of the first +ten natural numbers and the sum of the squares of the first ten +natural numbers is 3025 - 385 = 2640. + +You are not expected to discover an efficient solution to this yourself from +first principles; research is allowed, indeed, encouraged. Finding the best +algorithm for the problem is a key skill in software engineering. diff --git a/exercises/practice/difference-of-squares/.meta/config.json b/exercises/practice/difference-of-squares/.meta/config.json new file mode 100644 index 000000000..7d5c33a19 --- /dev/null +++ b/exercises/practice/difference-of-squares/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Problem 6 at Project Euler", + "source_url": "http://projecteuler.net/problem=6" +} diff --git a/exercises/practice/difference-of-squares/README.md b/exercises/practice/difference-of-squares/README.md deleted file mode 100644 index 43cb3dc01..000000000 --- a/exercises/practice/difference-of-squares/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# Difference Of Squares - -Find the difference between the square of the sum and the sum of the squares of the first N natural numbers. - -The square of the sum of the first ten natural numbers is -(1 + 2 + ... + 10)² = 55² = 3025. - -The sum of the squares of the first ten natural numbers is -1² + 2² + ... + 10² = 385. - -Hence the difference between the square of the sum of the first -ten natural numbers and the sum of the squares of the first ten -natural numbers is 3025 - 385 = 2640. - -You are not expected to discover an efficient solution to this yourself from -first principles; research is allowed, indeed, encouraged. Finding the best -algorithm for the problem is a key skill in software engineering. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Problem 6 at Project Euler [http://projecteuler.net/problem=6](http://projecteuler.net/problem=6) - -## 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/practice/dnd-character/.meta/hints.md b/exercises/practice/dnd-character/.docs/instructions.append.md similarity index 100% rename from exercises/practice/dnd-character/.meta/hints.md rename to exercises/practice/dnd-character/.docs/instructions.append.md diff --git a/exercises/practice/dnd-character/.docs/instructions.md b/exercises/practice/dnd-character/.docs/instructions.md new file mode 100644 index 000000000..53d9f9851 --- /dev/null +++ b/exercises/practice/dnd-character/.docs/instructions.md @@ -0,0 +1,33 @@ +# Instructions + +For a game of [Dungeons & Dragons][DND], each player starts by generating a +character they can play with. This character has, among other things, six +abilities; strength, dexterity, constitution, intelligence, wisdom and +charisma. These six abilities have scores that are determined randomly. You +do this by rolling four 6-sided dice and record the sum of the largest three +dice. You do this six times, once for each ability. + +Your character's initial hitpoints are 10 + your character's constitution +modifier. You find your character's constitution modifier by subtracting 10 +from your character's constitution, divide by 2 and round down. + +Write a random character generator that follows the rules above. + +For example, the six throws of four dice may look like: + +* 5, 3, 1, 6: You discard the 1 and sum 5 + 3 + 6 = 14, which you assign to strength. +* 3, 2, 5, 3: You discard the 2 and sum 3 + 5 + 3 = 11, which you assign to dexterity. +* 1, 1, 1, 1: You discard the 1 and sum 1 + 1 + 1 = 3, which you assign to constitution. +* 2, 1, 6, 6: You discard the 1 and sum 2 + 6 + 6 = 14, which you assign to intelligence. +* 3, 5, 3, 4: You discard the 3 and sum 5 + 3 + 4 = 12, which you assign to wisdom. +* 6, 6, 6, 6: You discard the 6 and sum 6 + 6 + 6 = 18, which you assign to charisma. + +Because constitution is 3, the constitution modifier is -4 and the hitpoints are 6. + +## Notes + +Most programming languages feature (pseudo-)random generators, but few +programming languages are designed to roll dice. One such language is [Troll]. + +[DND]: https://en.wikipedia.org/wiki/Dungeons_%26_Dragons +[Troll]: http://hjemmesider.diku.dk/~torbenm/Troll/ diff --git a/exercises/practice/dnd-character/.meta/config.json b/exercises/practice/dnd-character/.meta/config.json new file mode 100644 index 000000000..f22925547 --- /dev/null +++ b/exercises/practice/dnd-character/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Simon Shine, Erik Schierboom", + "source_url": "https://github.com/exercism/problem-specifications/issues/616#issuecomment-437358945" +} diff --git a/exercises/practice/dnd-character/README.md b/exercises/practice/dnd-character/README.md deleted file mode 100644 index 9c911bd3e..000000000 --- a/exercises/practice/dnd-character/README.md +++ /dev/null @@ -1,101 +0,0 @@ -# D&D Character - -For a game of [Dungeons & Dragons][DND], each player starts by generating a -character they can play with. This character has, among other things, six -abilities; strength, dexterity, constitution, intelligence, wisdom and -charisma. These six abilities have scores that are determined randomly. You -do this by rolling four 6-sided dice and record the sum of the largest three -dice. You do this six times, once for each ability. - -Your character's initial hitpoints are 10 + your character's constitution -modifier. You find your character's constitution modifier by subtracting 10 -from your character's constitution, divide by 2 and round down. - -Write a random character generator that follows the rules above. - -For example, the six throws of four dice may look like: - -* 5, 3, 1, 6: You discard the 1 and sum 5 + 3 + 6 = 14, which you assign to strength. -* 3, 2, 5, 3: You discard the 2 and sum 3 + 5 + 3 = 11, which you assign to dexterity. -* 1, 1, 1, 1: You discard the 1 and sum 1 + 1 + 1 = 3, which you assign to constitution. -* 2, 1, 6, 6: You discard the 1 and sum 2 + 6 + 6 = 14, which you assign to intelligence. -* 3, 5, 3, 4: You discard the 3 and sum 5 + 3 + 4 = 12, which you assign to wisdom. -* 6, 6, 6, 6: You discard the 6 and sum 6 + 6 + 6 = 18, which you assign to charisma. - -Because constitution is 3, the constitution modifier is -4 and the hitpoints are 6. - -## Notes - -Most programming languages feature (pseudo-)random generators, but few -programming languages are designed to roll dice. One such language is [Troll]. - -[DND]: https://en.wikipedia.org/wiki/Dungeons_%26_Dragons -[Troll]: http://hjemmesider.diku.dk/~torbenm/Troll/ - -## Hints - -This exercise uses QuickCheck generators. Here are some resources to get started: - -- [A QuickCheck Tutorial: Generators](https://www.stackbuilders.com/news/a-quickcheck-tutorial-generators) -- The documentation for [Test.QuickCheck.Gen](http://hackage.haskell.org/package/QuickCheck/docs/Test-QuickCheck-Gen.html) - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Simon Shine, Erik Schierboom [https://github.com/exercism/problem-specifications/issues/616#issuecomment-437358945](https://github.com/exercism/problem-specifications/issues/616#issuecomment-437358945) - -## 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/practice/dominoes/.docs/instructions.md b/exercises/practice/dominoes/.docs/instructions.md new file mode 100644 index 000000000..47f05a60d --- /dev/null +++ b/exercises/practice/dominoes/.docs/instructions.md @@ -0,0 +1,15 @@ +# Instructions + +Make a chain of dominoes. + +Compute a way to order a given set of dominoes in such a way that they form a +correct domino chain (the dots on one half of a stone match the dots on the +neighbouring half of an adjacent stone) and that dots on the halves of the +stones which don't have a neighbour (the first and last stone) match each other. + +For example given the stones `[2|1]`, `[2|3]` and `[1|3]` you should compute something +like `[1|2] [2|3] [3|1]` or `[3|2] [2|1] [1|3]` or `[1|3] [3|2] [2|1]` etc, where the first and last numbers are the same. + +For stones `[1|2]`, `[4|1]` and `[2|3]` the resulting chain is not valid: `[4|1] [1|2] [2|3]`'s first and last numbers are not the same. 4 != 3 + +Some test cases may use duplicate stones in a chain solution, assume that multiple Domino sets are being used. diff --git a/exercises/practice/dominoes/.meta/config.json b/exercises/practice/dominoes/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/dominoes/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/dominoes/README.md b/exercises/practice/dominoes/README.md deleted file mode 100644 index d4ee0f8d4..000000000 --- a/exercises/practice/dominoes/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# Dominoes - -Make a chain of dominoes. - -Compute a way to order a given set of dominoes in such a way that they form a -correct domino chain (the dots on one half of a stone match the dots on the -neighbouring half of an adjacent stone) and that dots on the halves of the -stones which don't have a neighbour (the first and last stone) match each other. - -For example given the stones `[2|1]`, `[2|3]` and `[1|3]` you should compute something -like `[1|2] [2|3] [3|1]` or `[3|2] [2|1] [1|3]` or `[1|3] [3|2] [2|1]` etc, where the first and last numbers are the same. - -For stones `[1|2]`, `[4|1]` and `[2|3]` the resulting chain is not valid: `[4|1] [1|2] [2|3]`'s first and last numbers are not the same. 4 != 3 - -Some test cases may use duplicate stones in a chain solution, assume that multiple Domino sets are being used. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/etl/.meta/hints.md b/exercises/practice/etl/.docs/instructions.append.md similarity index 100% rename from exercises/practice/etl/.meta/hints.md rename to exercises/practice/etl/.docs/instructions.append.md diff --git a/exercises/practice/etl/.docs/instructions.md b/exercises/practice/etl/.docs/instructions.md new file mode 100644 index 000000000..ff96906c6 --- /dev/null +++ b/exercises/practice/etl/.docs/instructions.md @@ -0,0 +1,47 @@ +# Instructions + +We are going to do the `Transform` step of an Extract-Transform-Load. + +## ETL + +Extract-Transform-Load (ETL) is a fancy way of saying, "We have some crufty, legacy data over in this system, and now we need it in this shiny new system over here, so +we're going to migrate this." + +(Typically, this is followed by, "We're only going to need to run this +once." That's then typically followed by much forehead slapping and +moaning about how stupid we could possibly be.) + +## The goal + +We're going to extract some Scrabble scores from a legacy system. + +The old system stored a list of letters per score: + +- 1 point: "A", "E", "I", "O", "U", "L", "N", "R", "S", "T", +- 2 points: "D", "G", +- 3 points: "B", "C", "M", "P", +- 4 points: "F", "H", "V", "W", "Y", +- 5 points: "K", +- 8 points: "J", "X", +- 10 points: "Q", "Z", + +The shiny new Scrabble system instead stores the score per letter, which +makes it much faster and easier to calculate the score for a word. It +also stores the letters in lower-case regardless of the case of the +input letters: + +- "a" is worth 1 point. +- "b" is worth 3 points. +- "c" is worth 3 points. +- "d" is worth 2 points. +- Etc. + +Your mission, should you choose to accept it, is to transform the legacy data +format to the shiny new format. + +## Notes + +A final note about scoring, Scrabble is played around the world in a +variety of languages, each with its own unique scoring table. For +example, an "E" is scored at 2 in the Māori-language version of the +game while being scored at 4 in the Hawaiian-language version. diff --git a/exercises/practice/etl/.meta/config.json b/exercises/practice/etl/.meta/config.json new file mode 100644 index 000000000..63ea2caed --- /dev/null +++ b/exercises/practice/etl/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "The Jumpstart Lab team", + "source_url": "http://jumpstartlab.com" +} diff --git a/exercises/practice/etl/README.md b/exercises/practice/etl/README.md deleted file mode 100644 index eba82a780..000000000 --- a/exercises/practice/etl/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# ETL - -We are going to do the `Transform` step of an Extract-Transform-Load. - -### ETL - -Extract-Transform-Load (ETL) is a fancy way of saying, "We have some crufty, legacy data over in this system, and now we need it in this shiny new system over here, so -we're going to migrate this." - -(Typically, this is followed by, "We're only going to need to run this -once." That's then typically followed by much forehead slapping and -moaning about how stupid we could possibly be.) - -### The goal - -We're going to extract some Scrabble scores from a legacy system. - -The old system stored a list of letters per score: - -- 1 point: "A", "E", "I", "O", "U", "L", "N", "R", "S", "T", -- 2 points: "D", "G", -- 3 points: "B", "C", "M", "P", -- 4 points: "F", "H", "V", "W", "Y", -- 5 points: "K", -- 8 points: "J", "X", -- 10 points: "Q", "Z", - -The shiny new Scrabble system instead stores the score per letter, which -makes it much faster and easier to calculate the score for a word. It -also stores the letters in lower-case regardless of the case of the -input letters: - -- "a" is worth 1 point. -- "b" is worth 3 points. -- "c" is worth 3 points. -- "d" is worth 2 points. -- Etc. - -Your mission, should you choose to accept it, is to transform the legacy data -format to the shiny new format. - -### Notes - -A final note about scoring, Scrabble is played around the world in a -variety of languages, each with its own unique scoring table. For -example, an "E" is scored at 2 in the Māori-language version of the -game while being scored at 4 in the Hawaiian-language version. - -## Hints - -This exercise works with textual data. For historical reasons, Haskell's -`String` type is synonymous with `[Char]`, a list of characters. For more -efficient handling of textual data, the `Text` type can be used. - -As an optional extension to this exercise, you can - -- Read about [string types](https://haskell-lang.org/tutorial/string-types) in Haskell. -- Add `- text` to your list of dependencies in package.yaml. -- Import `Data.Text` in [the following way](https://hackernoon.com/4-steps-to-a-better-imports-list-in-haskell-43a3d868273c): - - import qualified Data.Text as T - import Data.Text (Text) - -- You can now write e.g. `transform :: Map Int Text -> Map Char Int` and refer to `Data.Text` combinators as e.g. `T.toLower`. -- Look up the documentation for [`Data.Text`](https://hackage.haskell.org/package/text/docs/Data-Text.html). - -This part is entirely optional. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -The Jumpstart Lab team [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. diff --git a/exercises/practice/food-chain/.meta/hints.md b/exercises/practice/food-chain/.docs/instructions.append.md similarity index 100% rename from exercises/practice/food-chain/.meta/hints.md rename to exercises/practice/food-chain/.docs/instructions.append.md diff --git a/exercises/practice/food-chain/README.md b/exercises/practice/food-chain/.docs/instructions.md similarity index 54% rename from exercises/practice/food-chain/README.md rename to exercises/practice/food-chain/.docs/instructions.md index c98ea1787..4d9c10b59 100644 --- a/exercises/practice/food-chain/README.md +++ b/exercises/practice/food-chain/.docs/instructions.md @@ -1,4 +1,4 @@ -# Food Chain +# Instructions Generate the lyrics of the song 'I Know an Old Lady Who Swallowed a Fly'. @@ -62,84 +62,3 @@ I don't know why she swallowed the fly. Perhaps she'll die. I know an old lady who swallowed a horse. She's dead, of course! ``` - -## Hints - -This exercise is about [code refactoring](https://en.wikipedia.org/wiki/Refactoring), -so we are providing you with a solution that already passes the tests. - -The challenge is to rewrite it until you are proud of it, and learn -something in the process. - -If you don't know where to start, here are some ideas: - -- Try to reduce repetition to a minimum. -- Try to make the code readable. -- Generalize your solution, allowing the lady to swallow other things. - -Take your time. - -Change one thing at a time and check if your solution still passes the tests. - -Have fun! - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [http://en.wikipedia.org/wiki/There_Was_an_Old_Lady_Who_Swallowed_a_Fly](http://en.wikipedia.org/wiki/There_Was_an_Old_Lady_Who_Swallowed_a_Fly) - -## 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/practice/food-chain/.meta/config.json b/exercises/practice/food-chain/.meta/config.json new file mode 100644 index 000000000..bae70dd9f --- /dev/null +++ b/exercises/practice/food-chain/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "http://en.wikipedia.org/wiki/There_Was_an_Old_Lady_Who_Swallowed_a_Fly" +} diff --git a/exercises/practice/forth/.meta/hints.md b/exercises/practice/forth/.docs/instructions.append.md similarity index 100% rename from exercises/practice/forth/.meta/hints.md rename to exercises/practice/forth/.docs/instructions.append.md diff --git a/exercises/practice/forth/.docs/instructions.md b/exercises/practice/forth/.docs/instructions.md new file mode 100644 index 000000000..f481b725a --- /dev/null +++ b/exercises/practice/forth/.docs/instructions.md @@ -0,0 +1,26 @@ +# Instructions + +Implement an evaluator for a very simple subset of Forth. + +[Forth](https://en.wikipedia.org/wiki/Forth_%28programming_language%29) +is a stack-based programming language. Implement a very basic evaluator +for a small subset of Forth. + +Your evaluator has to support the following words: + +- `+`, `-`, `*`, `/` (integer arithmetic) +- `DUP`, `DROP`, `SWAP`, `OVER` (stack manipulation) + +Your evaluator also has to support defining new words using the +customary syntax: `: word-name definition ;`. + +To keep things simple the only data type you need to support is signed +integers of at least 16 bits size. + +You should use the following rules for the syntax: a number is a +sequence of one or more (ASCII) digits, a word is a sequence of one or +more letters, digits, symbols or punctuation that is not a number. +(Forth probably uses slightly different rules, but this is close +enough.) + +Words are case-insensitive. diff --git a/exercises/practice/forth/.meta/config.json b/exercises/practice/forth/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/forth/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/forth/README.md b/exercises/practice/forth/README.md deleted file mode 100644 index d84315116..000000000 --- a/exercises/practice/forth/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# Forth - -Implement an evaluator for a very simple subset of Forth. - -[Forth](https://en.wikipedia.org/wiki/Forth_%28programming_language%29) -is a stack-based programming language. Implement a very basic evaluator -for a small subset of Forth. - -Your evaluator has to support the following words: - -- `+`, `-`, `*`, `/` (integer arithmetic) -- `DUP`, `DROP`, `SWAP`, `OVER` (stack manipulation) - -Your evaluator also has to support defining new words using the -customary syntax: `: word-name definition ;`. - -To keep things simple the only data type you need to support is signed -integers of at least 16 bits size. - -You should use the following rules for the syntax: a number is a -sequence of one or more (ASCII) digits, a word is a sequence of one or -more letters, digits, symbols or punctuation that is not a number. -(Forth probably uses slightly different rules, but this is close -enough.) - -Words are case-insensitive. - -## Hints - -To complete this exercise, you need to create the data type `ForthState` -and implement the following functions: - -- `emptyState` returns an empty `ForthState`. -- `evalText` evaluates an input Text, returning the new state. -- `toList` returns the current stack as a list, with the element on top -of the stack being the rightmost (last) element. - -You will find a dummy data declaration and type signatures already in place, -but it is up to you to define the functions and create a meaningful data type, -newtype or type synonym. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/gigasecond/.docs/instructions.md b/exercises/practice/gigasecond/.docs/instructions.md new file mode 100644 index 000000000..680870f3a --- /dev/null +++ b/exercises/practice/gigasecond/.docs/instructions.md @@ -0,0 +1,6 @@ +# Instructions + +Given a moment, determine the moment that would be after a gigasecond +has passed. + +A gigasecond is 10^9 (1,000,000,000) seconds. diff --git a/exercises/practice/gigasecond/.meta/config.json b/exercises/practice/gigasecond/.meta/config.json new file mode 100644 index 000000000..8ceec193e --- /dev/null +++ b/exercises/practice/gigasecond/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Chapter 9 in Chris Pine's online Learn to Program tutorial.", + "source_url": "http://pine.fm/LearnToProgram/?Chapter=09" +} diff --git a/exercises/practice/gigasecond/README.md b/exercises/practice/gigasecond/README.md deleted file mode 100644 index 77570fff6..000000000 --- a/exercises/practice/gigasecond/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# Gigasecond - -Given a moment, determine the moment that would be after a gigasecond -has passed. - -A gigasecond is 10^9 (1,000,000,000) seconds. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Chapter 9 in Chris Pine's online Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=09](http://pine.fm/LearnToProgram/?Chapter=09) - -## 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/practice/go-counting/.meta/hints.md b/exercises/practice/go-counting/.docs/instructions.append.md similarity index 100% rename from exercises/practice/go-counting/.meta/hints.md rename to exercises/practice/go-counting/.docs/instructions.append.md diff --git a/exercises/practice/go-counting/.docs/instructions.md b/exercises/practice/go-counting/.docs/instructions.md new file mode 100644 index 000000000..858b95f7d --- /dev/null +++ b/exercises/practice/go-counting/.docs/instructions.md @@ -0,0 +1,36 @@ +# Instructions + +Count the scored points on a Go board. + +In the game of go (also known as baduk, igo, cờ vây and wéiqí) points +are gained by completely encircling empty intersections with your +stones. The encircled intersections of a player are known as its +territory. + +Write a function that determines the territory of each player. You may +assume that any stones that have been stranded in enemy territory have +already been taken off the board. + +Write a function that determines the territory which includes a specified coordinate. + +Multiple empty intersections may be encircled at once and for encircling +only horizontal and vertical neighbours count. In the following diagram +the stones which matter are marked "O" and the stones that don't are +marked "I" (ignored). Empty spaces represent empty intersections. + +```text ++----+ +|IOOI| +|O O| +|O OI| +|IOI | ++----+ +``` + +To be more precise an empty intersection is part of a player's territory +if all of its neighbours are either stones of that player or empty +intersections that are part of that player's territory. + +For more information see +[wikipedia](https://en.wikipedia.org/wiki/Go_%28game%29) or [Sensei's +Library](http://senseis.xmp.net/). diff --git a/exercises/practice/go-counting/.meta/config.json b/exercises/practice/go-counting/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/go-counting/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/go-counting/README.md b/exercises/practice/go-counting/README.md deleted file mode 100644 index f31099af9..000000000 --- a/exercises/practice/go-counting/README.md +++ /dev/null @@ -1,110 +0,0 @@ -# Go Counting - -Count the scored points on a Go board. - -In the game of go (also known as baduk, igo, cờ vây and wéiqí) points -are gained by completely encircling empty intersections with your -stones. The encircled intersections of a player are known as its -territory. - -Write a function that determines the territory of each player. You may -assume that any stones that have been stranded in enemy territory have -already been taken off the board. - -Write a function that determines the territory which includes a specified coordinate. - -Multiple empty intersections may be encircled at once and for encircling -only horizontal and vertical neighbours count. In the following diagram -the stones which matter are marked "O" and the stones that don't are -marked "I" (ignored). Empty spaces represent empty intersections. - -```text -+----+ -|IOOI| -|O O| -|O OI| -|IOI | -+----+ -``` - -To be more precise an empty intersection is part of a player's territory -if all of its neighbours are either stones of that player or empty -intersections that are part of that player's territory. - -For more information see -[wikipedia](https://en.wikipedia.org/wiki/Go_%28game%29) or [Sensei's -Library](http://senseis.xmp.net/). - -## Hints - -To complete this exercise, you need to implement the following functions: - -- `territories` returns the coordinates (1 based, top left is (1,1)) -of the points in each territory along with who "owns" the territory. - -- `territoriesFor` returns the territory that contains the coordinate -along with the owner of the territory. If the coordinate does not point -to an empty location, returns *Nothing*. - -A territory is owned by one of the players if that player's stones -are the only stones adjacent to the territory. - -You will find the type signatures already in place, but it is up to you -to define the functions. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/grade-school/.meta/hints.md b/exercises/practice/grade-school/.docs/instructions.append.md similarity index 100% rename from exercises/practice/grade-school/.meta/hints.md rename to exercises/practice/grade-school/.docs/instructions.append.md diff --git a/exercises/practice/grade-school/.docs/instructions.md b/exercises/practice/grade-school/.docs/instructions.md new file mode 100644 index 000000000..8bbbf6446 --- /dev/null +++ b/exercises/practice/grade-school/.docs/instructions.md @@ -0,0 +1,38 @@ +# Instructions + +Given students' names along with the grade that they are in, create a roster +for the school. + +In the end, you should be able to: + +- Add a student's name to the roster for a grade + - "Add Jim to grade 2." + - "OK." +- Get a list of all students enrolled in a grade + - "Which students are in grade 2?" + - "We've only got Jim just now." +- Get a sorted list of all students in all grades. Grades should sort + as 1, 2, 3, etc., and students within a grade should be sorted + alphabetically by name. + - "Who all is enrolled in school right now?" + - "Let me think. We have + Anna, Barb, and Charlie in grade 1, + Alex, Peter, and Zoe in grade 2 + and Jim in grade 5. + So the answer is: Anna, Barb, Charlie, Alex, Peter, Zoe and Jim" + +Note that all our students only have one name. (It's a small town, what +do you want?) + +## For bonus points + +Did you get the tests passing and the code clean? If you want to, these +are some additional things you could try: + +- If you're working in a language with mutable data structures and your + implementation allows outside code to mutate the school's internal DB + directly, see if you can prevent this. Feel free to introduce additional + tests. + +Then please share your thoughts in a comment on the submission. Did this +experiment make the code better? Worse? Did you learn anything from it? diff --git a/exercises/practice/grade-school/.meta/config.json b/exercises/practice/grade-school/.meta/config.json new file mode 100644 index 000000000..1010ef168 --- /dev/null +++ b/exercises/practice/grade-school/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "A pairing session with Phil Battos at gSchool", + "source_url": "http://gschool.it" +} diff --git a/exercises/practice/grade-school/README.md b/exercises/practice/grade-school/README.md deleted file mode 100644 index 3dcd88ff7..000000000 --- a/exercises/practice/grade-school/README.md +++ /dev/null @@ -1,113 +0,0 @@ -# Grade School - -Given students' names along with the grade that they are in, create a roster -for the school. - -In the end, you should be able to: - -- Add a student's name to the roster for a grade - - "Add Jim to grade 2." - - "OK." -- Get a list of all students enrolled in a grade - - "Which students are in grade 2?" - - "We've only got Jim just now." -- Get a sorted list of all students in all grades. Grades should sort - as 1, 2, 3, etc., and students within a grade should be sorted - alphabetically by name. - - "Who all is enrolled in school right now?" - - "Let me think. We have - Anna, Barb, and Charlie in grade 1, - Alex, Peter, and Zoe in grade 2 - and Jim in grade 5. - So the answer is: Anna, Barb, Charlie, Alex, Peter, Zoe and Jim" - -Note that all our students only have one name. (It's a small town, what -do you want?) - -## For bonus points - -Did you get the tests passing and the code clean? If you want to, these -are some additional things you could try: - -- If you're working in a language with mutable data structures and your - implementation allows outside code to mutate the school's internal DB - directly, see if you can prevent this. Feel free to introduce additional - tests. - -Then please share your thoughts in a comment on the submission. Did this -experiment make the code better? Worse? Did you learn anything from it? - -## Hints - -To complete this exercise you need to create the data type `School` -and implement the following functions: - -- `add` -- `empty` -- `grade` -- `sorted` - -You will find a dummy data declaration and type signatures already in -place, but it is up to you to define the functions and create a meaningful -data type, newtype or type synonym. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -A pairing session with Phil Battos at gSchool [http://gschool.it](http://gschool.it) - -## 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/practice/grains/.docs/instructions.md b/exercises/practice/grains/.docs/instructions.md new file mode 100644 index 000000000..05ee99760 --- /dev/null +++ b/exercises/practice/grains/.docs/instructions.md @@ -0,0 +1,27 @@ +# Instructions + +Calculate the number of grains of wheat on a chessboard given that the number +on each square doubles. + +There once was a wise servant who saved the life of a prince. The king +promised to pay whatever the servant could dream up. Knowing that the +king loved chess, the servant told the king he would like to have grains +of wheat. One grain on the first square of a chess board, with the number +of grains doubling on each successive square. + +There are 64 squares on a chessboard (where square 1 has one grain, square 2 has two grains, and so on). + +Write code that shows: +- how many grains were on a given square, and +- the total number of grains on the chessboard + +## For bonus points + +Did you get the tests passing and the code clean? If you want to, these +are some additional things you could try: + +- Optimize for speed. +- Optimize for readability. + +Then please share your thoughts in a comment on the submission. Did this +experiment make the code better? Worse? Did you learn anything from it? diff --git a/exercises/practice/grains/.meta/config.json b/exercises/practice/grains/.meta/config.json new file mode 100644 index 000000000..1feda3df2 --- /dev/null +++ b/exercises/practice/grains/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "JavaRanch Cattle Drive, exercise 6", + "source_url": "http://www.javaranch.com/grains.jsp" +} diff --git a/exercises/practice/grains/README.md b/exercises/practice/grains/README.md deleted file mode 100644 index 145e80696..000000000 --- a/exercises/practice/grains/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# Grains - -Calculate the number of grains of wheat on a chessboard given that the number -on each square doubles. - -There once was a wise servant who saved the life of a prince. The king -promised to pay whatever the servant could dream up. Knowing that the -king loved chess, the servant told the king he would like to have grains -of wheat. One grain on the first square of a chess board, with the number -of grains doubling on each successive square. - -There are 64 squares on a chessboard (where square 1 has one grain, square 2 has two grains, and so on). - -Write code that shows: -- how many grains were on a given square, and -- the total number of grains on the chessboard - -## For bonus points - -Did you get the tests passing and the code clean? If you want to, these -are some additional things you could try: - -- Optimize for speed. -- Optimize for readability. - -Then please share your thoughts in a comment on the submission. Did this -experiment make the code better? Worse? Did you learn anything from it? - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -JavaRanch Cattle Drive, exercise 6 [http://www.javaranch.com/grains.jsp](http://www.javaranch.com/grains.jsp) - -## 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/practice/hamming/.docs/instructions.md b/exercises/practice/hamming/.docs/instructions.md new file mode 100644 index 000000000..56c5696de --- /dev/null +++ b/exercises/practice/hamming/.docs/instructions.md @@ -0,0 +1,24 @@ +# Instructions + +Calculate the Hamming Distance between two DNA strands. + +Your body is made up of cells that contain DNA. Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells. In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime! + +When cells divide, their DNA replicates too. Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information. If we compare two strands of DNA and count the differences between them we can see how many mistakes occurred. This is known as the "Hamming Distance". + +We read DNA using the letters C,A,G and T. Two strands might look like this: + + GAGCCTACTAACGGGAT + CATCGTAATGACGGCCT + ^ ^ ^ ^ ^ ^^ + +They have 7 differences, and therefore the Hamming Distance is 7. + +The Hamming Distance is useful for lots of things in science, not just biology, so it's a nice phrase to be familiar with :) + +# 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. diff --git a/exercises/practice/hamming/.meta/config.json b/exercises/practice/hamming/.meta/config.json new file mode 100644 index 000000000..77d306c1f --- /dev/null +++ b/exercises/practice/hamming/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "The Calculating Point Mutations problem at Rosalind", + "source_url": "http://rosalind.info/problems/hamm/" +} diff --git a/exercises/practice/hamming/README.md b/exercises/practice/hamming/README.md deleted file mode 100644 index 9ad0f3214..000000000 --- a/exercises/practice/hamming/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# Hamming - -Calculate the Hamming Distance between two DNA strands. - -Your body is made up of cells that contain DNA. Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells. In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime! - -When cells divide, their DNA replicates too. Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information. If we compare two strands of DNA and count the differences between them we can see how many mistakes occurred. This is known as the "Hamming Distance". - -We read DNA using the letters C,A,G and T. Two strands might look like this: - - GAGCCTACTAACGGGAT - CATCGTAATGACGGCCT - ^ ^ ^ ^ ^ ^^ - -They have 7 differences, and therefore the Hamming Distance is 7. - -The Hamming Distance is useful for lots of things in science, not just biology, so it's a nice phrase to be familiar with :) - -# 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. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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. diff --git a/exercises/practice/hello-world/.meta/hints.md b/exercises/practice/hello-world/.docs/instructions.append.md similarity index 100% rename from exercises/practice/hello-world/.meta/hints.md rename to exercises/practice/hello-world/.docs/instructions.append.md diff --git a/exercises/practice/hello-world/.docs/instructions.md b/exercises/practice/hello-world/.docs/instructions.md new file mode 100644 index 000000000..6e08ebba5 --- /dev/null +++ b/exercises/practice/hello-world/.docs/instructions.md @@ -0,0 +1,15 @@ +# Instructions + +The classical introductory exercise. Just say "Hello, World!". + +["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is +the traditional first program for beginning programming in a new language +or environment. + +The objectives are simple: + +- Write a function that returns the string "Hello, World!". +- Run the test suite and make sure that it succeeds. +- Submit your solution and check it at the website. + +If everything goes well, you will be ready to fetch your first real exercise. diff --git a/exercises/practice/hello-world/.meta/config.json b/exercises/practice/hello-world/.meta/config.json new file mode 100644 index 000000000..22d067207 --- /dev/null +++ b/exercises/practice/hello-world/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "This is an exercise to introduce users to using Exercism", + "source_url": "http://en.wikipedia.org/wiki/%22Hello,_world!%22_program" +} diff --git a/exercises/practice/hello-world/README.md b/exercises/practice/hello-world/README.md deleted file mode 100644 index aaf5c20fe..000000000 --- a/exercises/practice/hello-world/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# Hello World - -The classical introductory exercise. Just say "Hello, World!". - -["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is -the traditional first program for beginning programming in a new language -or environment. - -The objectives are simple: - -- Write a function that returns the string "Hello, World!". -- Run the test suite and make sure that it succeeds. -- Submit your solution and check it at the website. - -If everything goes well, you will be ready to fetch your first real exercise. - -## Hints - -To complete this exercise, you need to implement the `hello` function. - -You will find the type signature for `hello` already in place, -but it is up to you to define the function. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -This is an exercise to introduce users to using Exercism [http://en.wikipedia.org/wiki/%22Hello,_world!%22_program](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) - -## 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/practice/hexadecimal/.docs/instructions.md b/exercises/practice/hexadecimal/.docs/instructions.md new file mode 100644 index 000000000..3e5afa77c --- /dev/null +++ b/exercises/practice/hexadecimal/.docs/instructions.md @@ -0,0 +1,8 @@ +# Instructions + +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. diff --git a/exercises/practice/hexadecimal/.meta/config.json b/exercises/practice/hexadecimal/.meta/config.json new file mode 100644 index 000000000..7563cd4e8 --- /dev/null +++ b/exercises/practice/hexadecimal/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "All of Computer Science", + "source_url": "http://www.wolframalpha.com/examples/NumberBases.html" +} diff --git a/exercises/practice/hexadecimal/README.md b/exercises/practice/hexadecimal/README.md deleted file mode 100644 index 2d8d9014f..000000000 --- a/exercises/practice/hexadecimal/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# 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. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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. diff --git a/exercises/practice/house/.meta/hints.md b/exercises/practice/house/.docs/instructions.append.md similarity index 100% rename from exercises/practice/house/.meta/hints.md rename to exercises/practice/house/.docs/instructions.append.md diff --git a/exercises/practice/house/README.md b/exercises/practice/house/.docs/instructions.md similarity index 59% rename from exercises/practice/house/README.md rename to exercises/practice/house/.docs/instructions.md index 6f53717f6..92174617f 100644 --- a/exercises/practice/house/README.md +++ b/exercises/practice/house/.docs/instructions.md @@ -1,4 +1,4 @@ -# House +# Instructions Recite the nursery rhyme 'This is the House that Jack Built'. @@ -104,83 +104,3 @@ that killed the rat that ate the malt that lay in the house that Jack built. ``` - -## Hints - -This exercise is about [code refactoring](https://en.wikipedia.org/wiki/Refactoring), -so we are providing you with a solution that already passes the tests. - -The challenge is to rewrite it until you are proud of it, and learn -something in the process. - -If you don't know where to start, here are some ideas: - -- Try to reduce repetition to a minimum. -- Try to make the code readable. - -Take your time. - -Change one thing at a time and check if your solution still passes the tests. - -Have fun! - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -British nursery rhyme [http://en.wikipedia.org/wiki/This_Is_The_House_That_Jack_Built](http://en.wikipedia.org/wiki/This_Is_The_House_That_Jack_Built) - -## 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/practice/house/.meta/config.json b/exercises/practice/house/.meta/config.json new file mode 100644 index 000000000..dae0ce62c --- /dev/null +++ b/exercises/practice/house/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "British nursery rhyme", + "source_url": "http://en.wikipedia.org/wiki/This_Is_The_House_That_Jack_Built" +} diff --git a/exercises/practice/isbn-verifier/README.md b/exercises/practice/isbn-verifier/.docs/instructions.md similarity index 50% rename from exercises/practice/isbn-verifier/README.md rename to exercises/practice/isbn-verifier/.docs/instructions.md index 0c9bccfe8..7d6635edc 100644 --- a/exercises/practice/isbn-verifier/README.md +++ b/exercises/practice/isbn-verifier/.docs/instructions.md @@ -1,4 +1,4 @@ -# ISBN Verifier +# Instructions The [ISBN-10 verification process](https://en.wikipedia.org/wiki/International_Standard_Book_Number) is used to validate book identification numbers. These normally contain dashes and look like: `3-598-21508-8` @@ -40,63 +40,3 @@ Now, it's even trickier since the check digit of an ISBN-10 may be 'X' (represen * Generate a valid ISBN-13 from the input ISBN-10 (and maybe verify it again with a derived verifier). * Generate valid ISBN, maybe even from a given starting ISBN. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Converting a string into a number and some basic processing utilizing a relatable real world example. [https://en.wikipedia.org/wiki/International_Standard_Book_Number#ISBN-10_check_digit_calculation](https://en.wikipedia.org/wiki/International_Standard_Book_Number#ISBN-10_check_digit_calculation) - -## 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/practice/isbn-verifier/.meta/config.json b/exercises/practice/isbn-verifier/.meta/config.json new file mode 100644 index 000000000..acb2f7436 --- /dev/null +++ b/exercises/practice/isbn-verifier/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Converting a string into a number and some basic processing utilizing a relatable real world example.", + "source_url": "https://en.wikipedia.org/wiki/International_Standard_Book_Number#ISBN-10_check_digit_calculation" +} diff --git a/exercises/practice/isogram/.meta/hints.md b/exercises/practice/isogram/.docs/instructions.append.md similarity index 100% rename from exercises/practice/isogram/.meta/hints.md rename to exercises/practice/isogram/.docs/instructions.append.md diff --git a/exercises/practice/isogram/.docs/instructions.md b/exercises/practice/isogram/.docs/instructions.md new file mode 100644 index 000000000..9cc5350b6 --- /dev/null +++ b/exercises/practice/isogram/.docs/instructions.md @@ -0,0 +1,14 @@ +# Instructions + +Determine if a word or phrase is an isogram. + +An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times. + +Examples of isograms: + +- lumberjacks +- background +- downstream +- six-year-old + +The word *isograms*, however, is not an isogram, because the s repeats. diff --git a/exercises/practice/isogram/.meta/config.json b/exercises/practice/isogram/.meta/config.json new file mode 100644 index 000000000..294266730 --- /dev/null +++ b/exercises/practice/isogram/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Isogram" +} diff --git a/exercises/practice/isogram/README.md b/exercises/practice/isogram/README.md deleted file mode 100644 index c59d87ad4..000000000 --- a/exercises/practice/isogram/README.md +++ /dev/null @@ -1,95 +0,0 @@ -# Isogram - -Determine if a word or phrase is an isogram. - -An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times. - -Examples of isograms: - -- lumberjacks -- background -- downstream -- six-year-old - -The word *isograms*, however, is not an isogram, because the s repeats. - -## Hints - -This exercise works with textual data. For historical reasons, Haskell's -`String` type is synonymous with `[Char]`, a list of characters. For more -efficient handling of textual data, the `Text` type can be used. - -As an optional extension to this exercise, you can - -- Read about [string types](https://haskell-lang.org/tutorial/string-types) in Haskell. -- Add `- text` to your list of dependencies in package.yaml. -- Import `Data.Text` in [the following way](https://hackernoon.com/4-steps-to-a-better-imports-list-in-haskell-43a3d868273c): - - import qualified Data.Text as T - import Data.Text (Text) - -- You can now write e.g. `isIsogram :: Text -> Bool` and refer to `Data.Text` combinators as e.g. `T.toLower`. -- Look up the documentation for [`Data.Text`](https://hackage.haskell.org/package/text/docs/Data-Text.html). - -This part is entirely optional. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [https://en.wikipedia.org/wiki/Isogram](https://en.wikipedia.org/wiki/Isogram) - -## 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/practice/kindergarten-garden/README.md b/exercises/practice/kindergarten-garden/.docs/instructions.md similarity index 53% rename from exercises/practice/kindergarten-garden/README.md rename to exercises/practice/kindergarten-garden/.docs/instructions.md index 676c2f8e5..ba89ff9b0 100644 --- a/exercises/practice/kindergarten-garden/README.md +++ b/exercises/practice/kindergarten-garden/.docs/instructions.md @@ -1,4 +1,4 @@ -# Kindergarten Garden +# Instructions Given a diagram, determine which plants each child in the kindergarten class is responsible for. @@ -58,63 +58,3 @@ Then if asked for Alice's plants, it should provide: While asking for Bob's plants would yield: - Clover, grass, clover, clover - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Random musings during airplane trip. [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. diff --git a/exercises/practice/kindergarten-garden/.meta/config.json b/exercises/practice/kindergarten-garden/.meta/config.json new file mode 100644 index 000000000..27fbd2866 --- /dev/null +++ b/exercises/practice/kindergarten-garden/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Random musings during airplane trip.", + "source_url": "http://jumpstartlab.com" +} diff --git a/exercises/practice/largest-series-product/.docs/instructions.md b/exercises/practice/largest-series-product/.docs/instructions.md new file mode 100644 index 000000000..8ddbc6024 --- /dev/null +++ b/exercises/practice/largest-series-product/.docs/instructions.md @@ -0,0 +1,14 @@ +# Instructions + +Given a string of digits, calculate the largest product for a contiguous +substring of digits of length n. + +For example, for the input `'1027839564'`, the largest product for a +series of 3 digits is 270 (9 * 5 * 6), and the largest product for a +series of 5 digits is 7560 (7 * 8 * 3 * 9 * 5). + +Note that these series are only required to occupy *adjacent positions* +in the input; the digits need not be *numerically consecutive*. + +For the input `'73167176531330624919225119674426574742355349194934'`, +the largest product for a series of 6 digits is 23520. diff --git a/exercises/practice/largest-series-product/.meta/config.json b/exercises/practice/largest-series-product/.meta/config.json new file mode 100644 index 000000000..688875be6 --- /dev/null +++ b/exercises/practice/largest-series-product/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "A variation on Problem 8 at Project Euler", + "source_url": "http://projecteuler.net/problem=8" +} diff --git a/exercises/practice/largest-series-product/README.md b/exercises/practice/largest-series-product/README.md deleted file mode 100644 index c352bda90..000000000 --- a/exercises/practice/largest-series-product/README.md +++ /dev/null @@ -1,74 +0,0 @@ -# Largest Series Product - -Given a string of digits, calculate the largest product for a contiguous -substring of digits of length n. - -For example, for the input `'1027839564'`, the largest product for a -series of 3 digits is 270 (9 * 5 * 6), and the largest product for a -series of 5 digits is 7560 (7 * 8 * 3 * 9 * 5). - -Note that these series are only required to occupy *adjacent positions* -in the input; the digits need not be *numerically consecutive*. - -For the input `'73167176531330624919225119674426574742355349194934'`, -the largest product for a series of 6 digits is 23520. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -A variation on Problem 8 at Project Euler [http://projecteuler.net/problem=8](http://projecteuler.net/problem=8) - -## 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/practice/leap/.meta/hints.md b/exercises/practice/leap/.docs/instructions.append.md similarity index 100% rename from exercises/practice/leap/.meta/hints.md rename to exercises/practice/leap/.docs/instructions.append.md diff --git a/exercises/practice/leap/.docs/instructions.md b/exercises/practice/leap/.docs/instructions.md new file mode 100644 index 000000000..dc7b4e816 --- /dev/null +++ b/exercises/practice/leap/.docs/instructions.md @@ -0,0 +1,24 @@ +# Instructions + +Given a year, report if it is a leap year. + +The tricky thing here is that a leap year in the Gregorian calendar occurs: + +```text +on every year that is evenly divisible by 4 + except every year that is evenly divisible by 100 + unless the year is also evenly divisible by 400 +``` + +For example, 1997 is not a leap year, but 1996 is. 1900 is not a leap +year, but 2000 is. + +## Notes + +Though our exercise adopts some very simple rules, there is more to +learn! + +For a delightful, four minute explanation of the whole leap year +phenomenon, go watch [this youtube video][video]. + +[video]: http://www.youtube.com/watch?v=xX96xng7sAE diff --git a/exercises/practice/leap/.meta/config.json b/exercises/practice/leap/.meta/config.json new file mode 100644 index 000000000..5d1546933 --- /dev/null +++ b/exercises/practice/leap/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "JavaRanch Cattle Drive, exercise 3", + "source_url": "http://www.javaranch.com/leap.jsp" +} diff --git a/exercises/practice/leap/README.md b/exercises/practice/leap/README.md deleted file mode 100644 index e39550af7..000000000 --- a/exercises/practice/leap/README.md +++ /dev/null @@ -1,90 +0,0 @@ -# Leap - -Given a year, report if it is a leap year. - -The tricky thing here is that a leap year in the Gregorian calendar occurs: - -```text -on every year that is evenly divisible by 4 - except every year that is evenly divisible by 100 - unless the year is also evenly divisible by 400 -``` - -For example, 1997 is not a leap year, but 1996 is. 1900 is not a leap -year, but 2000 is. - -## Notes - -Though our exercise adopts some very simple rules, there is more to -learn! - -For a delightful, four minute explanation of the whole leap year -phenomenon, go watch [this youtube video][video]. - -[video]: http://www.youtube.com/watch?v=xX96xng7sAE - -## Hints - -To complete this exercise you need to implement the function `isLeapYear` -that takes a year and determines whether it is a leap year. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -JavaRanch Cattle Drive, exercise 3 [http://www.javaranch.com/leap.jsp](http://www.javaranch.com/leap.jsp) - -## 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/practice/lens-person/.docs/instructions.md b/exercises/practice/lens-person/.docs/instructions.md new file mode 100644 index 000000000..2152a069f --- /dev/null +++ b/exercises/practice/lens-person/.docs/instructions.md @@ -0,0 +1,9 @@ +# Instructions + +Use lenses to update nested records (specific to languages with immutable data). + +Updating fields of nested records is kind of annoying in Haskell. One solution +is to use [lenses](https://wiki.haskell.org/Lens). Implement several record +accessing functions using lenses, you may use any library you want. The test +suite also allows you to avoid lenses altogether so you can experiment with +different approaches. diff --git a/exercises/practice/lens-person/.meta/config.json b/exercises/practice/lens-person/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/lens-person/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/lens-person/README.md b/exercises/practice/lens-person/README.md deleted file mode 100644 index 3e83119af..000000000 --- a/exercises/practice/lens-person/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# Lens Person - -Use lenses to update nested records (specific to languages with immutable data). - -Updating fields of nested records is kind of annoying in Haskell. One solution -is to use [lenses](https://wiki.haskell.org/Lens). Implement several record -accessing functions using lenses, you may use any library you want. The test -suite also allows you to avoid lenses altogether so you can experiment with -different approaches. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/linked-list/.meta/hints.md b/exercises/practice/linked-list/.docs/instructions.append.md similarity index 100% rename from exercises/practice/linked-list/.meta/hints.md rename to exercises/practice/linked-list/.docs/instructions.append.md diff --git a/exercises/practice/linked-list/.docs/instructions.md b/exercises/practice/linked-list/.docs/instructions.md new file mode 100644 index 000000000..d1bd87551 --- /dev/null +++ b/exercises/practice/linked-list/.docs/instructions.md @@ -0,0 +1,28 @@ +# Instructions + +Implement a doubly linked list. + +Like an array, a linked list is a simple linear data structure. Several +common data types can be implemented using linked lists, like queues, +stacks, and associative arrays. + +A linked list is a collection of data elements called *nodes*. In a +*singly linked list* each node holds a value and a link to the next node. +In a *doubly linked list* each node also holds a link to the previous +node. + +You will write an implementation of a doubly linked list. Implement a +Node to hold a value and pointers to the next and previous nodes. Then +implement a List which holds references to the first and last node and +offers an array-like interface for adding and removing items: + +* `push` (*insert value at back*); +* `pop` (*remove value at back*); +* `shift` (*remove value at front*). +* `unshift` (*insert value at front*); + +To keep your implementation simple, the tests will not cover error +conditions. Specifically: `pop` or `shift` will never be called on an +empty list. + +If you want to know more about linked lists, check [Wikipedia](https://en.wikipedia.org/wiki/Linked_list). diff --git a/exercises/practice/linked-list/.meta/config.json b/exercises/practice/linked-list/.meta/config.json new file mode 100644 index 000000000..496c8b708 --- /dev/null +++ b/exercises/practice/linked-list/.meta/config.json @@ -0,0 +1,9 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Classic computer science topic" +} diff --git a/exercises/practice/linked-list/README.md b/exercises/practice/linked-list/README.md deleted file mode 100644 index 6b858b798..000000000 --- a/exercises/practice/linked-list/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# Linked List - -Implement a doubly linked list. - -Like an array, a linked list is a simple linear data structure. Several -common data types can be implemented using linked lists, like queues, -stacks, and associative arrays. - -A linked list is a collection of data elements called *nodes*. In a -*singly linked list* each node holds a value and a link to the next node. -In a *doubly linked list* each node also holds a link to the previous -node. - -You will write an implementation of a doubly linked list. Implement a -Node to hold a value and pointers to the next and previous nodes. Then -implement a List which holds references to the first and last node and -offers an array-like interface for adding and removing items: - -* `push` (*insert value at back*); -* `pop` (*remove value at back*); -* `shift` (*remove value at front*). -* `unshift` (*insert value at front*); - -To keep your implementation simple, the tests will not cover error -conditions. Specifically: `pop` or `shift` will never be called on an -empty list. - -If you want to know more about linked lists, check [Wikipedia](https://en.wikipedia.org/wiki/Linked_list). - -## Hints - -To complete this exercise, you need to create the data type `Deque` -and implement the following functions: - -- `mkDeque` -- `pop` -- `push` -- `unshift` -- `shift` - -You will find a dummy data declaration and type signatures already in place, -but it is up to you to define the functions and create a meaningful data type, -newtype or type synonym. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Classic computer science topic - -## 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/practice/list-ops/README.md b/exercises/practice/list-ops/.docs/instructions.md similarity index 50% rename from exercises/practice/list-ops/README.md rename to exercises/practice/list-ops/.docs/instructions.md index c7a6b5279..b5b20ff20 100644 --- a/exercises/practice/list-ops/README.md +++ b/exercises/practice/list-ops/.docs/instructions.md @@ -1,4 +1,4 @@ -# List Ops +# Instructions Implement basic list operations. @@ -18,59 +18,3 @@ operations you will implement include: * `foldl` (*given a function, a list, and initial accumulator, fold (reduce) each item into the accumulator from the left using `function(accumulator, item)`*); * `foldr` (*given a function, a list, and an initial accumulator, fold (reduce) each item into the accumulator from the right using `function(item, accumulator)`*); * `reverse` (*given a list, return a list with all the original items, but in reversed order*); - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/list-ops/.meta/config.json b/exercises/practice/list-ops/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/list-ops/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/luhn/.docs/instructions.md b/exercises/practice/luhn/.docs/instructions.md new file mode 100644 index 000000000..c7c7d3e0f --- /dev/null +++ b/exercises/practice/luhn/.docs/instructions.md @@ -0,0 +1,65 @@ +# Instructions + +Given a number determine whether or not it is valid per the Luhn formula. + +The [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) is +a simple checksum formula used to validate a variety of identification +numbers, such as credit card numbers and Canadian Social Insurance +Numbers. + +The task is to check if a given string is valid. + +Validating a Number +------ + +Strings of length 1 or less are not valid. Spaces are allowed in the input, +but they should be stripped before checking. All other non-digit characters +are disallowed. + +## Example 1: valid credit card number + +```text +4539 3195 0343 6467 +``` + +The first step of the Luhn algorithm is to double every second digit, +starting from the right. We will be doubling + +```text +4_3_ 3_9_ 0_4_ 6_6_ +``` + +If doubling the number results in a number greater than 9 then subtract 9 +from the product. The results of our doubling: + +```text +8569 6195 0383 3437 +``` + +Then sum all of the digits: + +```text +8+5+6+9+6+1+9+5+0+3+8+3+3+4+3+7 = 80 +``` + +If the sum is evenly divisible by 10, then the number is valid. This number is valid! + +## Example 2: invalid credit card number + +```text +8273 1232 7352 0569 +``` + +Double the second digits, starting from the right + +```text +7253 2262 5312 0539 +``` + +Sum the digits + +```text +7+2+5+3+2+2+6+2+5+3+1+2+0+5+3+9 = 57 +``` + +57 is not evenly divisible by 10, so this number is not valid. diff --git a/exercises/practice/luhn/.meta/config.json b/exercises/practice/luhn/.meta/config.json new file mode 100644 index 000000000..a030ef485 --- /dev/null +++ b/exercises/practice/luhn/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "The Luhn Algorithm on Wikipedia", + "source_url": "http://en.wikipedia.org/wiki/Luhn_algorithm" +} diff --git a/exercises/practice/luhn/README.md b/exercises/practice/luhn/README.md deleted file mode 100644 index ab4828268..000000000 --- a/exercises/practice/luhn/README.md +++ /dev/null @@ -1,125 +0,0 @@ -# Luhn - -Given a number determine whether or not it is valid per the Luhn formula. - -The [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) is -a simple checksum formula used to validate a variety of identification -numbers, such as credit card numbers and Canadian Social Insurance -Numbers. - -The task is to check if a given string is valid. - -Validating a Number ------- - -Strings of length 1 or less are not valid. Spaces are allowed in the input, -but they should be stripped before checking. All other non-digit characters -are disallowed. - -## Example 1: valid credit card number - -```text -4539 3195 0343 6467 -``` - -The first step of the Luhn algorithm is to double every second digit, -starting from the right. We will be doubling - -```text -4_3_ 3_9_ 0_4_ 6_6_ -``` - -If doubling the number results in a number greater than 9 then subtract 9 -from the product. The results of our doubling: - -```text -8569 6195 0383 3437 -``` - -Then sum all of the digits: - -```text -8+5+6+9+6+1+9+5+0+3+8+3+3+4+3+7 = 80 -``` - -If the sum is evenly divisible by 10, then the number is valid. This number is valid! - -## Example 2: invalid credit card number - -```text -8273 1232 7352 0569 -``` - -Double the second digits, starting from the right - -```text -7253 2262 5312 0539 -``` - -Sum the digits - -```text -7+2+5+3+2+2+6+2+5+3+1+2+0+5+3+9 = 57 -``` - -57 is not evenly divisible by 10, so this number is not valid. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -The Luhn Algorithm on Wikipedia [http://en.wikipedia.org/wiki/Luhn_algorithm](http://en.wikipedia.org/wiki/Luhn_algorithm) - -## 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/practice/matching-brackets/.docs/instructions.md b/exercises/practice/matching-brackets/.docs/instructions.md new file mode 100644 index 000000000..364ecad21 --- /dev/null +++ b/exercises/practice/matching-brackets/.docs/instructions.md @@ -0,0 +1,5 @@ +# Instructions + +Given a string containing brackets `[]`, braces `{}`, parentheses `()`, +or any combination thereof, verify that any and all pairs are matched +and nested correctly. diff --git a/exercises/practice/matching-brackets/.meta/config.json b/exercises/practice/matching-brackets/.meta/config.json new file mode 100644 index 000000000..5a14b47b6 --- /dev/null +++ b/exercises/practice/matching-brackets/.meta/config.json @@ -0,0 +1,9 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Ginna Baker" +} diff --git a/exercises/practice/matching-brackets/README.md b/exercises/practice/matching-brackets/README.md deleted file mode 100644 index 83d9ab26d..000000000 --- a/exercises/practice/matching-brackets/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# Matching Brackets - -Given a string containing brackets `[]`, braces `{}`, parentheses `()`, -or any combination thereof, verify that any and all pairs are matched -and nested correctly. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Ginna Baker - -## 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/practice/matrix/.meta/hints.md b/exercises/practice/matrix/.docs/instructions.append.md similarity index 100% rename from exercises/practice/matrix/.meta/hints.md rename to exercises/practice/matrix/.docs/instructions.append.md diff --git a/exercises/practice/matrix/.docs/instructions.md b/exercises/practice/matrix/.docs/instructions.md new file mode 100644 index 000000000..1b2d0f84b --- /dev/null +++ b/exercises/practice/matrix/.docs/instructions.md @@ -0,0 +1,41 @@ +# Instructions + +Given a string representing a matrix of numbers, return the rows and columns of +that matrix. + +So given a string with embedded newlines like: + +```text +9 8 7 +5 3 2 +6 6 7 +``` + +representing this matrix: + +```text + 1 2 3 + |--------- +1 | 9 8 7 +2 | 5 3 2 +3 | 6 6 7 +``` + +your code should be able to spit out: + +- A list of the rows, reading each row left-to-right while moving + top-to-bottom across the rows, +- A list of the columns, reading each column top-to-bottom while moving + from left-to-right. + +The rows for our example matrix: + +- 9, 8, 7 +- 5, 3, 2 +- 6, 6, 7 + +And its columns: + +- 9, 5, 6 +- 8, 3, 6 +- 7, 2, 7 diff --git a/exercises/practice/matrix/.meta/config.json b/exercises/practice/matrix/.meta/config.json new file mode 100644 index 000000000..e0903570f --- /dev/null +++ b/exercises/practice/matrix/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Warmup to the `saddle-points` warmup.", + "source_url": "http://jumpstartlab.com" +} diff --git a/exercises/practice/matrix/README.md b/exercises/practice/matrix/README.md deleted file mode 100644 index 7f482d901..000000000 --- a/exercises/practice/matrix/README.md +++ /dev/null @@ -1,127 +0,0 @@ -# Matrix - -Given a string representing a matrix of numbers, return the rows and columns of -that matrix. - -So given a string with embedded newlines like: - -```text -9 8 7 -5 3 2 -6 6 7 -``` - -representing this matrix: - -```text - 1 2 3 - |--------- -1 | 9 8 7 -2 | 5 3 2 -3 | 6 6 7 -``` - -your code should be able to spit out: - -- A list of the rows, reading each row left-to-right while moving - top-to-bottom across the rows, -- A list of the columns, reading each column top-to-bottom while moving - from left-to-right. - -The rows for our example matrix: - -- 9, 8, 7 -- 5, 3, 2 -- 6, 6, 7 - -And its columns: - -- 9, 5, 6 -- 8, 3, 6 -- 7, 2, 7 - -## Hints - -To complete this exercise, you need to create the data type `Matrix`, -with `Eq` and `Show` instances, and implement the following functions: - -- `cols` -- `column` -- `flatten` -- `fromList` -- `fromString` -- `reshape` -- `row` -- `rows` -- `shape` -- `transpose` - -You will find a dummy data declaration and type signatures already in place, -but it is up to you to define the functions and create a meaningful data type, -newtype or type synonym. - -No validation of input is required. Let it fail if the matrix is not -rectangular, invalid chars are encountered, etc. - -shape is (rows, cols) - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Warmup to the `saddle-points` warmup. [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. diff --git a/exercises/practice/meetup/.meta/hints.md b/exercises/practice/meetup/.docs/instructions.append.md similarity index 100% rename from exercises/practice/meetup/.meta/hints.md rename to exercises/practice/meetup/.docs/instructions.append.md diff --git a/exercises/practice/meetup/.docs/instructions.md b/exercises/practice/meetup/.docs/instructions.md new file mode 100644 index 000000000..fe1a9c2a6 --- /dev/null +++ b/exercises/practice/meetup/.docs/instructions.md @@ -0,0 +1,27 @@ +# Instructions + +Calculate the date of meetups. + +Typically meetups happen on the same day of the week. In this exercise, you +will take a description of a meetup date, and return the actual meetup date. + +Examples of general descriptions are: + +- The first Monday of January 2017 +- The third Tuesday of January 2017 +- The wednesteenth of January 2017 +- The last Thursday of January 2017 + +The descriptors you are expected to parse are: +first, second, third, fourth, fifth, last, monteenth, tuesteenth, wednesteenth, +thursteenth, friteenth, saturteenth, sunteenth + +Note that "monteenth", "tuesteenth", etc are all made up words. There was a +meetup whose members realized that there are exactly 7 numbered days in a month +that end in '-teenth'. Therefore, one is guaranteed that each day of the week +(Monday, Tuesday, ...) will have exactly one date that is named with '-teenth' +in every month. + +Given examples of a meetup dates, each containing a month, day, year, and +descriptor calculate the date of the actual meetup. For example, if given +"The first Monday of January 2017", the correct meetup date is 2017/1/2. diff --git a/exercises/practice/meetup/.meta/config.json b/exercises/practice/meetup/.meta/config.json new file mode 100644 index 000000000..e768d0d53 --- /dev/null +++ b/exercises/practice/meetup/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Jeremy Hinegardner mentioned a Boulder meetup that happens on the Wednesteenth of every month", + "source_url": "https://twitter.com/copiousfreetime" +} diff --git a/exercises/practice/meetup/README.md b/exercises/practice/meetup/README.md deleted file mode 100644 index a0e415494..000000000 --- a/exercises/practice/meetup/README.md +++ /dev/null @@ -1,95 +0,0 @@ -# Meetup - -Calculate the date of meetups. - -Typically meetups happen on the same day of the week. In this exercise, you -will take a description of a meetup date, and return the actual meetup date. - -Examples of general descriptions are: - -- The first Monday of January 2017 -- The third Tuesday of January 2017 -- The wednesteenth of January 2017 -- The last Thursday of January 2017 - -The descriptors you are expected to parse are: -first, second, third, fourth, fifth, last, monteenth, tuesteenth, wednesteenth, -thursteenth, friteenth, saturteenth, sunteenth - -Note that "monteenth", "tuesteenth", etc are all made up words. There was a -meetup whose members realized that there are exactly 7 numbered days in a month -that end in '-teenth'. Therefore, one is guaranteed that each day of the week -(Monday, Tuesday, ...) will have exactly one date that is named with '-teenth' -in every month. - -Given examples of a meetup dates, each containing a month, day, year, and -descriptor calculate the date of the actual meetup. For example, if given -"The first Monday of January 2017", the correct meetup date is 2017/1/2. - -## Hints - -To complete this exercise, you need to implement the `meetupDay` function. - -You will find the type signature for `meetupDay` already in place, -but it is up to you to define the function. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Jeremy Hinegardner mentioned a Boulder meetup that happens on the Wednesteenth of every month [https://twitter.com/copiousfreetime](https://twitter.com/copiousfreetime) - -## 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/practice/minesweeper/.docs/instructions.md b/exercises/practice/minesweeper/.docs/instructions.md new file mode 100644 index 000000000..1114cc95d --- /dev/null +++ b/exercises/practice/minesweeper/.docs/instructions.md @@ -0,0 +1,37 @@ +# Instructions + +Add the mine counts to a completed Minesweeper board. + +Minesweeper is a popular game where the user has to find the mines using +numeric hints that indicate how many mines are directly adjacent +(horizontally, vertically, diagonally) to a square. + +In this exercise you have to create some code that counts the number of +mines adjacent to a given empty square and replaces that square with the +count. + +The board is a rectangle composed of blank space (' ') characters. A mine +is represented by an asterisk ('\*') character. + +If a given space has no adjacent mines at all, leave that square blank. + +## Examples + +For example you may receive a 5 x 4 board like this (empty spaces are +represented here with the '·' character for display on screen): + +``` +·*·*· +··*·· +··*·· +····· +``` + +And your code will transform it into this: + +``` +1*3*1 +13*31 +·2*2· +·111· +``` diff --git a/exercises/practice/minesweeper/.meta/config.json b/exercises/practice/minesweeper/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/minesweeper/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/minesweeper/README.md b/exercises/practice/minesweeper/README.md deleted file mode 100644 index 50e6f6176..000000000 --- a/exercises/practice/minesweeper/README.md +++ /dev/null @@ -1,93 +0,0 @@ -# Minesweeper - -Add the mine counts to a completed Minesweeper board. - -Minesweeper is a popular game where the user has to find the mines using -numeric hints that indicate how many mines are directly adjacent -(horizontally, vertically, diagonally) to a square. - -In this exercise you have to create some code that counts the number of -mines adjacent to a given empty square and replaces that square with the -count. - -The board is a rectangle composed of blank space (' ') characters. A mine -is represented by an asterisk ('\*') character. - -If a given space has no adjacent mines at all, leave that square blank. - -## Examples - -For example you may receive a 5 x 4 board like this (empty spaces are -represented here with the '·' character for display on screen): - -``` -·*·*· -··*·· -··*·· -····· -``` - -And your code will transform it into this: - -``` -1*3*1 -13*31 -·2*2· -·111· -``` - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/nth-prime/.docs/instructions.md b/exercises/practice/nth-prime/.docs/instructions.md new file mode 100644 index 000000000..30a75216f --- /dev/null +++ b/exercises/practice/nth-prime/.docs/instructions.md @@ -0,0 +1,9 @@ +# Instructions + +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. diff --git a/exercises/practice/nth-prime/.meta/config.json b/exercises/practice/nth-prime/.meta/config.json new file mode 100644 index 000000000..3be0dc8a3 --- /dev/null +++ b/exercises/practice/nth-prime/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "A variation on Problem 7 at Project Euler", + "source_url": "http://projecteuler.net/problem=7" +} diff --git a/exercises/practice/nth-prime/README.md b/exercises/practice/nth-prime/README.md deleted file mode 100644 index 30acba44a..000000000 --- a/exercises/practice/nth-prime/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# 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. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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. diff --git a/exercises/practice/nucleotide-count/.docs/instructions.md b/exercises/practice/nucleotide-count/.docs/instructions.md new file mode 100644 index 000000000..cd0875894 --- /dev/null +++ b/exercises/practice/nucleotide-count/.docs/instructions.md @@ -0,0 +1,21 @@ +# Instructions + +Each of us inherits from our biological parents a set of chemical instructions known as DNA that influence how our bodies are constructed. All known life depends on DNA! + +> Note: You do not need to understand anything about nucleotides or DNA to complete this exercise. + +DNA is a long chain of other chemicals and the most important are the four nucleotides, adenine, cytosine, guanine and thymine. A single DNA chain can contain billions of these four nucleotides and the order in which they occur is important! +We call the order of these nucleotides in a bit of DNA a "DNA sequence". + +We represent a DNA sequence as an ordered collection of these four nucleotides and a common way to do that is with a string of characters such as "ATTACG" for a DNA sequence of 6 nucleotides. +'A' for adenine, 'C' for cytosine, 'G' for guanine, and 'T' for thymine. + +Given a string representing a DNA sequence, count how many of each nucleotide is present. +If the string contains characters that aren't A, C, G, or T then it is invalid and you should signal an error. + +For example: + +``` +"GATTACA" -> 'A': 3, 'C': 1, 'G': 1, 'T': 2 +"INVALID" -> error +``` diff --git a/exercises/practice/nucleotide-count/.meta/config.json b/exercises/practice/nucleotide-count/.meta/config.json new file mode 100644 index 000000000..c8d98cbd9 --- /dev/null +++ b/exercises/practice/nucleotide-count/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "The Calculating DNA Nucleotides_problem at Rosalind", + "source_url": "http://rosalind.info/problems/dna/" +} diff --git a/exercises/practice/nucleotide-count/README.md b/exercises/practice/nucleotide-count/README.md deleted file mode 100644 index 48fcfb490..000000000 --- a/exercises/practice/nucleotide-count/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# Nucleotide Count - -Each of us inherits from our biological parents a set of chemical instructions known as DNA that influence how our bodies are constructed. All known life depends on DNA! - -> Note: You do not need to understand anything about nucleotides or DNA to complete this exercise. - -DNA is a long chain of other chemicals and the most important are the four nucleotides, adenine, cytosine, guanine and thymine. A single DNA chain can contain billions of these four nucleotides and the order in which they occur is important! -We call the order of these nucleotides in a bit of DNA a "DNA sequence". - -We represent a DNA sequence as an ordered collection of these four nucleotides and a common way to do that is with a string of characters such as "ATTACG" for a DNA sequence of 6 nucleotides. -'A' for adenine, 'C' for cytosine, 'G' for guanine, and 'T' for thymine. - -Given a string representing a DNA sequence, count how many of each nucleotide is present. -If the string contains characters that aren't A, C, G, or T then it is invalid and you should signal an error. - -For example: - -``` -"GATTACA" -> 'A': 3, 'C': 1, 'G': 1, 'T': 2 -"INVALID" -> error -``` - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -The Calculating DNA Nucleotides_problem at Rosalind [http://rosalind.info/problems/dna/](http://rosalind.info/problems/dna/) - -## 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/practice/ocr-numbers/README.md b/exercises/practice/ocr-numbers/.docs/instructions.md similarity index 50% rename from exercises/practice/ocr-numbers/README.md rename to exercises/practice/ocr-numbers/.docs/instructions.md index caffe1a88..4086329bd 100644 --- a/exercises/practice/ocr-numbers/README.md +++ b/exercises/practice/ocr-numbers/.docs/instructions.md @@ -1,4 +1,4 @@ -# OCR Numbers +# Instructions Given a 3 x 4 grid of pipes, underscores, and spaces, determine which number is represented, or whether it is garbled. @@ -77,63 +77,3 @@ Update your program to handle multiple numbers, one per line. When converting se ``` Is converted to "123,456,789" - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Inspired by the Bank OCR kata [http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR](http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR) - -## 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/practice/ocr-numbers/.meta/config.json b/exercises/practice/ocr-numbers/.meta/config.json new file mode 100644 index 000000000..39fe16f2a --- /dev/null +++ b/exercises/practice/ocr-numbers/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Inspired by the Bank OCR kata", + "source_url": "http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR" +} diff --git a/exercises/practice/octal/.meta/hints.md b/exercises/practice/octal/.docs/instructions.append.md similarity index 100% rename from exercises/practice/octal/.meta/hints.md rename to exercises/practice/octal/.docs/instructions.append.md diff --git a/exercises/practice/octal/.docs/instructions.md b/exercises/practice/octal/.docs/instructions.md new file mode 100644 index 000000000..81f108384 --- /dev/null +++ b/exercises/practice/octal/.docs/instructions.md @@ -0,0 +1,47 @@ +# Instructions + +Convert an octal number, represented as a string (e.g. '1735263'), to its +decimal equivalent using first principles (i.e. no, you may not use built-in or +external libraries to accomplish the conversion). + +Implement octal to decimal conversion. Given an octal input +string, your program should produce a decimal output. + +## Note + +- Implement the conversion yourself. + Do not use something else to perform the conversion for you. +- Treat invalid input as octal 0. + +## About Octal (Base-8) + +Decimal is a base-10 system. + +A number 233 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: + +```text + 233 # decimal + = 2*10^2 + 3*10^1 + 3*10^0 + = 2*100 + 3*10 + 3*1 +``` + +Octal is similar, but uses powers of 8 rather than powers of 10. + +So: + +```text + 233 # octal + = 2*8^2 + 3*8^1 + 3*8^0 + = 2*64 + 3*8 + 3*1 + = 128 + 24 + 3 + = 155 +``` diff --git a/exercises/practice/octal/.meta/config.json b/exercises/practice/octal/.meta/config.json new file mode 100644 index 000000000..154636352 --- /dev/null +++ b/exercises/practice/octal/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "All of Computer Science", + "source_url": "http://www.wolframalpha.com/input/?i=base+8" +} diff --git a/exercises/practice/octal/README.md b/exercises/practice/octal/README.md deleted file mode 100644 index df674988d..000000000 --- a/exercises/practice/octal/README.md +++ /dev/null @@ -1,119 +0,0 @@ -# Octal - -Convert an octal number, represented as a string (e.g. '1735263'), to its -decimal equivalent using first principles (i.e. no, you may not use built-in or -external libraries to accomplish the conversion). - -Implement octal to decimal conversion. Given an octal input -string, your program should produce a decimal output. - -## Note - -- Implement the conversion yourself. - Do not use something else to perform the conversion for you. -- Treat invalid input as octal 0. - -## About Octal (Base-8) - -Decimal is a base-10 system. - -A number 233 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: - -```text - 233 # decimal - = 2*10^2 + 3*10^1 + 3*10^0 - = 2*100 + 3*10 + 3*1 -``` - -Octal is similar, but uses powers of 8 rather than powers of 10. - -So: - -```text - 233 # octal - = 2*8^2 + 3*8^1 + 3*8^0 - = 2*64 + 3*8 + 3*1 - = 128 + 24 + 3 - = 155 -``` - -## Hints - -For the appropriate amount of challenge here, you should only -use functionality present in Prelude. Try not to use Data.List, -Data.Char, Data.Bits, or Numeric. - -Try and use seq, $!, or BangPatterns appropriately to ensure -that the solution is efficient. - -Handling invalid input is not necessary. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -All of Computer Science [http://www.wolframalpha.com/input/?i=base+8](http://www.wolframalpha.com/input/?i=base+8) - -## 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/practice/palindrome-products/.meta/hints.md b/exercises/practice/palindrome-products/.docs/instructions.append.md similarity index 100% rename from exercises/practice/palindrome-products/.meta/hints.md rename to exercises/practice/palindrome-products/.docs/instructions.append.md diff --git a/exercises/practice/palindrome-products/.docs/instructions.md b/exercises/practice/palindrome-products/.docs/instructions.md new file mode 100644 index 000000000..fd9a44124 --- /dev/null +++ b/exercises/practice/palindrome-products/.docs/instructions.md @@ -0,0 +1,33 @@ +# Instructions + +Detect palindrome products in a given range. + +A palindromic number is a number that remains the same when its digits are +reversed. For example, `121` is a palindromic number but `112` is not. + +Given a range of numbers, find the largest and smallest palindromes which +are products of two numbers within that range. + +Your solution should return the largest and smallest palindromes, along with the +factors of each within the range. If the largest or smallest palindrome has more +than one pair of factors within the range, then return all the pairs. + +## Example 1 + +Given the range `[1, 9]` (both inclusive)... + +And given the list of all possible products within this range: +`[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 15, 21, 24, 27, 20, 28, 32, 36, 25, 30, 35, 40, 45, 42, 48, 54, 49, 56, 63, 64, 72, 81]` + +The palindrome products are all single digit numbers (in this case): +`[1, 2, 3, 4, 5, 6, 7, 8, 9]` + +The smallest palindrome product is `1`. Its factors are `(1, 1)`. +The largest palindrome product is `9`. Its factors are `(1, 9)` and `(3, 3)`. + +## Example 2 + +Given the range `[10, 99]` (both inclusive)... + +The smallest palindrome product is `121`. Its factors are `(11, 11)`. +The largest palindrome product is `9009`. Its factors are `(91, 99)`. diff --git a/exercises/practice/palindrome-products/.meta/config.json b/exercises/practice/palindrome-products/.meta/config.json new file mode 100644 index 000000000..7ce4a8138 --- /dev/null +++ b/exercises/practice/palindrome-products/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Problem 4 at Project Euler", + "source_url": "http://projecteuler.net/problem=4" +} diff --git a/exercises/practice/palindrome-products/README.md b/exercises/practice/palindrome-products/README.md deleted file mode 100644 index 5a6b05426..000000000 --- a/exercises/practice/palindrome-products/README.md +++ /dev/null @@ -1,114 +0,0 @@ -# Palindrome Products - -Detect palindrome products in a given range. - -A palindromic number is a number that remains the same when its digits are -reversed. For example, `121` is a palindromic number but `112` is not. - -Given a range of numbers, find the largest and smallest palindromes which -are products of two numbers within that range. - -Your solution should return the largest and smallest palindromes, along with the -factors of each within the range. If the largest or smallest palindrome has more -than one pair of factors within the range, then return all the pairs. - -## Example 1 - -Given the range `[1, 9]` (both inclusive)... - -And given the list of all possible products within this range: -`[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 15, 21, 24, 27, 20, 28, 32, 36, 25, 30, 35, 40, 45, 42, 48, 54, 49, 56, 63, 64, 72, 81]` - -The palindrome products are all single digit numbers (in this case): -`[1, 2, 3, 4, 5, 6, 7, 8, 9]` - -The smallest palindrome product is `1`. Its factors are `(1, 1)`. -The largest palindrome product is `9`. Its factors are `(1, 9)` and `(3, 3)`. - -## Example 2 - -Given the range `[10, 99]` (both inclusive)... - -The smallest palindrome product is `121`. Its factors are `(11, 11)`. -The largest palindrome product is `9009`. Its factors are `(91, 99)`. - -## Hints - -To solve this exercise you need to implement these two functions: - -- `largestPalindrome` -- `smallestPalindrome` - -Both functions receive lower and upper factor limits, returning a pair -`(value, [(factor1, factor2)])` containing the palindrome and its possible -pairs of factors. - -Your can use the provided signatures if you are unsure about the types, but -don't let them restrict your creativity. - -It's ok to return duplicates in the factors list, and the order of the factors -is irrelevant. - -You should consider using a slightly different algorithm to find small or -large palindromes. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Problem 4 at Project Euler [http://projecteuler.net/problem=4](http://projecteuler.net/problem=4) - -## 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/practice/pangram/.docs/instructions.md b/exercises/practice/pangram/.docs/instructions.md new file mode 100644 index 000000000..dbba4f647 --- /dev/null +++ b/exercises/practice/pangram/.docs/instructions.md @@ -0,0 +1,9 @@ +# Instructions + +Determine if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma, +"every letter") is a sentence using every letter of the alphabet at least once. +The best known English pangram is: +> The quick brown fox jumps over the lazy dog. + +The alphabet used consists of ASCII letters `a` to `z`, inclusive, and is case +insensitive. Input will not contain non-ASCII symbols. diff --git a/exercises/practice/pangram/.meta/config.json b/exercises/practice/pangram/.meta/config.json new file mode 100644 index 000000000..d402d65df --- /dev/null +++ b/exercises/practice/pangram/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Pangram" +} diff --git a/exercises/practice/pangram/README.md b/exercises/practice/pangram/README.md deleted file mode 100644 index 4e2eb95e0..000000000 --- a/exercises/practice/pangram/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# Pangram - -Determine if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma, -"every letter") is a sentence using every letter of the alphabet at least once. -The best known English pangram is: -> The quick brown fox jumps over the lazy dog. - -The alphabet used consists of ASCII letters `a` to `z`, inclusive, and is case -insensitive. Input will not contain non-ASCII symbols. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [https://en.wikipedia.org/wiki/Pangram](https://en.wikipedia.org/wiki/Pangram) - -## 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/practice/parallel-letter-frequency/.meta/hints.md b/exercises/practice/parallel-letter-frequency/.docs/instructions.append.md similarity index 100% rename from exercises/practice/parallel-letter-frequency/.meta/hints.md rename to exercises/practice/parallel-letter-frequency/.docs/instructions.append.md diff --git a/exercises/practice/parallel-letter-frequency/.docs/instructions.md b/exercises/practice/parallel-letter-frequency/.docs/instructions.md new file mode 100644 index 000000000..a5b936c5e --- /dev/null +++ b/exercises/practice/parallel-letter-frequency/.docs/instructions.md @@ -0,0 +1,8 @@ +# Instructions + +Count the frequency of letters in texts using parallel computation. + +Parallelism is about doing things in parallel that can also be done +sequentially. A common example is counting the frequency of letters. +Create a function that returns the total frequency of each letter in a +list of texts and that employs parallelism. diff --git a/exercises/practice/parallel-letter-frequency/.meta/config.json b/exercises/practice/parallel-letter-frequency/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/parallel-letter-frequency/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/parallel-letter-frequency/README.md b/exercises/practice/parallel-letter-frequency/README.md deleted file mode 100644 index 0d521122c..000000000 --- a/exercises/practice/parallel-letter-frequency/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# Parallel Letter Frequency - -Count the frequency of letters in texts using parallel computation. - -Parallelism is about doing things in parallel that can also be done -sequentially. A common example is counting the frequency of letters. -Create a function that returns the total frequency of each letter in a -list of texts and that employs parallelism. - -## Hints - -Your code should contain a frequency :: Int -> [Text] -> Map Char Int -function which accepts a number of workers to use in parallel and a list -of texts and returns the total frequency of each letter in the text. - -### Benchmark - -Check how changing number of workers affects performance of your solution by running the benchmark. Use `stack bench` to run it. Feel free to modify `bench/Benchmark.hs` to explore your solution's performance on different inputs. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/pascals-triangle/.docs/instructions.md b/exercises/practice/pascals-triangle/.docs/instructions.md new file mode 100644 index 000000000..7109334fb --- /dev/null +++ b/exercises/practice/pascals-triangle/.docs/instructions.md @@ -0,0 +1,15 @@ +# Instructions + +Compute Pascal's triangle up to a given number of rows. + +In Pascal's Triangle each number is computed by adding the numbers to +the right and left of the current position in the previous row. + +```text + 1 + 1 1 + 1 2 1 + 1 3 3 1 +1 4 6 4 1 +# ... etc +``` diff --git a/exercises/practice/pascals-triangle/.meta/config.json b/exercises/practice/pascals-triangle/.meta/config.json new file mode 100644 index 000000000..31ba6bfda --- /dev/null +++ b/exercises/practice/pascals-triangle/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Pascal's Triangle at Wolfram Math World", + "source_url": "http://mathworld.wolfram.com/PascalsTriangle.html" +} diff --git a/exercises/practice/pascals-triangle/README.md b/exercises/practice/pascals-triangle/README.md deleted file mode 100644 index 98cc0cbc7..000000000 --- a/exercises/practice/pascals-triangle/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# Pascal's Triangle - -Compute Pascal's triangle up to a given number of rows. - -In Pascal's Triangle each number is computed by adding the numbers to -the right and left of the current position in the previous row. - -```text - 1 - 1 1 - 1 2 1 - 1 3 3 1 -1 4 6 4 1 -# ... etc -``` - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Pascal's Triangle at Wolfram Math World [http://mathworld.wolfram.com/PascalsTriangle.html](http://mathworld.wolfram.com/PascalsTriangle.html) - -## 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/practice/perfect-numbers/.docs/instructions.md b/exercises/practice/perfect-numbers/.docs/instructions.md new file mode 100644 index 000000000..144c9133e --- /dev/null +++ b/exercises/practice/perfect-numbers/.docs/instructions.md @@ -0,0 +1,18 @@ +# Instructions + +Determine if a number is perfect, abundant, or deficient based on +Nicomachus' (60 - 120 CE) classification scheme for positive integers. + +The Greek mathematician [Nicomachus](https://en.wikipedia.org/wiki/Nicomachus) devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum](https://en.wikipedia.org/wiki/Aliquot_sum). The aliquot sum is defined as the sum of the factors of a number not including the number itself. For example, the aliquot sum of 15 is (1 + 3 + 5) = 9 + +- **Perfect**: aliquot sum = number + - 6 is a perfect number because (1 + 2 + 3) = 6 + - 28 is a perfect number because (1 + 2 + 4 + 7 + 14) = 28 +- **Abundant**: aliquot sum > number + - 12 is an abundant number because (1 + 2 + 3 + 4 + 6) = 16 + - 24 is an abundant number because (1 + 2 + 3 + 4 + 6 + 8 + 12) = 36 +- **Deficient**: aliquot sum < number + - 8 is a deficient number because (1 + 2 + 4) = 7 + - Prime numbers are deficient + +Implement a way to determine whether a given number is **perfect**. Depending on your language track, you may also need to implement a way to determine whether a given number is **abundant** or **deficient**. diff --git a/exercises/practice/perfect-numbers/.meta/config.json b/exercises/practice/perfect-numbers/.meta/config.json new file mode 100644 index 000000000..62ef1d542 --- /dev/null +++ b/exercises/practice/perfect-numbers/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Taken from Chapter 2 of Functional Thinking by Neal Ford.", + "source_url": "http://shop.oreilly.com/product/0636920029687.do" +} diff --git a/exercises/practice/perfect-numbers/README.md b/exercises/practice/perfect-numbers/README.md deleted file mode 100644 index 3f6356a88..000000000 --- a/exercises/practice/perfect-numbers/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# Perfect Numbers - -Determine if a number is perfect, abundant, or deficient based on -Nicomachus' (60 - 120 CE) classification scheme for positive integers. - -The Greek mathematician [Nicomachus](https://en.wikipedia.org/wiki/Nicomachus) devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum](https://en.wikipedia.org/wiki/Aliquot_sum). The aliquot sum is defined as the sum of the factors of a number not including the number itself. For example, the aliquot sum of 15 is (1 + 3 + 5) = 9 - -- **Perfect**: aliquot sum = number - - 6 is a perfect number because (1 + 2 + 3) = 6 - - 28 is a perfect number because (1 + 2 + 4 + 7 + 14) = 28 -- **Abundant**: aliquot sum > number - - 12 is an abundant number because (1 + 2 + 3 + 4 + 6) = 16 - - 24 is an abundant number because (1 + 2 + 3 + 4 + 6 + 8 + 12) = 36 -- **Deficient**: aliquot sum < number - - 8 is a deficient number because (1 + 2 + 4) = 7 - - Prime numbers are deficient - -Implement a way to determine whether a given number is **perfect**. Depending on your language track, you may also need to implement a way to determine whether a given number is **abundant** or **deficient**. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Taken from Chapter 2 of Functional Thinking by Neal Ford. [http://shop.oreilly.com/product/0636920029687.do](http://shop.oreilly.com/product/0636920029687.do) - -## 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/practice/phone-number/.docs/instructions.md b/exercises/practice/phone-number/.docs/instructions.md new file mode 100644 index 000000000..6e36daefe --- /dev/null +++ b/exercises/practice/phone-number/.docs/instructions.md @@ -0,0 +1,29 @@ +# Instructions + +Clean up user-entered phone numbers so that they can be sent SMS messages. + +The **North American Numbering Plan (NANP)** is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda. All NANP-countries share the same international country code: `1`. + +NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as *area code*, followed by a seven-digit local number. The first three digits of the local number represent the *exchange code*, followed by the unique four-digit number which is the *subscriber number*. + +The format is usually represented as + +```text +(NXX)-NXX-XXXX +``` + +where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9. + +Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present. + +For example, the inputs +- `+1 (613)-995-0253` +- `613-995-0253` +- `1 613 995 0253` +- `613.995.0253` + +should all produce the output + +`6139950253` + +**Note:** As this exercise only deals with telephone numbers used in NANP-countries, only 1 is considered a valid country code. diff --git a/exercises/practice/phone-number/.meta/config.json b/exercises/practice/phone-number/.meta/config.json new file mode 100644 index 000000000..411c0ade6 --- /dev/null +++ b/exercises/practice/phone-number/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Event Manager by JumpstartLab", + "source_url": "http://tutorials.jumpstartlab.com/projects/eventmanager.html" +} diff --git a/exercises/practice/phone-number/README.md b/exercises/practice/phone-number/README.md deleted file mode 100644 index e35604ac5..000000000 --- a/exercises/practice/phone-number/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# Phone Number - -Clean up user-entered phone numbers so that they can be sent SMS messages. - -The **North American Numbering Plan (NANP)** is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda. All NANP-countries share the same international country code: `1`. - -NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as *area code*, followed by a seven-digit local number. The first three digits of the local number represent the *exchange code*, followed by the unique four-digit number which is the *subscriber number*. - -The format is usually represented as - -```text -(NXX)-NXX-XXXX -``` - -where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9. - -Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present. - -For example, the inputs -- `+1 (613)-995-0253` -- `613-995-0253` -- `1 613 995 0253` -- `613.995.0253` - -should all produce the output - -`6139950253` - -**Note:** As this exercise only deals with telephone numbers used in NANP-countries, only 1 is considered a valid country code. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Event Manager by JumpstartLab [http://tutorials.jumpstartlab.com/projects/eventmanager.html](http://tutorials.jumpstartlab.com/projects/eventmanager.html) - -## 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/practice/pig-latin/.meta/hints.md b/exercises/practice/pig-latin/.docs/instructions.append.md similarity index 100% rename from exercises/practice/pig-latin/.meta/hints.md rename to exercises/practice/pig-latin/.docs/instructions.append.md diff --git a/exercises/practice/pig-latin/.docs/instructions.md b/exercises/practice/pig-latin/.docs/instructions.md new file mode 100644 index 000000000..bcb125117 --- /dev/null +++ b/exercises/practice/pig-latin/.docs/instructions.md @@ -0,0 +1,18 @@ +# Instructions + +Implement a program that translates from English to Pig Latin. + +Pig Latin is a made-up children's language that's intended to be +confusing. It obeys a few simple rules (below), but when it's spoken +quickly it's really difficult for non-children (and non-native speakers) +to understand. + +- **Rule 1**: If a word begins with a vowel sound, add an "ay" sound to the end of the word. Please note that "xr" and "yt" at the beginning of a word make vowel sounds (e.g. "xray" -> "xrayay", "yttria" -> "yttriaay"). +- **Rule 2**: If a word begins with a consonant sound, move it to the end of the word and then add an "ay" sound to the end of the word. Consonant sounds can be made up of multiple consonants, a.k.a. a consonant cluster (e.g. "chair" -> "airchay"). +- **Rule 3**: If a word starts with a consonant sound followed by "qu", move it to the end of the word, and then add an "ay" sound to the end of the word (e.g. "square" -> "aresquay"). +- **Rule 4**: If a word contains a "y" after a consonant cluster or as the second letter in a two letter word it makes a vowel sound (e.g. "rhythm" -> "ythmrhay", "my" -> "ymay"). + +There are a few more rules for edge cases, and there are regional +variants too. + +See for more details. diff --git a/exercises/practice/pig-latin/.meta/config.json b/exercises/practice/pig-latin/.meta/config.json new file mode 100644 index 000000000..53d4387b0 --- /dev/null +++ b/exercises/practice/pig-latin/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "The Pig Latin exercise at Test First Teaching by Ultrasaurus", + "source_url": "https://github.com/ultrasaurus/test-first-teaching/blob/master/learn_ruby/pig_latin/" +} diff --git a/exercises/practice/pig-latin/README.md b/exercises/practice/pig-latin/README.md deleted file mode 100644 index bd81982fc..000000000 --- a/exercises/practice/pig-latin/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# Pig Latin - -Implement a program that translates from English to Pig Latin. - -Pig Latin is a made-up children's language that's intended to be -confusing. It obeys a few simple rules (below), but when it's spoken -quickly it's really difficult for non-children (and non-native speakers) -to understand. - -- **Rule 1**: If a word begins with a vowel sound, add an "ay" sound to the end of the word. Please note that "xr" and "yt" at the beginning of a word make vowel sounds (e.g. "xray" -> "xrayay", "yttria" -> "yttriaay"). -- **Rule 2**: If a word begins with a consonant sound, move it to the end of the word and then add an "ay" sound to the end of the word. Consonant sounds can be made up of multiple consonants, a.k.a. a consonant cluster (e.g. "chair" -> "airchay"). -- **Rule 3**: If a word starts with a consonant sound followed by "qu", move it to the end of the word, and then add an "ay" sound to the end of the word (e.g. "square" -> "aresquay"). -- **Rule 4**: If a word contains a "y" after a consonant cluster or as the second letter in a two letter word it makes a vowel sound (e.g. "rhythm" -> "ythmrhay", "my" -> "ymay"). - -There are a few more rules for edge cases, and there are regional -variants too. - -See for more details. - -## Hints - -The unit tests provide examples of words. Try and cluster consonants -independent of the specific combinations of consonants in the unit tests. - -This exercise works with textual data. For historical reasons, Haskell's -`String` type is synonymous with `[Char]`, a list of characters. For more -efficient handling of textual data, the `Text` type can be used. - -As an optional extension to this exercise, you can - -- Read about [string types](https://haskell-lang.org/tutorial/string-types) in Haskell. -- Add `- text` to your list of dependencies in package.yaml. -- Import `Data.Text` in [the following way](https://hackernoon.com/4-steps-to-a-better-imports-list-in-haskell-43a3d868273c): - - import qualified Data.Text as T - import Data.Text (Text) - -- You can now write e.g. `translate :: Text -> Text` and refer to `Data.Text` combinators as e.g. `T.isSuffixOf`. -- Look up the documentation for [`Data.Text`](https://hackage.haskell.org/package/text/docs/Data-Text.html), - -This part is entirely optional. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -The Pig Latin exercise at Test First Teaching by Ultrasaurus [https://github.com/ultrasaurus/test-first-teaching/blob/master/learn_ruby/pig_latin/](https://github.com/ultrasaurus/test-first-teaching/blob/master/learn_ruby/pig_latin/) - -## 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/practice/poker/.docs/instructions.md b/exercises/practice/poker/.docs/instructions.md new file mode 100644 index 000000000..6a38cf4bc --- /dev/null +++ b/exercises/practice/poker/.docs/instructions.md @@ -0,0 +1,6 @@ +# Instructions + +Pick the best hand(s) from a list of poker hands. + +See [wikipedia](https://en.wikipedia.org/wiki/List_of_poker_hands) for an +overview of poker hands. diff --git a/exercises/practice/poker/.meta/config.json b/exercises/practice/poker/.meta/config.json new file mode 100644 index 000000000..fcb428d52 --- /dev/null +++ b/exercises/practice/poker/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Inspired by the training course from Udacity.", + "source_url": "https://www.udacity.com/course/viewer#!/c-cs212/" +} diff --git a/exercises/practice/poker/README.md b/exercises/practice/poker/README.md deleted file mode 100644 index 069a0f72c..000000000 --- a/exercises/practice/poker/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# Poker - -Pick the best hand(s) from a list of poker hands. - -See [wikipedia](https://en.wikipedia.org/wiki/List_of_poker_hands) for an -overview of poker hands. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Inspired by the training course from Udacity. [https://www.udacity.com/course/viewer#!/c-cs212/](https://www.udacity.com/course/viewer#!/c-cs212/) - -## 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/practice/pov/.docs/instructions.md b/exercises/practice/pov/.docs/instructions.md new file mode 100644 index 000000000..25820172a --- /dev/null +++ b/exercises/practice/pov/.docs/instructions.md @@ -0,0 +1,38 @@ +# Instructions + +Reparent a graph on a selected node. + +This exercise is all about re-orientating a graph to see things from a different +point of view. For example family trees are usually presented from the +ancestor's perspective: + +```text + +------0------+ + | | | + +-1-+ +-2-+ +-3-+ + | | | | | | + 4 5 6 7 8 9 +``` + +But the same information can be presented from the perspective of any other node +in the graph, by pulling it up to the root and dragging its relationships along +with it. So the same graph from 6's perspective would look like: + +```text + 6 + | + +-----2-----+ + | | + 7 +-----0-----+ + | | + +-1-+ +-3-+ + | | | | + 4 5 8 9 +``` + +This lets us more simply describe the paths between two nodes. So for example +the path from 6-9 (which in the first graph goes up to the root and then down to +a different leaf node) can be seen to follow the path 6-2-0-3-9 + +This exercise involves taking an input graph and re-orientating it from the point +of view of one of the nodes. diff --git a/exercises/practice/pov/.meta/config.json b/exercises/practice/pov/.meta/config.json new file mode 100644 index 000000000..e177ac9db --- /dev/null +++ b/exercises/practice/pov/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Adaptation of exercise from 4clojure", + "source_url": "https://www.4clojure.com/" +} diff --git a/exercises/practice/pov/README.md b/exercises/practice/pov/README.md deleted file mode 100644 index c4092cffc..000000000 --- a/exercises/practice/pov/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# POV - -Reparent a graph on a selected node. - -This exercise is all about re-orientating a graph to see things from a different -point of view. For example family trees are usually presented from the -ancestor's perspective: - -```text - +------0------+ - | | | - +-1-+ +-2-+ +-3-+ - | | | | | | - 4 5 6 7 8 9 -``` - -But the same information can be presented from the perspective of any other node -in the graph, by pulling it up to the root and dragging its relationships along -with it. So the same graph from 6's perspective would look like: - -```text - 6 - | - +-----2-----+ - | | - 7 +-----0-----+ - | | - +-1-+ +-3-+ - | | | | - 4 5 8 9 -``` - -This lets us more simply describe the paths between two nodes. So for example -the path from 6-9 (which in the first graph goes up to the root and then down to -a different leaf node) can be seen to follow the path 6-2-0-3-9 - -This exercise involves taking an input graph and re-orientating it from the point -of view of one of the nodes. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Adaptation of exercise from 4clojure [https://www.4clojure.com/](https://www.4clojure.com/) - -## 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/practice/prime-factors/.docs/instructions.md b/exercises/practice/prime-factors/.docs/instructions.md new file mode 100644 index 000000000..b5cb1657e --- /dev/null +++ b/exercises/practice/prime-factors/.docs/instructions.md @@ -0,0 +1,30 @@ +# Instructions + +Compute the prime factors of a given natural number. + +A prime number is only evenly divisible by itself and 1. + +Note that 1 is not a prime number. + +## Example + +What are the prime factors of 60? + +- Our first divisor is 2. 2 goes into 60, leaving 30. +- 2 goes into 30, leaving 15. + - 2 doesn't go cleanly into 15. So let's move on to our next divisor, 3. +- 3 goes cleanly into 15, leaving 5. + - 3 does not go cleanly into 5. The next possible factor is 4. + - 4 does not go cleanly into 5. The next possible factor is 5. +- 5 does go cleanly into 5. +- We're left only with 1, so now, we're done. + +Our successful divisors in that computation represent the list of prime +factors of 60: 2, 2, 3, and 5. + +You can check this yourself: + +- 2 * 2 * 3 * 5 +- = 4 * 15 +- = 60 +- Success! diff --git a/exercises/practice/prime-factors/.meta/config.json b/exercises/practice/prime-factors/.meta/config.json new file mode 100644 index 000000000..93ed350a6 --- /dev/null +++ b/exercises/practice/prime-factors/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "The Prime Factors Kata by Uncle Bob", + "source_url": "http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata" +} diff --git a/exercises/practice/prime-factors/README.md b/exercises/practice/prime-factors/README.md deleted file mode 100644 index 7519aa22e..000000000 --- a/exercises/practice/prime-factors/README.md +++ /dev/null @@ -1,90 +0,0 @@ -# Prime Factors - -Compute the prime factors of a given natural number. - -A prime number is only evenly divisible by itself and 1. - -Note that 1 is not a prime number. - -## Example - -What are the prime factors of 60? - -- Our first divisor is 2. 2 goes into 60, leaving 30. -- 2 goes into 30, leaving 15. - - 2 doesn't go cleanly into 15. So let's move on to our next divisor, 3. -- 3 goes cleanly into 15, leaving 5. - - 3 does not go cleanly into 5. The next possible factor is 4. - - 4 does not go cleanly into 5. The next possible factor is 5. -- 5 does go cleanly into 5. -- We're left only with 1, so now, we're done. - -Our successful divisors in that computation represent the list of prime -factors of 60: 2, 2, 3, and 5. - -You can check this yourself: - -- 2 * 2 * 3 * 5 -- = 4 * 15 -- = 60 -- Success! - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -The Prime Factors Kata by Uncle Bob [http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata](http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata) - -## 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/practice/protein-translation/README.md b/exercises/practice/protein-translation/.docs/instructions.md similarity index 55% rename from exercises/practice/protein-translation/README.md rename to exercises/practice/protein-translation/.docs/instructions.md index fa945bc01..c211345ed 100644 --- a/exercises/practice/protein-translation/README.md +++ b/exercises/practice/protein-translation/.docs/instructions.md @@ -1,4 +1,4 @@ -# Protein Translation +# Instructions Translate RNA sequences into proteins. @@ -40,63 +40,3 @@ UGG | Tryptophan UAA, UAG, UGA | STOP Learn more about [protein translation on Wikipedia](http://en.wikipedia.org/wiki/Translation_(biology)) - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Tyler Long - -## 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/practice/protein-translation/.meta/config.json b/exercises/practice/protein-translation/.meta/config.json new file mode 100644 index 000000000..775fe02e5 --- /dev/null +++ b/exercises/practice/protein-translation/.meta/config.json @@ -0,0 +1,9 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Tyler Long" +} diff --git a/exercises/practice/proverb/.docs/instructions.md b/exercises/practice/proverb/.docs/instructions.md new file mode 100644 index 000000000..cf3b4c8b2 --- /dev/null +++ b/exercises/practice/proverb/.docs/instructions.md @@ -0,0 +1,17 @@ +# Instructions + +For want of a horseshoe nail, a kingdom was lost, or so the saying goes. + +Given a list of inputs, generate the relevant proverb. For example, given the list `["nail", "shoe", "horse", "rider", "message", "battle", "kingdom"]`, you will output the full text of this proverbial rhyme: + +```text +For want of a nail the shoe was lost. +For want of a shoe the horse was lost. +For want of a horse the rider was lost. +For want of a rider the message was lost. +For want of a message the battle was lost. +For want of a battle the kingdom was lost. +And all for the want of a nail. +``` + +Note that the list of inputs may vary; your solution should be able to handle lists of arbitrary length and content. No line of the output text should be a static, unchanging string; all should vary according to the input given. diff --git a/exercises/practice/proverb/.meta/config.json b/exercises/practice/proverb/.meta/config.json new file mode 100644 index 000000000..96dcb8187 --- /dev/null +++ b/exercises/practice/proverb/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "http://en.wikipedia.org/wiki/For_Want_of_a_Nail" +} diff --git a/exercises/practice/proverb/README.md b/exercises/practice/proverb/README.md deleted file mode 100644 index f79b5ab2c..000000000 --- a/exercises/practice/proverb/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# Proverb - -For want of a horseshoe nail, a kingdom was lost, or so the saying goes. - -Given a list of inputs, generate the relevant proverb. For example, given the list `["nail", "shoe", "horse", "rider", "message", "battle", "kingdom"]`, you will output the full text of this proverbial rhyme: - -```text -For want of a nail the shoe was lost. -For want of a shoe the horse was lost. -For want of a horse the rider was lost. -For want of a rider the message was lost. -For want of a message the battle was lost. -For want of a battle the kingdom was lost. -And all for the want of a nail. -``` - -Note that the list of inputs may vary; your solution should be able to handle lists of arbitrary length and content. No line of the output text should be a static, unchanging string; all should vary according to the input given. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [http://en.wikipedia.org/wiki/For_Want_of_a_Nail](http://en.wikipedia.org/wiki/For_Want_of_a_Nail) - -## 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/practice/pythagorean-triplet/.docs/instructions.md b/exercises/practice/pythagorean-triplet/.docs/instructions.md new file mode 100644 index 000000000..395ff6a55 --- /dev/null +++ b/exercises/practice/pythagorean-triplet/.docs/instructions.md @@ -0,0 +1,24 @@ +# Instructions + +A Pythagorean triplet is a set of three natural numbers, {a, b, c}, for +which, + +```text +a**2 + b**2 = c**2 +``` + +and such that, + +```text +a < b < c +``` + +For example, + +```text +3**2 + 4**2 = 9 + 16 = 25 = 5**2. +``` + +Given an input integer N, find all Pythagorean triplets for which `a + b + c = N`. + +For example, with N = 1000, there is exactly one Pythagorean triplet for which `a + b + c = 1000`: `{200, 375, 425}`. diff --git a/exercises/practice/pythagorean-triplet/.meta/config.json b/exercises/practice/pythagorean-triplet/.meta/config.json new file mode 100644 index 000000000..99e683cf3 --- /dev/null +++ b/exercises/practice/pythagorean-triplet/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Problem 9 at Project Euler", + "source_url": "http://projecteuler.net/problem=9" +} diff --git a/exercises/practice/pythagorean-triplet/README.md b/exercises/practice/pythagorean-triplet/README.md deleted file mode 100644 index ae4d1d28b..000000000 --- a/exercises/practice/pythagorean-triplet/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# Pythagorean Triplet - -A Pythagorean triplet is a set of three natural numbers, {a, b, c}, for -which, - -```text -a**2 + b**2 = c**2 -``` - -and such that, - -```text -a < b < c -``` - -For example, - -```text -3**2 + 4**2 = 9 + 16 = 25 = 5**2. -``` - -Given an input integer N, find all Pythagorean triplets for which `a + b + c = N`. - -For example, with N = 1000, there is exactly one Pythagorean triplet for which `a + b + c = 1000`: `{200, 375, 425}`. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Problem 9 at Project Euler [http://projecteuler.net/problem=9](http://projecteuler.net/problem=9) - -## 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/practice/queen-attack/.meta/hints.md b/exercises/practice/queen-attack/.docs/instructions.append.md similarity index 100% rename from exercises/practice/queen-attack/.meta/hints.md rename to exercises/practice/queen-attack/.docs/instructions.append.md diff --git a/exercises/practice/queen-attack/.docs/instructions.md b/exercises/practice/queen-attack/.docs/instructions.md new file mode 100644 index 000000000..1f8e61a68 --- /dev/null +++ b/exercises/practice/queen-attack/.docs/instructions.md @@ -0,0 +1,27 @@ +# Instructions + +Given the position of two queens on a chess board, indicate whether or not they +are positioned so that they can attack each other. + +In the game of chess, a queen can attack pieces which are on the same +row, column, or diagonal. + +A chessboard can be represented by an 8 by 8 array. + +So if you're told the white queen is at (2, 3) and the black queen at +(5, 6), then you'd know you've got a set-up like so: + +```text +_ _ _ _ _ _ _ _ +_ _ _ _ _ _ _ _ +_ _ _ W _ _ _ _ +_ _ _ _ _ _ _ _ +_ _ _ _ _ _ _ _ +_ _ _ _ _ _ B _ +_ _ _ _ _ _ _ _ +_ _ _ _ _ _ _ _ +``` + +You'd also be able to answer whether the queens can attack each other. +In this case, that answer would be yes, they can, because both pieces +share a diagonal. diff --git a/exercises/practice/queen-attack/.meta/config.json b/exercises/practice/queen-attack/.meta/config.json new file mode 100644 index 000000000..4f6d17a38 --- /dev/null +++ b/exercises/practice/queen-attack/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "J Dalbey's Programming Practice problems", + "source_url": "http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html" +} diff --git a/exercises/practice/queen-attack/README.md b/exercises/practice/queen-attack/README.md deleted file mode 100644 index d2246a190..000000000 --- a/exercises/practice/queen-attack/README.md +++ /dev/null @@ -1,105 +0,0 @@ -# Queen Attack - -Given the position of two queens on a chess board, indicate whether or not they -are positioned so that they can attack each other. - -In the game of chess, a queen can attack pieces which are on the same -row, column, or diagonal. - -A chessboard can be represented by an 8 by 8 array. - -So if you're told the white queen is at (2, 3) and the black queen at -(5, 6), then you'd know you've got a set-up like so: - -```text -_ _ _ _ _ _ _ _ -_ _ _ _ _ _ _ _ -_ _ _ W _ _ _ _ -_ _ _ _ _ _ _ _ -_ _ _ _ _ _ _ _ -_ _ _ _ _ _ B _ -_ _ _ _ _ _ _ _ -_ _ _ _ _ _ _ _ -``` - -You'd also be able to answer whether the queens can attack each other. -In this case, that answer would be yes, they can, because both pieces -share a diagonal. - -## Hints - -To complete this exercise, you need to implement the following functions: - -- `boardString` -- `canAttack` - -You will find the type signatures already in place, but it is up to you -to define the functions. - -Positions are specified as two-tuples: - -- The first element is the row (rank in Chess terms). -- The second element is is the column (file in Chess terms). -- (0, 0) is the top left of the board, (0, 7) is the upper right, -- (7, 0) is the bottom left, and (7, 7) is the bottom right. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -J Dalbey's Programming Practice problems [http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html](http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html) - -## 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/practice/rail-fence-cipher/README.md b/exercises/practice/rail-fence-cipher/.docs/instructions.md similarity index 53% rename from exercises/practice/rail-fence-cipher/README.md rename to exercises/practice/rail-fence-cipher/.docs/instructions.md index e864b8ef3..0e75a2bf7 100644 --- a/exercises/practice/rail-fence-cipher/README.md +++ b/exercises/practice/rail-fence-cipher/.docs/instructions.md @@ -1,4 +1,4 @@ -# Rail Fence Cipher +# Instructions Implement encoding and decoding for the rail fence cipher. @@ -57,63 +57,3 @@ W . . . E . . . C . . . R . . . L . . . T . . . E ``` If you now read along the zig-zag shape you can read the original message. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [https://en.wikipedia.org/wiki/Transposition_cipher#Rail_Fence_cipher](https://en.wikipedia.org/wiki/Transposition_cipher#Rail_Fence_cipher) - -## 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/practice/rail-fence-cipher/.meta/config.json b/exercises/practice/rail-fence-cipher/.meta/config.json new file mode 100644 index 000000000..50a1ae3c0 --- /dev/null +++ b/exercises/practice/rail-fence-cipher/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Transposition_cipher#Rail_Fence_cipher" +} diff --git a/exercises/practice/raindrops/.meta/hints.md b/exercises/practice/raindrops/.docs/instructions.append.md similarity index 100% rename from exercises/practice/raindrops/.meta/hints.md rename to exercises/practice/raindrops/.docs/instructions.append.md diff --git a/exercises/practice/raindrops/.docs/instructions.md b/exercises/practice/raindrops/.docs/instructions.md new file mode 100644 index 000000000..a78585df2 --- /dev/null +++ b/exercises/practice/raindrops/.docs/instructions.md @@ -0,0 +1,16 @@ +# Instructions + +Your task is to convert a number into a string that contains raindrop sounds corresponding to certain potential factors. A factor is a number that evenly divides into another number, leaving no remainder. The simplest way to test if a one number is a factor of another is to use the [modulo operation](https://en.wikipedia.org/wiki/Modulo_operation). + +The rules of `raindrops` are that if a given number: + +- has 3 as a factor, add 'Pling' to the result. +- has 5 as a factor, add 'Plang' to the result. +- has 7 as a factor, add 'Plong' to the result. +- _does not_ have any of 3, 5, or 7 as a factor, the result should be the digits of the number. + +## Examples + +- 28 has 7 as a factor, but not 3 or 5, so the result would be "Plong". +- 30 has both 3 and 5 as factors, but not 7, so the result would be "PlingPlang". +- 34 is not factored by 3, 5, or 7, so the result would be "34". diff --git a/exercises/practice/raindrops/.meta/config.json b/exercises/practice/raindrops/.meta/config.json new file mode 100644 index 000000000..6e48df372 --- /dev/null +++ b/exercises/practice/raindrops/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "A variation on FizzBuzz, a famous technical interview question that is intended to weed out potential candidates. That question is itself derived from Fizz Buzz, a popular children's game for teaching division.", + "source_url": "https://en.wikipedia.org/wiki/Fizz_buzz" +} diff --git a/exercises/practice/raindrops/README.md b/exercises/practice/raindrops/README.md deleted file mode 100644 index 7588ffaef..000000000 --- a/exercises/practice/raindrops/README.md +++ /dev/null @@ -1,112 +0,0 @@ -# Raindrops - -Your task is to convert a number into a string that contains raindrop sounds corresponding to certain potential factors. A factor is a number that evenly divides into another number, leaving no remainder. The simplest way to test if a one number is a factor of another is to use the [modulo operation](https://en.wikipedia.org/wiki/Modulo_operation). - -The rules of `raindrops` are that if a given number: - -- has 3 as a factor, add 'Pling' to the result. -- has 5 as a factor, add 'Plang' to the result. -- has 7 as a factor, add 'Plong' to the result. -- _does not_ have any of 3, 5, or 7 as a factor, the result should be the digits of the number. - -## Examples - -- 28 has 7 as a factor, but not 3 or 5, so the result would be "Plong". -- 30 has both 3 and 5 as factors, but not 7, so the result would be "PlingPlang". -- 34 is not factored by 3, 5, or 7, so the result would be "34". - -## Hints - -You need to implement the `convert` function that returns number converted to -raindrop sound. You can use the provided signature if you are unsure -about the types, but don't let it restrict your creativity: - -```haskell -convert :: Int -> String -``` - -This exercise works with textual data. For historical reasons, Haskell's -`String` type is synonymous with `[Char]`, a list of characters. For more -efficient handling of textual data, the `Text` type can be used. - -As an optional extension to this exercise, you can - -- Read about [string types](https://haskell-lang.org/tutorial/string-types) in Haskell. -- Add `- text` to your list of dependencies in package.yaml. -- Import `Data.Text` in [the following way](https://hackernoon.com/4-steps-to-a-better-imports-list-in-haskell-43a3d868273c): - -```haskell -import qualified Data.Text as T -import Data.Text (Text) -``` - -- You can now write e.g. `convert :: Int -> Text` and refer to `Data.Text` combinators as e.g. `T.pack`. -- Look up the documentation for [`Data.Text`](https://hackage.haskell.org/package/text/docs/Data-Text.html), -- You can then replace all occurrences of `String` with `Text` in Raindrops.hs: - -```haskell -convert :: Int -> Text -``` - -This part is entirely optional. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -A variation on FizzBuzz, a famous technical interview question that is intended to weed out potential candidates. That question is itself derived from Fizz Buzz, a popular children's game for teaching division. [https://en.wikipedia.org/wiki/Fizz_buzz](https://en.wikipedia.org/wiki/Fizz_buzz) - -## 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/practice/resistor-color-duo/.meta/hints.md b/exercises/practice/resistor-color-duo/.docs/instructions.append.md similarity index 100% rename from exercises/practice/resistor-color-duo/.meta/hints.md rename to exercises/practice/resistor-color-duo/.docs/instructions.append.md diff --git a/exercises/practice/resistor-color-duo/.docs/instructions.md b/exercises/practice/resistor-color-duo/.docs/instructions.md new file mode 100644 index 000000000..85cf11301 --- /dev/null +++ b/exercises/practice/resistor-color-duo/.docs/instructions.md @@ -0,0 +1,34 @@ +# Instructions + +If you want to build something using a Raspberry Pi, you'll probably use _resistors_. +For this exercise, you need to know two things about them: + +* Each resistor has a resistance value. +* Resistors are small - so small in fact that if you printed the resistance value on them, it would be hard to read. + +To get around this problem, manufacturers print color-coded bands onto the resistors to denote their resistance values. +Each band has a position and a numeric value. + +The first 2 bands of a resistor have a simple encoding scheme: each color maps to a single number. +For example, if they printed a brown band (value 1) followed by a green band (value 5), it would translate to the number 15. + +In this exercise you are going to create a helpful program so that you don't have to remember the values of the bands. +The program will take color names as input and output a two digit number, even if the input is more than two colors! + +The band colors are encoded as follows: + +- Black: 0 +- Brown: 1 +- Red: 2 +- Orange: 3 +- Yellow: 4 +- Green: 5 +- Blue: 6 +- Violet: 7 +- Grey: 8 +- White: 9 + +From the example above: +brown-green should return 15 +brown-green-violet should return 15 too, ignoring the third color. + diff --git a/exercises/practice/resistor-color-duo/.meta/config.json b/exercises/practice/resistor-color-duo/.meta/config.json new file mode 100644 index 000000000..1b78172e5 --- /dev/null +++ b/exercises/practice/resistor-color-duo/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Maud de Vries, Erik Schierboom", + "source_url": "https://github.com/exercism/problem-specifications/issues/1464" +} diff --git a/exercises/practice/resistor-color-duo/README.md b/exercises/practice/resistor-color-duo/README.md deleted file mode 100644 index a3ae5df37..000000000 --- a/exercises/practice/resistor-color-duo/README.md +++ /dev/null @@ -1,123 +0,0 @@ -# Resistor Color Duo - -If you want to build something using a Raspberry Pi, you'll probably use _resistors_. -For this exercise, you need to know two things about them: - -* Each resistor has a resistance value. -* Resistors are small - so small in fact that if you printed the resistance value on them, it would be hard to read. - -To get around this problem, manufacturers print color-coded bands onto the resistors to denote their resistance values. -Each band has a position and a numeric value. - -The first 2 bands of a resistor have a simple encoding scheme: each color maps to a single number. -For example, if they printed a brown band (value 1) followed by a green band (value 5), it would translate to the number 15. - -In this exercise you are going to create a helpful program so that you don't have to remember the values of the bands. -The program will take color names as input and output a two digit number, even if the input is more than two colors! - -The band colors are encoded as follows: - -- Black: 0 -- Brown: 1 -- Red: 2 -- Orange: 3 -- Yellow: 4 -- Green: 5 -- Blue: 6 -- Violet: 7 -- Grey: 8 -- White: 9 - -From the example above: -brown-green should return 15 -brown-green-violet should return 15 too, ignoring the third color. - - -## Hints - -You need to implement the function - -```haskell -value :: (Color, Color) -> Int -``` - -that only accepts two colors and produces the resistor's numeric value -component of its resistance. - -**Bonus - Property Testing:** - -This exercise is a good opportunity to write some [property tests](https://en.wikipedia.org/wiki/Property_testing). If you haven't written any before here are some resources: - -1. [School of Haskell](https://www.schoolofhaskell.com/user/pbv/an-introduction-to-quickcheck-testing). -2. [Real world Haskell](http://book.realworldhaskell.org/read/testing-and-quality-assurance.html) - -We have provided one sample QuickCheck property test in the test file. - -Examples of properties that can be tested: - -- `value (x, y) >= 10` for all `(x, y)` where `x` isn't `Black` - -- Calling `show` on `value (x, y)` produces the `reverse` String of calling `show` on `value (y, x)`. - -- All colors have unique names. (For any two colors, if the colors are different, so are their names.) - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Maud de Vries, Erik Schierboom [https://github.com/exercism/problem-specifications/issues/1464](https://github.com/exercism/problem-specifications/issues/1464) - -## 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/practice/resistor-color-trio/.meta/hints.md b/exercises/practice/resistor-color-trio/.docs/instructions.append.md similarity index 100% rename from exercises/practice/resistor-color-trio/.meta/hints.md rename to exercises/practice/resistor-color-trio/.docs/instructions.append.md diff --git a/exercises/practice/resistor-color-trio/.docs/instructions.md b/exercises/practice/resistor-color-trio/.docs/instructions.md new file mode 100644 index 000000000..06a14d7e7 --- /dev/null +++ b/exercises/practice/resistor-color-trio/.docs/instructions.md @@ -0,0 +1,45 @@ +# Instructions + +If you want to build something using a Raspberry Pi, you'll probably use _resistors_. For this exercise, you need to know only three things about them: + +- Each resistor has a resistance value. +- Resistors are small - so small in fact that if you printed the resistance value on them, it would be hard to read. + To get around this problem, manufacturers print color-coded bands onto the resistors to denote their resistance values. +- Each band acts as a digit of a number. For example, if they printed a brown band (value 1) followed by a green band (value 5), it would translate to the number 15. + In this exercise, you are going to create a helpful program so that you don't have to remember the values of the bands. The program will take 3 colors as input, and outputs the correct value, in ohms. + The color bands are encoded as follows: + +* Black: 0 +* Brown: 1 +* Red: 2 +* Orange: 3 +* Yellow: 4 +* Green: 5 +* Blue: 6 +* Violet: 7 +* Grey: 8 +* White: 9 + +In `resistor-color duo` you decoded the first two colors. For instance: orange-orange got the main value `33`. +The third color stands for how many zeros need to be added to the main value. The main value plus the zeros gives us a value in ohms. +For the exercise it doesn't matter what ohms really are. +For example: + +- orange-orange-black would be 33 and no zeros, which becomes 33 ohms. +- orange-orange-red would be 33 and 2 zeros, which becomes 3300 ohms. +- orange-orange-orange would be 33 and 3 zeros, which becomes 33000 ohms. + +(If Math is your thing, you may want to think of the zeros as exponents of 10. If Math is not your thing, go with the zeros. It really is the same thing, just in plain English instead of Math lingo.) + +This exercise is about translating the colors into a label: + +> "... ohms" + +So an input of `"orange", "orange", "black"` should return: + +> "33 ohms" + +When we get more than a thousand ohms, we say "kiloohms". That's similar to saying "kilometer" for 1000 meters, and "kilograms" for 1000 grams. +So an input of `"orange", "orange", "orange"` should return: + +> "33 kiloohms" diff --git a/exercises/practice/resistor-color-trio/.meta/config.json b/exercises/practice/resistor-color-trio/.meta/config.json new file mode 100644 index 000000000..6598632b7 --- /dev/null +++ b/exercises/practice/resistor-color-trio/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Maud de Vries, Erik Schierboom", + "source_url": "https://github.com/exercism/problem-specifications/issues/1549" +} diff --git a/exercises/practice/resistor-color-trio/README.md b/exercises/practice/resistor-color-trio/README.md deleted file mode 100644 index b79a808e1..000000000 --- a/exercises/practice/resistor-color-trio/README.md +++ /dev/null @@ -1,131 +0,0 @@ -# Resistor Color Trio - -If you want to build something using a Raspberry Pi, you'll probably use _resistors_. For this exercise, you need to know only three things about them: - -- Each resistor has a resistance value. -- Resistors are small - so small in fact that if you printed the resistance value on them, it would be hard to read. - To get around this problem, manufacturers print color-coded bands onto the resistors to denote their resistance values. -- Each band acts as a digit of a number. For example, if they printed a brown band (value 1) followed by a green band (value 5), it would translate to the number 15. - In this exercise, you are going to create a helpful program so that you don't have to remember the values of the bands. The program will take 3 colors as input, and outputs the correct value, in ohms. - The color bands are encoded as follows: - -* Black: 0 -* Brown: 1 -* Red: 2 -* Orange: 3 -* Yellow: 4 -* Green: 5 -* Blue: 6 -* Violet: 7 -* Grey: 8 -* White: 9 - -In `resistor-color duo` you decoded the first two colors. For instance: orange-orange got the main value `33`. -The third color stands for how many zeros need to be added to the main value. The main value plus the zeros gives us a value in ohms. -For the exercise it doesn't matter what ohms really are. -For example: - -- orange-orange-black would be 33 and no zeros, which becomes 33 ohms. -- orange-orange-red would be 33 and 2 zeros, which becomes 3300 ohms. -- orange-orange-orange would be 33 and 3 zeros, which becomes 33000 ohms. - -(If Math is your thing, you may want to think of the zeros as exponents of 10. If Math is not your thing, go with the zeros. It really is the same thing, just in plain English instead of Math lingo.) - -This exercise is about translating the colors into a label: - -> "... ohms" - -So an input of `"orange", "orange", "black"` should return: - -> "33 ohms" - -When we get more than a thousand ohms, we say "kiloohms". That's similar to saying "kilometer" for 1000 meters, and "kilograms" for 1000 grams. -So an input of `"orange", "orange", "orange"` should return: - -> "33 kiloohms" - -## Hints - -You need to implement the functions `label` and `ohms`. You can use the -provided signature for `label`, but don't let it restrict your creativity. - -This exercise works with textual data. For historical reasons, Haskell's -`String` type is synonymous with `[Char]`, a list of characters. For more -efficient handling of textual data, the `Text` type can be used. - -As an optional extension to this exercise, you can - -- Read about [string types](https://haskell-lang.org/tutorial/string-types) in Haskell. -- Add `- text` to your list of dependencies in package.yaml. -- Import `Data.Text` in [the following way](https://hackernoon.com/4-steps-to-a-better-imports-list-in-haskell-43a3d868273c): - - ```haskell - import qualified Data.Text as T - import Data.Text (Text) - ``` - -- You can now write e.g. `label :: Resistor -> Text` and refer to `Data.Text` combinators as e.g. `T.pack`. -- Look up the documentation for [`Data.Text`](https://hackage.haskell.org/package/text/docs/Data-Text.html), - -This part is entirely optional. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Maud de Vries, Erik Schierboom [https://github.com/exercism/problem-specifications/issues/1549](https://github.com/exercism/problem-specifications/issues/1549) - -## 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/practice/rna-transcription/.meta/hints.md b/exercises/practice/rna-transcription/.docs/instructions.append.md similarity index 100% rename from exercises/practice/rna-transcription/.meta/hints.md rename to exercises/practice/rna-transcription/.docs/instructions.append.md diff --git a/exercises/practice/rna-transcription/.docs/instructions.md b/exercises/practice/rna-transcription/.docs/instructions.md new file mode 100644 index 000000000..9e86efea9 --- /dev/null +++ b/exercises/practice/rna-transcription/.docs/instructions.md @@ -0,0 +1,19 @@ +# Instructions + +Given a DNA strand, return its RNA complement (per RNA transcription). + +Both DNA and RNA strands are a sequence of nucleotides. + +The four nucleotides found in DNA are adenine (**A**), cytosine (**C**), +guanine (**G**) and thymine (**T**). + +The four nucleotides found in RNA are adenine (**A**), cytosine (**C**), +guanine (**G**) and uracil (**U**). + +Given a DNA strand, its transcribed RNA strand is formed by replacing +each nucleotide with its complement: + +* `G` -> `C` +* `C` -> `G` +* `T` -> `A` +* `A` -> `U` diff --git a/exercises/practice/rna-transcription/.meta/config.json b/exercises/practice/rna-transcription/.meta/config.json new file mode 100644 index 000000000..2ad603b80 --- /dev/null +++ b/exercises/practice/rna-transcription/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Hyperphysics", + "source_url": "http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html" +} diff --git a/exercises/practice/rna-transcription/README.md b/exercises/practice/rna-transcription/README.md deleted file mode 100644 index 7f82304b3..000000000 --- a/exercises/practice/rna-transcription/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# RNA Transcription - -Given a DNA strand, return its RNA complement (per RNA transcription). - -Both DNA and RNA strands are a sequence of nucleotides. - -The four nucleotides found in DNA are adenine (**A**), cytosine (**C**), -guanine (**G**) and thymine (**T**). - -The four nucleotides found in RNA are adenine (**A**), cytosine (**C**), -guanine (**G**) and uracil (**U**). - -Given a DNA strand, its transcribed RNA strand is formed by replacing -each nucleotide with its complement: - -* `G` -> `C` -* `C` -> `G` -* `T` -> `A` -* `A` -> `U` - -Given invalid output, your program should return the first invalid character. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Hyperphysics [http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html](http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html) - -## 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/practice/robot-name/.meta/hints.md b/exercises/practice/robot-name/.docs/instructions.append.md similarity index 100% rename from exercises/practice/robot-name/.meta/hints.md rename to exercises/practice/robot-name/.docs/instructions.append.md diff --git a/exercises/practice/robot-name/.docs/instructions.md b/exercises/practice/robot-name/.docs/instructions.md new file mode 100644 index 000000000..a0079a341 --- /dev/null +++ b/exercises/practice/robot-name/.docs/instructions.md @@ -0,0 +1,16 @@ +# Instructions + +Manage robot factory settings. + +When a robot comes off the factory floor, it has no name. + +The first time you turn on a robot, a random name is generated in the format +of two uppercase letters followed by three digits, such as RX837 or BC811. + +Every once in a while we need to reset a robot to its factory settings, +which means that its name gets wiped. The next time you ask, that robot will +respond with a new random name. + +The names must be random: they should not follow a predictable sequence. +Using random names means a risk of collisions. Your solution must ensure that +every existing robot has a unique name. diff --git a/exercises/practice/robot-name/.meta/config.json b/exercises/practice/robot-name/.meta/config.json new file mode 100644 index 000000000..28517fc0a --- /dev/null +++ b/exercises/practice/robot-name/.meta/config.json @@ -0,0 +1,9 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "A debugging session with Paul Blackwell at gSchool." +} diff --git a/exercises/practice/robot-name/README.md b/exercises/practice/robot-name/README.md deleted file mode 100644 index 1d1910503..000000000 --- a/exercises/practice/robot-name/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# Robot Name - -Manage robot factory settings. - -When a robot comes off the factory floor, it has no name. - -The first time you turn on a robot, a random name is generated in the format -of two uppercase letters followed by three digits, such as RX837 or BC811. - -Every once in a while we need to reset a robot to its factory settings, -which means that its name gets wiped. The next time you ask, that robot will -respond with a new random name. - -The names must be random: they should not follow a predictable sequence. -Using random names means a risk of collisions. Your solution must ensure that -every existing robot has a unique name. - -## Hints - -To complete this exercise, you need to create the data type `Robot`, -as a mutable variable, and the data type `RunState`. You also need to -implement the following functions: - -- `initialState` -- `mkRobot` -- `resetName` -- `robotName` - -You will find a dummy data declaration and type signatures already in place, -but it is up to you to define the functions and create a meaningful data type, -newtype or type synonym. To model state this exercise uses the -[`State`](https://en.wikibooks.org/wiki/Haskell/Understanding_monads/State) -monad. More specifically we combine the `State` monad with the `IO` monad using -the [`StateT` monad transfomers](http://book.realworldhaskell.org/read/monad-transformers.html). -All tests are run with `initialState` as the state fed into to `evalStateT`. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -A debugging session with Paul Blackwell at gSchool. - -## 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/practice/robot-simulator/.meta/hints.md b/exercises/practice/robot-simulator/.docs/instructions.append.md similarity index 100% rename from exercises/practice/robot-simulator/.meta/hints.md rename to exercises/practice/robot-simulator/.docs/instructions.append.md diff --git a/exercises/practice/robot-simulator/.docs/instructions.md b/exercises/practice/robot-simulator/.docs/instructions.md new file mode 100644 index 000000000..83be50ccc --- /dev/null +++ b/exercises/practice/robot-simulator/.docs/instructions.md @@ -0,0 +1,28 @@ +# Instructions + +Write a robot simulator. + +A robot factory's test facility needs a program to verify robot movements. + +The robots have three possible movements: + +- turn right +- turn left +- advance + +Robots are placed on a hypothetical infinite grid, facing a particular +direction (north, east, south, or west) at a set of {x,y} coordinates, +e.g., {3,8}, with coordinates increasing to the north and east. + +The robot then receives a number of instructions, at which point the +testing facility verifies the robot's new position, and in which +direction it is pointing. + +- The letter-string "RAALAL" means: + - Turn right + - Advance twice + - Turn left + - Advance once + - Turn left yet again +- Say a robot starts at {7, 3} facing north. Then running this stream + of instructions should leave it at {9, 4} facing west. diff --git a/exercises/practice/robot-simulator/.meta/config.json b/exercises/practice/robot-simulator/.meta/config.json new file mode 100644 index 000000000..132c673d7 --- /dev/null +++ b/exercises/practice/robot-simulator/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Inspired by an interview question at a famous company.", + "source_url": "" +} diff --git a/exercises/practice/robot-simulator/README.md b/exercises/practice/robot-simulator/README.md deleted file mode 100644 index 48256eb58..000000000 --- a/exercises/practice/robot-simulator/README.md +++ /dev/null @@ -1,105 +0,0 @@ -# Robot Simulator - -Write a robot simulator. - -A robot factory's test facility needs a program to verify robot movements. - -The robots have three possible movements: - -- turn right -- turn left -- advance - -Robots are placed on a hypothetical infinite grid, facing a particular -direction (north, east, south, or west) at a set of {x,y} coordinates, -e.g., {3,8}, with coordinates increasing to the north and east. - -The robot then receives a number of instructions, at which point the -testing facility verifies the robot's new position, and in which -direction it is pointing. - -- The letter-string "RAALAL" means: - - Turn right - - Advance twice - - Turn left - - Advance once - - Turn left yet again -- Say a robot starts at {7, 3} facing north. Then running this stream - of instructions should leave it at {9, 4} facing west. - -## Hints - -To complete this exercise, you need to create the data type `Robot`, -and implement the following functions: - -- `bearing` -- `coordinates` -- `mkRobot` -- `simulate` -- `turnLeft` -- `turnRight` - -You will find a dummy data declaration and type signatures already in place, -but it is up to you to define the functions and create a meaningful data type, -newtype or type synonym. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Inspired by an interview question at a famous company. - -## 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/practice/roman-numerals/.meta/hints.md b/exercises/practice/roman-numerals/.docs/instructions.append.md similarity index 100% rename from exercises/practice/roman-numerals/.meta/hints.md rename to exercises/practice/roman-numerals/.docs/instructions.append.md diff --git a/exercises/practice/roman-numerals/.docs/instructions.md b/exercises/practice/roman-numerals/.docs/instructions.md new file mode 100644 index 000000000..ce25f205e --- /dev/null +++ b/exercises/practice/roman-numerals/.docs/instructions.md @@ -0,0 +1,43 @@ +# Instructions + +Write a function to convert from normal numbers to Roman Numerals. + +The Romans were a clever bunch. They conquered most of Europe and ruled +it for hundreds of years. They invented concrete and straight roads and +even bikinis. One thing they never discovered though was the number +zero. This made writing and dating extensive histories of their exploits +slightly more challenging, but the system of numbers they came up with +is still in use today. For example the BBC uses Roman numerals to date +their programmes. + +The Romans wrote numbers using letters - I, V, X, L, C, D, M. (notice +these letters have lots of straight lines and are hence easy to hack +into stone tablets). + +```text + 1 => I +10 => X + 7 => VII +``` + +There is no need to be able to convert numbers larger than about 3000. +(The Romans themselves didn't tend to go any higher) + +Wikipedia says: Modern Roman numerals ... are written by expressing each +digit separately starting with the left most digit and skipping any +digit with a value of zero. + +To see this in practice, consider the example of 1990. + +In Roman numerals 1990 is MCMXC: + +1000=M +900=CM +90=XC + +2008 is written as MMVIII: + +2000=MM +8=VIII + +See also: http://www.novaroma.org/via_romana/numbers.html diff --git a/exercises/practice/roman-numerals/.meta/config.json b/exercises/practice/roman-numerals/.meta/config.json new file mode 100644 index 000000000..6f551dd00 --- /dev/null +++ b/exercises/practice/roman-numerals/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "The Roman Numeral Kata", + "source_url": "http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals" +} diff --git a/exercises/practice/roman-numerals/README.md b/exercises/practice/roman-numerals/README.md deleted file mode 100644 index ac4c2c83b..000000000 --- a/exercises/practice/roman-numerals/README.md +++ /dev/null @@ -1,112 +0,0 @@ -# Roman Numerals - -Write a function to convert from normal numbers to Roman Numerals. - -The Romans were a clever bunch. They conquered most of Europe and ruled -it for hundreds of years. They invented concrete and straight roads and -even bikinis. One thing they never discovered though was the number -zero. This made writing and dating extensive histories of their exploits -slightly more challenging, but the system of numbers they came up with -is still in use today. For example the BBC uses Roman numerals to date -their programmes. - -The Romans wrote numbers using letters - I, V, X, L, C, D, M. (notice -these letters have lots of straight lines and are hence easy to hack -into stone tablets). - -```text - 1 => I -10 => X - 7 => VII -``` - -There is no need to be able to convert numbers larger than about 3000. -(The Romans themselves didn't tend to go any higher) - -Wikipedia says: Modern Roman numerals ... are written by expressing each -digit separately starting with the left most digit and skipping any -digit with a value of zero. - -To see this in practice, consider the example of 1990. - -In Roman numerals 1990 is MCMXC: - -1000=M -900=CM -90=XC - -2008 is written as MMVIII: - -2000=MM -8=VIII - -See also: http://www.novaroma.org/via_romana/numbers.html - -## Hints - -To complete this exercise you need to implement the function `numerals`, -that *maybe* converts a number to a *string* representing a roman numeral. - -Your function is expected to, at least, convert numbers up to 3000, -but is up to you to decide how far you want to go. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -The Roman Numeral Kata [http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals](http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals) - -## 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/practice/rotational-cipher/.meta/hints.md b/exercises/practice/rotational-cipher/.docs/instructions.append.md similarity index 100% rename from exercises/practice/rotational-cipher/.meta/hints.md rename to exercises/practice/rotational-cipher/.docs/instructions.append.md diff --git a/exercises/practice/rotational-cipher/.docs/instructions.md b/exercises/practice/rotational-cipher/.docs/instructions.md new file mode 100644 index 000000000..dbf6276f3 --- /dev/null +++ b/exercises/practice/rotational-cipher/.docs/instructions.md @@ -0,0 +1,31 @@ +# Instructions + +Create an implementation of the rotational cipher, also sometimes called the Caesar cipher. + +The Caesar cipher is a simple shift cipher that relies on +transposing all the letters in the alphabet using an integer key +between `0` and `26`. Using a key of `0` or `26` will always yield +the same output due to modular arithmetic. The letter is shifted +for as many values as the value of the key. + +The general notation for rotational ciphers is `ROT + `. +The most commonly used rotational cipher is `ROT13`. + +A `ROT13` on the Latin alphabet would be as follows: + +```text +Plain: abcdefghijklmnopqrstuvwxyz +Cipher: nopqrstuvwxyzabcdefghijklm +``` + +It is stronger than the Atbash cipher because it has 27 possible keys, and 25 usable keys. + +Ciphertext is written out in the same formatting as the input including spaces and punctuation. + +## Examples + +- ROT5 `omg` gives `trl` +- ROT0 `c` gives `c` +- ROT26 `Cool` gives `Cool` +- ROT13 `The quick brown fox jumps over the lazy dog.` gives `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` +- ROT13 `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` gives `The quick brown fox jumps over the lazy dog.` diff --git a/exercises/practice/rotational-cipher/.meta/config.json b/exercises/practice/rotational-cipher/.meta/config.json new file mode 100644 index 000000000..757dc45ed --- /dev/null +++ b/exercises/practice/rotational-cipher/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Caesar_cipher" +} diff --git a/exercises/practice/rotational-cipher/README.md b/exercises/practice/rotational-cipher/README.md deleted file mode 100644 index c641c0624..000000000 --- a/exercises/practice/rotational-cipher/README.md +++ /dev/null @@ -1,127 +0,0 @@ -# Rotational Cipher - -Create an implementation of the rotational cipher, also sometimes called the Caesar cipher. - -The Caesar cipher is a simple shift cipher that relies on -transposing all the letters in the alphabet using an integer key -between `0` and `26`. Using a key of `0` or `26` will always yield -the same output due to modular arithmetic. The letter is shifted -for as many values as the value of the key. - -The general notation for rotational ciphers is `ROT + `. -The most commonly used rotational cipher is `ROT13`. - -A `ROT13` on the Latin alphabet would be as follows: - -```text -Plain: abcdefghijklmnopqrstuvwxyz -Cipher: nopqrstuvwxyzabcdefghijklm -``` - -It is stronger than the Atbash cipher because it has 27 possible keys, and 25 usable keys. - -Ciphertext is written out in the same formatting as the input including spaces and punctuation. - -## Examples - -- ROT5 `omg` gives `trl` -- ROT0 `c` gives `c` -- ROT26 `Cool` gives `Cool` -- ROT13 `The quick brown fox jumps over the lazy dog.` gives `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` -- ROT13 `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` gives `The quick brown fox jumps over the lazy dog.` - -## Hints - -You need to implement the `rotate` function, which takes an `Int` and a `String`, and then encodes it using an rotational cipher. -You can use the provided signature if you are unsure about the types, but don't let it restrict your creativity. - -This exercise works with textual data. For historical reasons, Haskell's -`String` type is synonymous with `[Char]`, a list of characters. For more -efficient handling of textual data, the `Text` type can be used. - -As an optional extension to this exercise, you can - -- read about [string types](https://haskell-lang.org/tutorial/string-types) in - Haskell. -- add `- text` to your list of dependencies in package.yaml. -- import `Data.Text` in [the following - way](https://hackernoon.com/4-steps-to-a-better-imports-list-in-haskell-43a3d868273c): - -```haskell -import qualified Data.Text as T -import Data.Text (Text) -``` - -- use the `Text` type e.g. `rotate :: Int -> Text -> Text` and refer to - `Data.Text` combinators as e.g. `T.pack`. -- look up the documentation for - [`Data.Text`](https://hackage.haskell.org/package/text/docs/Data-Text.html). -- replace all occurrences of `String` with `Text` in RotationalCipher.hs, i.e.: - -```haskell -rotate :: Int -> Text -> Text -``` - -This part is entirely optional. - - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [https://en.wikipedia.org/wiki/Caesar_cipher](https://en.wikipedia.org/wiki/Caesar_cipher) - -## 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/practice/run-length-encoding/.docs/instructions.md b/exercises/practice/run-length-encoding/.docs/instructions.md new file mode 100644 index 000000000..95f7a9d69 --- /dev/null +++ b/exercises/practice/run-length-encoding/.docs/instructions.md @@ -0,0 +1,24 @@ +# Instructions + +Implement run-length encoding and decoding. + +Run-length encoding (RLE) is a simple form of data compression, where runs +(consecutive data elements) are replaced by just one data value and count. + +For example we can represent the original 53 characters with only 13. + +```text +"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" -> "12WB12W3B24WB" +``` + +RLE allows the original data to be perfectly reconstructed from +the compressed data, which makes it a lossless data compression. + +```text +"AABCCCDEEEE" -> "2AB3CD4E" -> "AABCCCDEEEE" +``` + +For simplicity, you can assume that the unencoded string will only contain +the letters A through Z (either lower or upper case) and whitespace. This way +data to be encoded will never contain any numbers and numbers inside data to +be decoded always represent the count for the following character. diff --git a/exercises/practice/run-length-encoding/.meta/config.json b/exercises/practice/run-length-encoding/.meta/config.json new file mode 100644 index 000000000..045f64fb1 --- /dev/null +++ b/exercises/practice/run-length-encoding/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Run-length_encoding" +} diff --git a/exercises/practice/run-length-encoding/README.md b/exercises/practice/run-length-encoding/README.md deleted file mode 100644 index b36ab6a19..000000000 --- a/exercises/practice/run-length-encoding/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# Run Length Encoding - -Implement run-length encoding and decoding. - -Run-length encoding (RLE) is a simple form of data compression, where runs -(consecutive data elements) are replaced by just one data value and count. - -For example we can represent the original 53 characters with only 13. - -```text -"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" -> "12WB12W3B24WB" -``` - -RLE allows the original data to be perfectly reconstructed from -the compressed data, which makes it a lossless data compression. - -```text -"AABCCCDEEEE" -> "2AB3CD4E" -> "AABCCCDEEEE" -``` - -For simplicity, you can assume that the unencoded string will only contain -the letters A through Z (either lower or upper case) and whitespace. This way -data to be encoded will never contain any numbers and numbers inside data to -be decoded always represent the count for the following character. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [https://en.wikipedia.org/wiki/Run-length_encoding](https://en.wikipedia.org/wiki/Run-length_encoding) - -## 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/practice/saddle-points/.docs/instructions.md b/exercises/practice/saddle-points/.docs/instructions.md new file mode 100644 index 000000000..aa11e0571 --- /dev/null +++ b/exercises/practice/saddle-points/.docs/instructions.md @@ -0,0 +1,29 @@ +# Instructions + +Detect saddle points in a matrix. + +So say you have a matrix like so: + +```text + 1 2 3 + |--------- +1 | 9 8 7 +2 | 5 3 2 <--- saddle point at column 1, row 2, with value 5 +3 | 6 6 7 +``` + +It has a saddle point at column 1, row 2. + +It's called a "saddle point" because it is greater than or equal to +every element in its row and less than or equal to every element in +its column. + +A matrix may have zero or more saddle points. + +Your code should be able to provide the (possibly empty) list of all the +saddle points for any given matrix. + +The matrix can have a different number of rows and columns (Non square). + +Note that you may find other definitions of matrix saddle points online, +but the tests for this exercise follow the above unambiguous definition. diff --git a/exercises/practice/saddle-points/.meta/config.json b/exercises/practice/saddle-points/.meta/config.json new file mode 100644 index 000000000..4f6d17a38 --- /dev/null +++ b/exercises/practice/saddle-points/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "J Dalbey's Programming Practice problems", + "source_url": "http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html" +} diff --git a/exercises/practice/saddle-points/README.md b/exercises/practice/saddle-points/README.md deleted file mode 100644 index 75902e6c5..000000000 --- a/exercises/practice/saddle-points/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# Saddle Points - -Detect saddle points in a matrix. - -So say you have a matrix like so: - -```text - 1 2 3 - |--------- -1 | 9 8 7 -2 | 5 3 2 <--- saddle point at column 1, row 2, with value 5 -3 | 6 6 7 -``` - -It has a saddle point at column 1, row 2. - -It's called a "saddle point" because it is greater than or equal to -every element in its row and less than or equal to every element in -its column. - -A matrix may have zero or more saddle points. - -Your code should be able to provide the (possibly empty) list of all the -saddle points for any given matrix. - -The matrix can have a different number of rows and columns (Non square). - -Note that you may find other definitions of matrix saddle points online, -but the tests for this exercise follow the above unambiguous definition. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -J Dalbey's Programming Practice problems [http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html](http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html) - -## 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/practice/say/README.md b/exercises/practice/say/.docs/instructions.md similarity index 51% rename from exercises/practice/say/README.md rename to exercises/practice/say/.docs/instructions.md index 33b985d27..727b0186d 100644 --- a/exercises/practice/say/README.md +++ b/exercises/practice/say/.docs/instructions.md @@ -1,4 +1,4 @@ -# Say +# Instructions Given a number from 0 to 999,999,999,999, spell out that number in English. @@ -61,63 +61,3 @@ Use _and_ (correctly) when spelling out the number in English: - 120 becomes "one hundred and twenty". - 1002 becomes "one thousand and two". - 1323 becomes "one thousand three hundred and twenty-three". - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -A variation on JavaRanch CattleDrive, exercise 4a [http://www.javaranch.com/say.jsp](http://www.javaranch.com/say.jsp) - -## 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/practice/say/.meta/config.json b/exercises/practice/say/.meta/config.json new file mode 100644 index 000000000..cf05febfe --- /dev/null +++ b/exercises/practice/say/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "A variation on JavaRanch CattleDrive, exercise 4a", + "source_url": "http://www.javaranch.com/say.jsp" +} diff --git a/exercises/practice/scrabble-score/.docs/instructions.md b/exercises/practice/scrabble-score/.docs/instructions.md new file mode 100644 index 000000000..3f986c947 --- /dev/null +++ b/exercises/practice/scrabble-score/.docs/instructions.md @@ -0,0 +1,40 @@ +# Instructions + +Given a word, compute the Scrabble score for that word. + +## Letter Values + +You'll need these: + +```text +Letter Value +A, E, I, O, U, L, N, R, S, T 1 +D, G 2 +B, C, M, P 3 +F, H, V, W, Y 4 +K 5 +J, X 8 +Q, Z 10 +``` + +## Examples + +"cabbage" should be scored as worth 14 points: + +- 3 points for C +- 1 point for A, twice +- 3 points for B, twice +- 2 points for G +- 1 point for E + +And to total: + +- `3 + 2*1 + 2*3 + 2 + 1` +- = `3 + 2 + 6 + 3` +- = `5 + 9` +- = 14 + +## Extensions + +- You can play a double or a triple letter. +- You can play a double or a triple word. diff --git a/exercises/practice/scrabble-score/.meta/config.json b/exercises/practice/scrabble-score/.meta/config.json new file mode 100644 index 000000000..8591c6609 --- /dev/null +++ b/exercises/practice/scrabble-score/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Inspired by the Extreme Startup game", + "source_url": "https://github.com/rchatley/extreme_startup" +} diff --git a/exercises/practice/scrabble-score/README.md b/exercises/practice/scrabble-score/README.md deleted file mode 100644 index 09953b665..000000000 --- a/exercises/practice/scrabble-score/README.md +++ /dev/null @@ -1,100 +0,0 @@ -# Scrabble Score - -Given a word, compute the Scrabble score for that word. - -## Letter Values - -You'll need these: - -```text -Letter Value -A, E, I, O, U, L, N, R, S, T 1 -D, G 2 -B, C, M, P 3 -F, H, V, W, Y 4 -K 5 -J, X 8 -Q, Z 10 -``` - -## Examples - -"cabbage" should be scored as worth 14 points: - -- 3 points for C -- 1 point for A, twice -- 3 points for B, twice -- 2 points for G -- 1 point for E - -And to total: - -- `3 + 2*1 + 2*3 + 2 + 1` -- = `3 + 2 + 6 + 3` -- = `5 + 9` -- = 14 - -## Extensions - -- You can play a double or a triple letter. -- You can play a double or a triple word. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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. diff --git a/exercises/practice/secret-handshake/.docs/instructions.md b/exercises/practice/secret-handshake/.docs/instructions.md new file mode 100644 index 000000000..92cef2016 --- /dev/null +++ b/exercises/practice/secret-handshake/.docs/instructions.md @@ -0,0 +1,29 @@ +# Instructions + +> There are 10 types of people in the world: Those who understand +> binary, and those who don't. + +You and your fellow cohort of those in the "know" when it comes to +binary decide to come up with a secret "handshake". + +```text +1 = wink +10 = double blink +100 = close your eyes +1000 = jump + + +10000 = Reverse the order of the operations in the secret handshake. +``` + +Given a decimal number, convert it to the appropriate sequence of events for a secret handshake. + +Here's a couple of examples: + +Given the input 3, the function would return the array +["wink", "double blink"] because 3 is 11 in binary. + +Given the input 19, the function would return the array +["double blink", "wink"] because 19 is 10011 in binary. +Notice that the addition of 16 (10000 in binary) +has caused the array to be reversed. diff --git a/exercises/practice/secret-handshake/.meta/config.json b/exercises/practice/secret-handshake/.meta/config.json new file mode 100644 index 000000000..ce8e08787 --- /dev/null +++ b/exercises/practice/secret-handshake/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Bert, in Mary Poppins", + "source_url": "http://www.imdb.com/title/tt0058331/quotes/qt0437047" +} diff --git a/exercises/practice/secret-handshake/README.md b/exercises/practice/secret-handshake/README.md deleted file mode 100644 index d7ded6fff..000000000 --- a/exercises/practice/secret-handshake/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# Secret Handshake - -> There are 10 types of people in the world: Those who understand -> binary, and those who don't. - -You and your fellow cohort of those in the "know" when it comes to -binary decide to come up with a secret "handshake". - -```text -1 = wink -10 = double blink -100 = close your eyes -1000 = jump - - -10000 = Reverse the order of the operations in the secret handshake. -``` - -Given a decimal number, convert it to the appropriate sequence of events for a secret handshake. - -Here's a couple of examples: - -Given the input 3, the function would return the array -["wink", "double blink"] because 3 is 11 in binary. - -Given the input 19, the function would return the array -["double blink", "wink"] because 19 is 10011 in binary. -Notice that the addition of 16 (10000 in binary) -has caused the array to be reversed. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Bert, in Mary Poppins [http://www.imdb.com/title/tt0058331/quotes/qt0437047](http://www.imdb.com/title/tt0058331/quotes/qt0437047) - -## 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/practice/series/.meta/hints.md b/exercises/practice/series/.docs/instructions.append.md similarity index 100% rename from exercises/practice/series/.meta/hints.md rename to exercises/practice/series/.docs/instructions.append.md diff --git a/exercises/practice/series/.docs/instructions.md b/exercises/practice/series/.docs/instructions.md new file mode 100644 index 000000000..3f9d371fa --- /dev/null +++ b/exercises/practice/series/.docs/instructions.md @@ -0,0 +1,21 @@ +# Instructions + +Given a string of digits, output all the contiguous substrings of length `n` in +that string in the order that they appear. + +For example, the string "49142" has the following 3-digit series: + +- "491" +- "914" +- "142" + +And the following 4-digit series: + +- "4914" +- "9142" + +And if you ask for a 6-digit series from a 5-digit string, you deserve +whatever you get. + +Note that these series are only required to occupy *adjacent positions* +in the input; the digits need not be *numerically consecutive*. diff --git a/exercises/practice/series/.meta/config.json b/exercises/practice/series/.meta/config.json new file mode 100644 index 000000000..eed44aa68 --- /dev/null +++ b/exercises/practice/series/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "A subset of the Problem 8 at Project Euler", + "source_url": "http://projecteuler.net/problem=8" +} diff --git a/exercises/practice/series/README.md b/exercises/practice/series/README.md deleted file mode 100644 index e5bbb89d1..000000000 --- a/exercises/practice/series/README.md +++ /dev/null @@ -1,106 +0,0 @@ -# Series - -Given a string of digits, output all the contiguous substrings of length `n` in -that string in the order that they appear. - -For example, the string "49142" has the following 3-digit series: - -- "491" -- "914" -- "142" - -And the following 4-digit series: - -- "4914" -- "9142" - -And if you ask for a 6-digit series from a 5-digit string, you deserve -whatever you get. - -Note that these series are only required to occupy *adjacent positions* -in the input; the digits need not be *numerically consecutive*. - -## Hints - -To complete this exercise you need to implement the function `slices`, -that takes a *text* and returns the subsequences of digits with a -specified size: - -If it is your first time solving this exercise, it is recommended that you -stick to the provided signature: - -```haskell -slices :: Int -> String -> [[Int]] -``` - -Later, it may be a good idea to revisit this problem and play with other data -types and libraries: - -- `ByteString`, from package *bytestring*. -- `Sequence`, from package *containers*. -- `Text`, from package *text*. -- `Vector`, from package *vector*. - -The test suite was intentionally designed to accept almost any type signature -that makes sense, so you are encouraged to find the one you think is the best. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -A subset of the Problem 8 at Project Euler [http://projecteuler.net/problem=8](http://projecteuler.net/problem=8) - -## 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/practice/sgf-parsing/.meta/hints.md b/exercises/practice/sgf-parsing/.docs/instructions.append.md similarity index 100% rename from exercises/practice/sgf-parsing/.meta/hints.md rename to exercises/practice/sgf-parsing/.docs/instructions.append.md diff --git a/exercises/practice/sgf-parsing/README.md b/exercises/practice/sgf-parsing/.docs/instructions.md similarity index 57% rename from exercises/practice/sgf-parsing/README.md rename to exercises/practice/sgf-parsing/.docs/instructions.md index 68a782822..3969d76c9 100644 --- a/exercises/practice/sgf-parsing/README.md +++ b/exercises/practice/sgf-parsing/.docs/instructions.md @@ -1,4 +1,4 @@ -# SGF Parsing +# Instructions Parsing a Smart Game Format string. @@ -64,83 +64,3 @@ The exercise will have you parse an SGF string and return a tree structure of properties. You do not need to encode knowledge about the data types of properties, just use the rules for the [text](http://www.red-bean.com/sgf/sgf4.html#text) type everywhere. - -## Hints - -The Sgf module should export a parseSgf module with the following signature: - -```haskell -parseSgf :: Text -> Maybe (Tree (Map Text [Text])) -``` - -You may find it useful to copy the following definitions for SgfTree -and SgfNode: - -```haskell --- | A tree of nodes. -type SgfTree = Tree SgfNode - --- | A node is a property list, each key can only occur once. --- Keys may have multiple values associated with them. -type SgfNode = Map Text [Text] -``` - -The parsec library is part of the Haskell Platform. Please use it to -your advantage. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/sgf-parsing/.meta/config.json b/exercises/practice/sgf-parsing/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/sgf-parsing/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/sieve/.docs/instructions.md b/exercises/practice/sieve/.docs/instructions.md new file mode 100644 index 000000000..7228737a2 --- /dev/null +++ b/exercises/practice/sieve/.docs/instructions.md @@ -0,0 +1,30 @@ +# Instructions + +Use the Sieve of Eratosthenes to find all the primes from 2 up to a given +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. + +Create your range, starting at two and continuing up to and including the given limit. (i.e. [2, limit]) + +The algorithm consists of repeating the following over and over: + +- take the next available unmarked number in your list (it is prime) +- mark all the multiples of that number (they are not prime) + +Repeat until you have processed each number in your range. + +When the algorithm terminates, all the numbers in the list that have not +been marked are prime. + +The wikipedia article has a useful graphic that explains the algorithm: +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). diff --git a/exercises/practice/sieve/.meta/config.json b/exercises/practice/sieve/.meta/config.json new file mode 100644 index 000000000..8890656fd --- /dev/null +++ b/exercises/practice/sieve/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Sieve of Eratosthenes at Wikipedia", + "source_url": "http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" +} diff --git a/exercises/practice/sieve/README.md b/exercises/practice/sieve/README.md deleted file mode 100644 index 9158e5aa2..000000000 --- a/exercises/practice/sieve/README.md +++ /dev/null @@ -1,90 +0,0 @@ -# Sieve - -Use the Sieve of Eratosthenes to find all the primes from 2 up to a given -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. - -Create your range, starting at two and continuing up to and including the given limit. (i.e. [2, limit]) - -The algorithm consists of repeating the following over and over: - -- take the next available unmarked number in your list (it is prime) -- mark all the multiples of that number (they are not prime) - -Repeat until you have processed each number in your range. - -When the algorithm terminates, all the numbers in the list that have not -been marked are prime. - -The wikipedia article has a useful graphic that explains the algorithm: -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). - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Sieve of Eratosthenes at Wikipedia [http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes) - -## 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/practice/simple-cipher/README.md b/exercises/practice/simple-cipher/.docs/instructions.md similarity index 69% rename from exercises/practice/simple-cipher/README.md rename to exercises/practice/simple-cipher/.docs/instructions.md index 0ca8407bb..22a7e4d4b 100644 --- a/exercises/practice/simple-cipher/README.md +++ b/exercises/practice/simple-cipher/.docs/instructions.md @@ -1,4 +1,4 @@ -# Simple Cipher +# Instructions Implement a simple shift cipher like Caesar and a more secure substitution cipher. @@ -77,63 +77,3 @@ on Wikipedia][dh] for one of the first implementations of this scheme. [1]: https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Caesar_cipher_left_shift_of_3.svg/320px-Caesar_cipher_left_shift_of_3.svg.png [dh]: http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Substitution Cipher at Wikipedia [http://en.wikipedia.org/wiki/Substitution_cipher](http://en.wikipedia.org/wiki/Substitution_cipher) - -## 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/practice/simple-cipher/.meta/config.json b/exercises/practice/simple-cipher/.meta/config.json new file mode 100644 index 000000000..720f028e3 --- /dev/null +++ b/exercises/practice/simple-cipher/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Substitution Cipher at Wikipedia", + "source_url": "http://en.wikipedia.org/wiki/Substitution_cipher" +} diff --git a/exercises/practice/simple-linked-list/.meta/hints.md b/exercises/practice/simple-linked-list/.docs/instructions.append.md similarity index 100% rename from exercises/practice/simple-linked-list/.meta/hints.md rename to exercises/practice/simple-linked-list/.docs/instructions.append.md diff --git a/exercises/practice/simple-linked-list/.docs/instructions.md b/exercises/practice/simple-linked-list/.docs/instructions.md new file mode 100644 index 000000000..1c9d0b3de --- /dev/null +++ b/exercises/practice/simple-linked-list/.docs/instructions.md @@ -0,0 +1,22 @@ +# Instructions + +Write a simple linked list implementation that uses Elements and a List. + +The linked list is a fundamental data structure in computer science, +often used in the implementation of other data structures. They're +pervasive in functional programming languages, such as Clojure, Erlang, +or Haskell, but far less common in imperative languages such as Ruby or +Python. + +The simplest kind of linked list is a singly linked list. Each element in the +list contains data and a "next" field pointing to the next element in the list +of elements. + +This variant of linked lists is often used to represent sequences or +push-down stacks (also called a LIFO stack; Last In, First Out). + +As a first take, lets create a singly linked list to contain the range (1..10), +and provide functions to reverse a linked list and convert to and from arrays. + +When implementing this in a language with built-in linked lists, +implement your own abstract data type. diff --git a/exercises/practice/simple-linked-list/.meta/config.json b/exercises/practice/simple-linked-list/.meta/config.json new file mode 100644 index 000000000..fe67d1572 --- /dev/null +++ b/exercises/practice/simple-linked-list/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Inspired by 'Data Structures and Algorithms with Object-Oriented Design Patterns in Ruby', singly linked-lists.", + "source_url": "https://web.archive.org/web/20160731005714/http://brpreiss.com/books/opus8/html/page96.html" +} diff --git a/exercises/practice/simple-linked-list/README.md b/exercises/practice/simple-linked-list/README.md deleted file mode 100644 index 4330c07a8..000000000 --- a/exercises/practice/simple-linked-list/README.md +++ /dev/null @@ -1,101 +0,0 @@ -# Simple Linked List - -Write a simple linked list implementation that uses Elements and a List. - -The linked list is a fundamental data structure in computer science, -often used in the implementation of other data structures. They're -pervasive in functional programming languages, such as Clojure, Erlang, -or Haskell, but far less common in imperative languages such as Ruby or -Python. - -The simplest kind of linked list is a singly linked list. Each element in the -list contains data and a "next" field pointing to the next element in the list -of elements. - -This variant of linked lists is often used to represent sequences or -push-down stacks (also called a LIFO stack; Last In, First Out). - -As a first take, lets create a singly linked list to contain the range (1..10), -and provide functions to reverse a linked list and convert to and from arrays. - -When implementing this in a language with built-in linked lists, -implement your own abstract data type. - -## Hints - -To complete this exercise, you need to create the data type `LinkedList`, -and implement the following functions: - -- `datum` -- `fromList` -- `isNil` -- `new` -- `next` -- `nil` -- `reverseLinkedList` -- `toList` - -You will find a dummy data declaration and type signatures already in place, -but it is up to you to define the functions and create a meaningful data type, -newtype or type synonym. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Inspired by 'Data Structures and Algorithms with Object-Oriented Design Patterns in Ruby', singly linked-lists. [https://web.archive.org/web/20160731005714/http://brpreiss.com/books/opus8/html/page96.html](https://web.archive.org/web/20160731005714/http://brpreiss.com/books/opus8/html/page96.html) - -## 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/practice/space-age/.meta/hints.md b/exercises/practice/space-age/.docs/instructions.append.md similarity index 100% rename from exercises/practice/space-age/.meta/hints.md rename to exercises/practice/space-age/.docs/instructions.append.md diff --git a/exercises/practice/space-age/.docs/instructions.md b/exercises/practice/space-age/.docs/instructions.md new file mode 100644 index 000000000..19cca8bf9 --- /dev/null +++ b/exercises/practice/space-age/.docs/instructions.md @@ -0,0 +1,18 @@ +# Instructions + +Given an age in seconds, calculate how old someone would be on: + + - Mercury: orbital period 0.2408467 Earth years + - Venus: orbital period 0.61519726 Earth years + - Earth: orbital period 1.0 Earth years, 365.25 Earth days, or 31557600 seconds + - Mars: orbital period 1.8808158 Earth years + - Jupiter: orbital period 11.862615 Earth years + - Saturn: orbital period 29.447498 Earth years + - Uranus: orbital period 84.016846 Earth years + - Neptune: orbital period 164.79132 Earth years + +So if you were told someone were 1,000,000,000 seconds old, you should +be able to say that they're 31.69 Earth-years old. + +If you're wondering why Pluto didn't make the cut, go watch [this +youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs). diff --git a/exercises/practice/space-age/.meta/config.json b/exercises/practice/space-age/.meta/config.json new file mode 100644 index 000000000..a9f0a99e0 --- /dev/null +++ b/exercises/practice/space-age/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Partially inspired by Chapter 1 in Chris Pine's online Learn to Program tutorial.", + "source_url": "http://pine.fm/LearnToProgram/?Chapter=01" +} diff --git a/exercises/practice/space-age/README.md b/exercises/practice/space-age/README.md deleted file mode 100644 index babcd2413..000000000 --- a/exercises/practice/space-age/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# Space Age - -Given an age in seconds, calculate how old someone would be on: - - - Mercury: orbital period 0.2408467 Earth years - - Venus: orbital period 0.61519726 Earth years - - Earth: orbital period 1.0 Earth years, 365.25 Earth days, or 31557600 seconds - - Mars: orbital period 1.8808158 Earth years - - Jupiter: orbital period 11.862615 Earth years - - Saturn: orbital period 29.447498 Earth years - - Uranus: orbital period 84.016846 Earth years - - Neptune: orbital period 164.79132 Earth years - -So if you were told someone were 1,000,000,000 seconds old, you should -be able to say that they're 31.69 Earth-years old. - -If you're wondering why Pluto didn't make the cut, go watch [this -youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs). - -## Hints - -In this exercise, we provided the definition of the -[algebric data type](http://learnyouahaskell.com/making-our-own-types-and-typeclasses) -named `Planet`. -You need to implement the `ageOn` function, that calculates how many -years old someone would be on a `Planet`, given an age in seconds. - -Your can use the provided signature if you are unsure about the types, but -don't let it restrict your creativity: - -```haskell -ageOn :: Planet -> Float -> Float -``` - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Partially inspired by Chapter 1 in Chris Pine's online Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=01](http://pine.fm/LearnToProgram/?Chapter=01) - -## 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/practice/spiral-matrix/.docs/instructions.md b/exercises/practice/spiral-matrix/.docs/instructions.md new file mode 100644 index 000000000..af412dd83 --- /dev/null +++ b/exercises/practice/spiral-matrix/.docs/instructions.md @@ -0,0 +1,25 @@ +# Instructions + +Given the size, return a square matrix of numbers in spiral order. + +The matrix should be filled with natural numbers, starting from 1 +in the top-left corner, increasing in an inward, clockwise spiral order, +like these examples: + +## Examples +### Spiral matrix of size 3 + +```text +1 2 3 +8 9 4 +7 6 5 +``` + +### Spiral matrix of size 4 + +```text + 1 2 3 4 +12 13 14 5 +11 16 15 6 +10 9 8 7 +``` diff --git a/exercises/practice/spiral-matrix/.meta/config.json b/exercises/practice/spiral-matrix/.meta/config.json new file mode 100644 index 000000000..4d0218438 --- /dev/null +++ b/exercises/practice/spiral-matrix/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Reddit r/dailyprogrammer challenge #320 [Easy] Spiral Ascension.", + "source_url": "https://www.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/" +} diff --git a/exercises/practice/spiral-matrix/README.md b/exercises/practice/spiral-matrix/README.md deleted file mode 100644 index d141592b6..000000000 --- a/exercises/practice/spiral-matrix/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# Spiral Matrix - -Given the size, return a square matrix of numbers in spiral order. - -The matrix should be filled with natural numbers, starting from 1 -in the top-left corner, increasing in an inward, clockwise spiral order, -like these examples: - -###### Spiral matrix of size 3 - -```text -1 2 3 -8 9 4 -7 6 5 -``` - -###### Spiral matrix of size 4 - -```text - 1 2 3 4 -12 13 14 5 -11 16 15 6 -10 9 8 7 -``` - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Reddit r/dailyprogrammer challenge #320 [Easy] Spiral Ascension. [https://www.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/](https://www.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/) - -## 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/practice/strain/.docs/instructions.md b/exercises/practice/strain/.docs/instructions.md new file mode 100644 index 000000000..370eb2216 --- /dev/null +++ b/exercises/practice/strain/.docs/instructions.md @@ -0,0 +1,34 @@ +# Instructions + +Implement the `keep` and `discard` operation on collections. Given a collection +and a predicate on the collection's elements, `keep` returns a new collection +containing those elements where the predicate is true, while `discard` returns +a new collection containing those elements where the predicate is false. + +For example, given the collection of numbers: + +- 1, 2, 3, 4, 5 + +And the predicate: + +- is the number even? + +Then your keep operation should produce: + +- 2, 4 + +While your discard operation should produce: + +- 1, 3, 5 + +Note that the union of keep and discard is all the elements. + +The functions may be called `keep` and `discard`, or they may need different +names in order to not clash with existing functions or concepts in your +language. + +## Restrictions + +Keep your hands off that filter/reject/whatchamacallit functionality +provided by your standard library! Solve this one yourself using other +basic tools instead. diff --git a/exercises/practice/strain/.meta/config.json b/exercises/practice/strain/.meta/config.json new file mode 100644 index 000000000..70e106389 --- /dev/null +++ b/exercises/practice/strain/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Conversation with James Edward Gray II", + "source_url": "https://twitter.com/jeg2" +} diff --git a/exercises/practice/strain/README.md b/exercises/practice/strain/README.md deleted file mode 100644 index 7b99614f2..000000000 --- a/exercises/practice/strain/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# Strain - -Implement the `keep` and `discard` operation on collections. Given a collection -and a predicate on the collection's elements, `keep` returns a new collection -containing those elements where the predicate is true, while `discard` returns -a new collection containing those elements where the predicate is false. - -For example, given the collection of numbers: - -- 1, 2, 3, 4, 5 - -And the predicate: - -- is the number even? - -Then your keep operation should produce: - -- 2, 4 - -While your discard operation should produce: - -- 1, 3, 5 - -Note that the union of keep and discard is all the elements. - -The functions may be called `keep` and `discard`, or they may need different -names in order to not clash with existing functions or concepts in your -language. - -## Restrictions - -Keep your hands off that filter/reject/whatchamacallit functionality -provided by your standard library! Solve this one yourself using other -basic tools instead. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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. diff --git a/exercises/practice/sublist/.meta/hints.md b/exercises/practice/sublist/.docs/instructions.append.md similarity index 100% rename from exercises/practice/sublist/.meta/hints.md rename to exercises/practice/sublist/.docs/instructions.append.md diff --git a/exercises/practice/sublist/.docs/instructions.md b/exercises/practice/sublist/.docs/instructions.md new file mode 100644 index 000000000..45c3b9648 --- /dev/null +++ b/exercises/practice/sublist/.docs/instructions.md @@ -0,0 +1,18 @@ +# Instructions + +Given two lists determine if the first list is contained within the second +list, if the second list is contained within the first list, if both lists are +contained within each other or if none of these are true. + +Specifically, a list A is a sublist of list B if by dropping 0 or more elements +from the front of B and 0 or more elements from the back of B you get a list +that's completely equal to A. + +Examples: + + * A = [1, 2, 3], B = [1, 2, 3, 4, 5], A is a sublist of B + * A = [3, 4, 5], B = [1, 2, 3, 4, 5], A is a sublist of B + * A = [3, 4], B = [1, 2, 3, 4, 5], A is a sublist of B + * A = [1, 2, 3], B = [1, 2, 3], A is equal to B + * A = [1, 2, 3, 4, 5], B = [2, 3, 4], A is a superlist of B + * A = [1, 2, 4], B = [1, 2, 3, 4, 5], A is not a superlist of, sublist of or equal to B diff --git a/exercises/practice/sublist/.meta/config.json b/exercises/practice/sublist/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/sublist/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +} diff --git a/exercises/practice/sublist/README.md b/exercises/practice/sublist/README.md deleted file mode 100644 index 47db8867f..000000000 --- a/exercises/practice/sublist/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# Sublist - -Given two lists determine if the first list is contained within the second -list, if the second list is contained within the first list, if both lists are -contained within each other or if none of these are true. - -Specifically, a list A is a sublist of list B if by dropping 0 or more elements -from the front of B and 0 or more elements from the back of B you get a list -that's completely equal to A. - -Examples: - - * A = [1, 2, 3], B = [1, 2, 3, 4, 5], A is a sublist of B - * A = [3, 4, 5], B = [1, 2, 3, 4, 5], A is a sublist of B - * A = [3, 4], B = [1, 2, 3, 4, 5], A is a sublist of B - * A = [1, 2, 3], B = [1, 2, 3], A is equal to B - * A = [1, 2, 3, 4, 5], B = [2, 3, 4], A is a superlist of B - * A = [1, 2, 4], B = [1, 2, 3, 4, 5], A is not a superlist of, sublist of or equal to B - -## Hints - -The type -[`Ordering`](http://hackage.haskell.org/package/base/docs/Data-Ord.html#t:Ordering) -has three constructors, `LT` ("less than"), `EQ` ("equals") and `GT` ("greater -than"). These can represent sublist ordering with `Just LT` meaning "sublist", -and so on, and `Nothing` meaning not a sublist, superlist or equal to. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/sum-of-multiples/.docs/instructions.md b/exercises/practice/sum-of-multiples/.docs/instructions.md new file mode 100644 index 000000000..bb512396a --- /dev/null +++ b/exercises/practice/sum-of-multiples/.docs/instructions.md @@ -0,0 +1,9 @@ +# Instructions + +Given a number, find the sum of all the unique multiples of particular numbers up to +but not including that number. + +If we list all the natural numbers below 20 that are multiples of 3 or 5, +we get 3, 5, 6, 9, 10, 12, 15, and 18. + +The sum of these multiples is 78. diff --git a/exercises/practice/sum-of-multiples/.meta/config.json b/exercises/practice/sum-of-multiples/.meta/config.json new file mode 100644 index 000000000..d864e2c5f --- /dev/null +++ b/exercises/practice/sum-of-multiples/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "A variation on Problem 1 at Project Euler", + "source_url": "http://projecteuler.net/problem=1" +} diff --git a/exercises/practice/sum-of-multiples/README.md b/exercises/practice/sum-of-multiples/README.md deleted file mode 100644 index dad2055fc..000000000 --- a/exercises/practice/sum-of-multiples/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# Sum Of Multiples - -Given a number, find the sum of all the unique multiples of particular numbers up to -but not including that number. - -If we list all the natural numbers below 20 that are multiples of 3 or 5, -we get 3, 5, 6, 9, 10, 12, 15, and 18. - -The sum of these multiples is 78. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -A variation on Problem 1 at Project Euler [http://projecteuler.net/problem=1](http://projecteuler.net/problem=1) - -## 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/practice/transpose/.docs/instructions.md b/exercises/practice/transpose/.docs/instructions.md new file mode 100644 index 000000000..c0e1d14a5 --- /dev/null +++ b/exercises/practice/transpose/.docs/instructions.md @@ -0,0 +1,59 @@ +# Instructions + +Given an input text output it transposed. + +Roughly explained, the transpose of a matrix: + +```text +ABC +DEF +``` + +is given by: + +```text +AD +BE +CF +``` + +Rows become columns and columns become rows. See . + +If the input has rows of different lengths, this is to be solved as follows: + +- Pad to the left with spaces. +- Don't pad to the right. + +Therefore, transposing this matrix: + +```text +ABC +DE +``` + +results in: + +```text +AD +BE +C +``` + +And transposing: + +```text +AB +DEF +``` + +results in: + +```text +AD +BE + F +``` + +In general, all characters from the input should also be present in the transposed output. +That means that if a column in the input text contains only spaces on its bottom-most row(s), +the corresponding output row should contain the spaces in its right-most column(s). diff --git a/exercises/practice/transpose/.meta/config.json b/exercises/practice/transpose/.meta/config.json new file mode 100644 index 000000000..43b12df2b --- /dev/null +++ b/exercises/practice/transpose/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Reddit r/dailyprogrammer challenge #270 [Easy].", + "source_url": "https://www.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text" +} diff --git a/exercises/practice/transpose/README.md b/exercises/practice/transpose/README.md deleted file mode 100644 index b78bedf1e..000000000 --- a/exercises/practice/transpose/README.md +++ /dev/null @@ -1,119 +0,0 @@ -# Transpose - -Given an input text output it transposed. - -Roughly explained, the transpose of a matrix: - -```text -ABC -DEF -``` - -is given by: - -```text -AD -BE -CF -``` - -Rows become columns and columns become rows. See . - -If the input has rows of different lengths, this is to be solved as follows: - -- Pad to the left with spaces. -- Don't pad to the right. - -Therefore, transposing this matrix: - -```text -ABC -DE -``` - -results in: - -```text -AD -BE -C -``` - -And transposing: - -```text -AB -DEF -``` - -results in: - -```text -AD -BE - F -``` - -In general, all characters from the input should also be present in the transposed output. -That means that if a column in the input text contains only spaces on its bottom-most row(s), -the corresponding output row should contain the spaces in its right-most column(s). - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Reddit r/dailyprogrammer challenge #270 [Easy]. [https://www.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text](https://www.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text) - -## 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/practice/triangle/.docs/instructions.md b/exercises/practice/triangle/.docs/instructions.md new file mode 100644 index 000000000..0a9c68e3b --- /dev/null +++ b/exercises/practice/triangle/.docs/instructions.md @@ -0,0 +1,23 @@ +# Instructions + +Determine if a triangle is equilateral, isosceles, or scalene. + +An _equilateral_ triangle has all three sides the same length. + +An _isosceles_ triangle has at least two sides the same length. (It is sometimes +specified as having exactly two sides the same length, but for the purposes of +this exercise we'll say at least two.) + +A _scalene_ triangle has all sides of different lengths. + +## Note + +For a shape to be a triangle at all, all sides have to be of length > 0, and +the sum of the lengths of any two sides must be greater than or equal to the +length of the third side. See [Triangle Inequality](https://en.wikipedia.org/wiki/Triangle_inequality). + +## Dig Deeper + +The case where the sum of the lengths of two sides _equals_ that of the +third is known as a _degenerate_ triangle - it has zero area and looks like +a single line. Feel free to add your own code/tests to check for degenerate triangles. diff --git a/exercises/practice/triangle/.meta/config.json b/exercises/practice/triangle/.meta/config.json new file mode 100644 index 000000000..5983daec1 --- /dev/null +++ b/exercises/practice/triangle/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "The Ruby Koans triangle project, parts 1 & 2", + "source_url": "http://rubykoans.com" +} diff --git a/exercises/practice/triangle/README.md b/exercises/practice/triangle/README.md deleted file mode 100644 index 0a68ef82a..000000000 --- a/exercises/practice/triangle/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# Triangle - -Determine if a triangle is equilateral, isosceles, or scalene. - -An _equilateral_ triangle has all three sides the same length. - -An _isosceles_ triangle has at least two sides the same length. (It is sometimes -specified as having exactly two sides the same length, but for the purposes of -this exercise we'll say at least two.) - -A _scalene_ triangle has all sides of different lengths. - -## Note - -For a shape to be a triangle at all, all sides have to be of length > 0, and -the sum of the lengths of any two sides must be greater than or equal to the -length of the third side. See [Triangle Inequality](https://en.wikipedia.org/wiki/Triangle_inequality). - -## Dig Deeper - -The case where the sum of the lengths of two sides _equals_ that of the -third is known as a _degenerate_ triangle - it has zero area and looks like -a single line. Feel free to add your own code/tests to check for degenerate triangles. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -The Ruby Koans triangle project, parts 1 & 2 [http://rubykoans.com](http://rubykoans.com) - -## 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/practice/trinary/.meta/hints.md b/exercises/practice/trinary/.docs/instructions.append.md similarity index 100% rename from exercises/practice/trinary/.meta/hints.md rename to exercises/practice/trinary/.docs/instructions.append.md diff --git a/exercises/practice/trinary/.docs/instructions.md b/exercises/practice/trinary/.docs/instructions.md new file mode 100644 index 000000000..3638ddb74 --- /dev/null +++ b/exercises/practice/trinary/.docs/instructions.md @@ -0,0 +1,22 @@ +# Instructions + +Convert a trinary number, represented as a string (e.g. '102012'), to its +decimal equivalent using first principles. + +The program should consider strings specifying an invalid trinary as the +value 0. + +Trinary numbers contain three symbols: 0, 1, and 2. + +The last place in a trinary number is the 1's place. The second to last +is the 3's place, the third to last is the 9's place, etc. + +```shell +# "102012" + 1 0 2 0 1 2 # the number +1*3^5 + 0*3^4 + 2*3^3 + 0*3^2 + 1*3^1 + 2*3^0 # the value + 243 + 0 + 54 + 0 + 3 + 2 = 302 +``` + +If your language provides a method in the standard library to perform the +conversion, pretend it doesn't exist and implement it yourself. diff --git a/exercises/practice/trinary/.meta/config.json b/exercises/practice/trinary/.meta/config.json new file mode 100644 index 000000000..669f8779a --- /dev/null +++ b/exercises/practice/trinary/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "All of Computer Science", + "source_url": "http://www.wolframalpha.com/input/?i=binary&a=*C.binary-_*MathWorld-" +} diff --git a/exercises/practice/trinary/README.md b/exercises/practice/trinary/README.md deleted file mode 100644 index 13a3882c9..000000000 --- a/exercises/practice/trinary/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# Trinary - -Convert a trinary number, represented as a string (e.g. '102012'), to its -decimal equivalent using first principles. - -The program should consider strings specifying an invalid trinary as the -value 0. - -Trinary numbers contain three symbols: 0, 1, and 2. - -The last place in a trinary number is the 1's place. The second to last -is the 3's place, the third to last is the 9's place, etc. - -```shell -# "102012" - 1 0 2 0 1 2 # the number -1*3^5 + 0*3^4 + 2*3^3 + 0*3^2 + 1*3^1 + 2*3^0 # the value - 243 + 0 + 54 + 0 + 3 + 2 = 302 -``` - -If your language provides a method in the standard library to perform the -conversion, pretend it doesn't exist and implement it yourself. - -## Hints - -For the appropriate amount of challenge here, you should only -use functionality present in Prelude. Try not to use Data.List, -Data.Char, Data.Bits, or Numeric. - -Try and use seq, $!, or BangPatterns appropriately to ensure -that the solution is efficient. - -Handling invalid input is not necessary. - -If you've done the Octal exercise, perhaps you should generalize it. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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. diff --git a/exercises/practice/twelve-days/.meta/hints.md b/exercises/practice/twelve-days/.docs/instructions.append.md similarity index 100% rename from exercises/practice/twelve-days/.meta/hints.md rename to exercises/practice/twelve-days/.docs/instructions.append.md diff --git a/exercises/practice/twelve-days/.docs/instructions.md b/exercises/practice/twelve-days/.docs/instructions.md new file mode 100644 index 000000000..c54cd95fc --- /dev/null +++ b/exercises/practice/twelve-days/.docs/instructions.md @@ -0,0 +1,29 @@ +# Instructions + +Output the lyrics to 'The Twelve Days of Christmas'. + +```text +On the first day of Christmas my true love gave to me: a Partridge in a Pear Tree. + +On the second day of Christmas my true love gave to me: two Turtle Doves, and a Partridge in a Pear Tree. + +On the third day of Christmas my true love gave to me: three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. + +On the fourth day of Christmas my true love gave to me: four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. + +On the fifth day of Christmas my true love gave to me: five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. + +On the sixth day of Christmas my true love gave to me: six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. + +On the seventh day of Christmas my true love gave to me: seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. + +On the eighth day of Christmas my true love gave to me: eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. + +On the ninth day of Christmas my true love gave to me: nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. + +On the tenth day of Christmas my true love gave to me: ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. + +On the eleventh day of Christmas my true love gave to me: eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. + +On the twelfth day of Christmas my true love gave to me: twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. +``` diff --git a/exercises/practice/twelve-days/.meta/config.json b/exercises/practice/twelve-days/.meta/config.json new file mode 100644 index 000000000..34de90e37 --- /dev/null +++ b/exercises/practice/twelve-days/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "http://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song)" +} diff --git a/exercises/practice/twelve-days/README.md b/exercises/practice/twelve-days/README.md deleted file mode 100644 index 0e98066c2..000000000 --- a/exercises/practice/twelve-days/README.md +++ /dev/null @@ -1,125 +0,0 @@ -# Twelve Days - -Output the lyrics to 'The Twelve Days of Christmas'. - -```text -On the first day of Christmas my true love gave to me: a Partridge in a Pear Tree. - -On the second day of Christmas my true love gave to me: two Turtle Doves, and a Partridge in a Pear Tree. - -On the third day of Christmas my true love gave to me: three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. - -On the fourth day of Christmas my true love gave to me: four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. - -On the fifth day of Christmas my true love gave to me: five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. - -On the sixth day of Christmas my true love gave to me: six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. - -On the seventh day of Christmas my true love gave to me: seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. - -On the eighth day of Christmas my true love gave to me: eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. - -On the ninth day of Christmas my true love gave to me: nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. - -On the tenth day of Christmas my true love gave to me: ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. - -On the eleventh day of Christmas my true love gave to me: eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. - -On the twelfth day of Christmas my true love gave to me: twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. -``` - -## Hints - -You need to implement the `recite` function which outputs the lyrics to -'The Twelve Days of Christmas'. You can use the provided signature -if you are unsure about the types, but don't let it restrict your creativity. - -This exercise works with textual data. For historical reasons, Haskell's -`String` type is synonymous with `[Char]`, a list of characters. For more -efficient handling of textual data, the `Text` type can be used. - -As an optional extension to this exercise, you can - -- read about [string types](https://haskell-lang.org/tutorial/string-types) in - Haskell. -- add `- text` to your list of dependencies in package.yaml. -- import `Data.Text` in [the following - way](https://hackernoon.com/4-steps-to-a-better-imports-list-in-haskell-43a3d868273c): - -```haskell -import qualified Data.Text as T -import Data.Text (Text) -``` - -- write e.g. `recite :: Int -> Int -> [Text]` and refer to - `Data.Text` combinators as e.g. `T.pack`. -- look up the documentation for - [`Data.Text`](https://hackage.haskell.org/package/text/docs/Data-Text.html). -- replace all occurrences of `String` with `Text` in TwelveDays.hs, i.e.: - -```haskell -recite :: Int -> Int -> [Text] -``` - -This part is entirely optional. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [http://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song)](http://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song)) - -## 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/practice/word-count/.meta/hints.md b/exercises/practice/word-count/.docs/instructions.append.md similarity index 100% rename from exercises/practice/word-count/.meta/hints.md rename to exercises/practice/word-count/.docs/instructions.append.md diff --git a/exercises/practice/word-count/.docs/instructions.md b/exercises/practice/word-count/.docs/instructions.md new file mode 100644 index 000000000..d3548e5d8 --- /dev/null +++ b/exercises/practice/word-count/.docs/instructions.md @@ -0,0 +1,31 @@ +# Instructions + +Given a phrase, count the occurrences of each _word_ in that phrase. + +For the purposes of this exercise you can expect that a _word_ will always be one of: + +1. A _number_ composed of one or more ASCII digits (ie "0" or "1234") OR +2. A _simple word_ composed of one or more ASCII letters (ie "a" or "they") OR +3. A _contraction_ of two _simple words_ joined by a single apostrophe (ie "it's" or "they're") + +When counting words you can assume the following rules: + +1. The count is _case insensitive_ (ie "You", "you", and "YOU" are 3 uses of the same word) +2. The count is _unordered_; the tests will ignore how words and counts are ordered +3. Other than the apostrophe in a _contraction_ all forms of _punctuation_ are ignored +4. The words can be separated by _any_ form of whitespace (ie "\t", "\n", " ") + +For example, for the phrase `"That's the password: 'PASSWORD 123'!", cried the Special Agent.\nSo I fled.` the count would be: + +```text +that's: 1 +the: 2 +password: 2 +123: 1 +cried: 1 +special: 1 +agent: 1 +so: 1 +i: 1 +fled: 1 +``` diff --git a/exercises/practice/word-count/.meta/config.json b/exercises/practice/word-count/.meta/config.json new file mode 100644 index 000000000..3f1c1350b --- /dev/null +++ b/exercises/practice/word-count/.meta/config.json @@ -0,0 +1,9 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "This is a classic toy problem, but we were reminded of it by seeing it in the Go Tour." +} diff --git a/exercises/practice/word-count/README.md b/exercises/practice/word-count/README.md deleted file mode 100644 index 999c24602..000000000 --- a/exercises/practice/word-count/README.md +++ /dev/null @@ -1,114 +0,0 @@ -# Word Count - -Given a phrase, count the occurrences of each _word_ in that phrase. - -For the purposes of this exercise you can expect that a _word_ will always be one of: - -1. A _number_ composed of one or more ASCII digits (ie "0" or "1234") OR -2. A _simple word_ composed of one or more ASCII letters (ie "a" or "they") OR -3. A _contraction_ of two _simple words_ joined by a single apostrophe (ie "it's" or "they're") - -When counting words you can assume the following rules: - -1. The count is _case insensitive_ (ie "You", "you", and "YOU" are 3 uses of the same word) -2. The count is _unordered_; the tests will ignore how words and counts are ordered -3. Other than the apostrophe in a _contraction_ all forms of _punctuation_ are ignored -4. The words can be separated by _any_ form of whitespace (ie "\t", "\n", " ") - -For example, for the phrase `"That's the password: 'PASSWORD 123'!", cried the Special Agent.\nSo I fled.` the count would be: - -```text -that's: 1 -the: 2 -password: 2 -123: 1 -cried: 1 -special: 1 -agent: 1 -so: 1 -i: 1 -fled: 1 -``` - -## Hints - -To complete this exercise you need to implement the function `wordCount`, -that takes a *text* and returns how many times each *word* appears. - -If it is your first time solving this exercise, it is recommended that you -stick to the provided signature: - -```haskell -wordCount :: String -> [(String, Int)] -``` - -Later, it may be a good idea to revisit this problem and play with other data -types and libraries: - -- `Text`, from package *text*. -- `Map`, from package *containers*. -- `MultiSet`, from package *multiset* - -The test suite was intentionally designed to accept almost any type signature -that makes sense, so you are encouraged to find the one you think is the best. - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -This is a classic toy problem, but we were reminded of it by seeing it in the Go Tour. - -## 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/practice/wordy/.meta/hints.md b/exercises/practice/wordy/.docs/instructions.append.md similarity index 100% rename from exercises/practice/wordy/.meta/hints.md rename to exercises/practice/wordy/.docs/instructions.append.md diff --git a/exercises/practice/wordy/.docs/instructions.md b/exercises/practice/wordy/.docs/instructions.md new file mode 100644 index 000000000..f65b05acf --- /dev/null +++ b/exercises/practice/wordy/.docs/instructions.md @@ -0,0 +1,68 @@ +# Instructions + +Parse and evaluate simple math word problems returning the answer as an integer. + +## Iteration 0 — Numbers + +Problems with no operations simply evaluate to the number given. + +> What is 5? + +Evaluates to 5. + +## Iteration 1 — Addition + +Add two numbers together. + +> What is 5 plus 13? + +Evaluates to 18. + +Handle large numbers and negative numbers. + +## Iteration 2 — Subtraction, Multiplication and Division + +Now, perform the other three operations. + +> What is 7 minus 5? + +2 + +> What is 6 multiplied by 4? + +24 + +> What is 25 divided by 5? + +5 + +## Iteration 3 — Multiple Operations + +Handle a set of operations, in sequence. + +Since these are verbal word problems, evaluate the expression from +left-to-right, _ignoring the typical order of operations._ + +> What is 5 plus 13 plus 6? + +24 + +> What is 3 plus 2 multiplied by 3? + +15 (i.e. not 9) + +## Iteration 4 — Errors + +The parser should reject: + +* Unsupported operations ("What is 52 cubed?") +* Non-math questions ("Who is the President of the United States") +* Word problems with invalid syntax ("What is 1 plus plus 2?") + +## Bonus — Exponentials + +If you'd like, handle exponentials. + +> What is 2 raised to the 5th power? + +32 diff --git a/exercises/practice/wordy/.meta/config.json b/exercises/practice/wordy/.meta/config.json new file mode 100644 index 000000000..2f035626d --- /dev/null +++ b/exercises/practice/wordy/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Inspired by one of the generated questions in the Extreme Startup game.", + "source_url": "https://github.com/rchatley/extreme_startup" +} diff --git a/exercises/practice/wordy/README.md b/exercises/practice/wordy/README.md deleted file mode 100644 index 4f2d92752..000000000 --- a/exercises/practice/wordy/README.md +++ /dev/null @@ -1,133 +0,0 @@ -# Wordy - -Parse and evaluate simple math word problems returning the answer as an integer. - -## Iteration 0 — Numbers - -Problems with no operations simply evaluate to the number given. - -> What is 5? - -Evaluates to 5. - -## Iteration 1 — Addition - -Add two numbers together. - -> What is 5 plus 13? - -Evaluates to 18. - -Handle large numbers and negative numbers. - -## Iteration 2 — Subtraction, Multiplication and Division - -Now, perform the other three operations. - -> What is 7 minus 5? - -2 - -> What is 6 multiplied by 4? - -24 - -> What is 25 divided by 5? - -5 - -## Iteration 3 — Multiple Operations - -Handle a set of operations, in sequence. - -Since these are verbal word problems, evaluate the expression from -left-to-right, _ignoring the typical order of operations._ - -> What is 5 plus 13 plus 6? - -24 - -> What is 3 plus 2 multiplied by 3? - -15 (i.e. not 9) - -## Iteration 4 — Errors - -The parser should reject: - -* Unsupported operations ("What is 52 cubed?") -* Non-math questions ("Who is the President of the United States") -* Word problems with invalid syntax ("What is 1 plus plus 2?") - -## Bonus — Exponentials - -If you'd like, handle exponentials. - -> What is 2 raised to the 5th power? - -32 - -## Hints - -This is a perfect opportunity to learn some Attoparsec or Parsec! - - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Inspired by one of the generated questions in 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. diff --git a/exercises/practice/yacht/README.md b/exercises/practice/yacht/.docs/instructions.md similarity index 58% rename from exercises/practice/yacht/README.md rename to exercises/practice/yacht/.docs/instructions.md index 2648293fc..dadd286f6 100644 --- a/exercises/practice/yacht/README.md +++ b/exercises/practice/yacht/.docs/instructions.md @@ -1,4 +1,4 @@ -# Yacht +# Instructions # Score a single throw of dice in *Yacht* @@ -35,63 +35,3 @@ the score of the dice for that category. If the dice do not satisfy the requirem of the category your solution should return 0. You can assume that five values will always be presented, and the value of each will be between one and six inclusively. You should not assume that the dice are ordered. - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -James Kilfiger, using wikipedia [https://en.wikipedia.org/wiki/Yacht_(dice_game)](https://en.wikipedia.org/wiki/Yacht_(dice_game)) - -## 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/practice/yacht/.meta/config.json b/exercises/practice/yacht/.meta/config.json new file mode 100644 index 000000000..168f46edb --- /dev/null +++ b/exercises/practice/yacht/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "James Kilfiger, using wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Yacht_(dice_game)" +} diff --git a/exercises/practice/zebra-puzzle/.docs/instructions.md b/exercises/practice/zebra-puzzle/.docs/instructions.md new file mode 100644 index 000000000..18a8da1d8 --- /dev/null +++ b/exercises/practice/zebra-puzzle/.docs/instructions.md @@ -0,0 +1,26 @@ +# Instructions + +Solve the zebra puzzle. + +1. There are five houses. +2. The Englishman lives in the red house. +3. The Spaniard owns the dog. +4. Coffee is drunk in the green house. +5. The Ukrainian drinks tea. +6. The green house is immediately to the right of the ivory house. +7. The Old Gold smoker owns snails. +8. Kools are smoked in the yellow house. +9. Milk is drunk in the middle house. +10. The Norwegian lives in the first house. +11. The man who smokes Chesterfields lives in the house next to the man with the fox. +12. Kools are smoked in the house next to the house where the horse is kept. +13. The Lucky Strike smoker drinks orange juice. +14. The Japanese smokes Parliaments. +15. The Norwegian lives next to the blue house. + +Each of the five houses is painted a different color, and their +inhabitants are of different national extractions, own different pets, +drink different beverages and smoke different brands of cigarettes. + +Which of the residents drinks water? +Who owns the zebra? diff --git a/exercises/practice/zebra-puzzle/.meta/config.json b/exercises/practice/zebra-puzzle/.meta/config.json new file mode 100644 index 000000000..015649040 --- /dev/null +++ b/exercises/practice/zebra-puzzle/.meta/config.json @@ -0,0 +1,10 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + }, + "source": "Wikipedia", + "source_url": "https://en.wikipedia.org/wiki/Zebra_Puzzle" +} diff --git a/exercises/practice/zebra-puzzle/README.md b/exercises/practice/zebra-puzzle/README.md deleted file mode 100644 index 3e92f5b89..000000000 --- a/exercises/practice/zebra-puzzle/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# Zebra Puzzle - -Solve the zebra puzzle. - -1. There are five houses. -2. The Englishman lives in the red house. -3. The Spaniard owns the dog. -4. Coffee is drunk in the green house. -5. The Ukrainian drinks tea. -6. The green house is immediately to the right of the ivory house. -7. The Old Gold smoker owns snails. -8. Kools are smoked in the yellow house. -9. Milk is drunk in the middle house. -10. The Norwegian lives in the first house. -11. The man who smokes Chesterfields lives in the house next to the man with the fox. -12. Kools are smoked in the house next to the house where the horse is kept. -13. The Lucky Strike smoker drinks orange juice. -14. The Japanese smokes Parliaments. -15. The Norwegian lives next to the blue house. - -Each of the five houses is painted a different color, and their -inhabitants are of different national extractions, own different pets, -drink different beverages and smoke different brands of cigarettes. - -Which of the residents drinks water? -Who owns the zebra? - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## Source - -Wikipedia [https://en.wikipedia.org/wiki/Zebra_Puzzle](https://en.wikipedia.org/wiki/Zebra_Puzzle) - -## 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/practice/zipper/README.md b/exercises/practice/zipper/.docs/instructions.md similarity index 51% rename from exercises/practice/zipper/README.md rename to exercises/practice/zipper/.docs/instructions.md index 79fe8368e..d760aa0dd 100644 --- a/exercises/practice/zipper/README.md +++ b/exercises/practice/zipper/.docs/instructions.md @@ -1,4 +1,4 @@ -# Zipper +# Instructions Creating a zipper for a binary tree. @@ -26,59 +26,3 @@ list of child nodes) a zipper might support these operations: - `delete` (removes the focus node and all subtrees, focus moves to the `next` node if possible otherwise to the `prev` node if possible, otherwise to the parent node, returns a new zipper) - - -## Getting Started - -Please refer to the [installation](https://exercism.io/tracks/haskell/installation) -and [learning](https://exercism.io/tracks/haskell/learning) help pages. - -## Running the tests - -To run the test suite, execute the following command: - -```bash -stack test -``` - -#### If you get an error message like this... - -``` -No .cabal file found in directory -``` - -You are probably running an old stack version and need -to upgrade it. - -#### Otherwise, if you get an error message like this... - -``` -No compiler found, expected minor version match with... -Try running "stack setup" to install the correct GHC... -``` - -Just do as it says and it will download and install -the correct compiler version: - -```bash -stack setup -``` - -## Running *GHCi* - -If you want to play with your solution in GHCi, just run the command: - -```bash -stack ghci -``` - -## Feedback, Issues, Pull Requests - -The [exercism/haskell](https://github.com/exercism/haskell) repository on -GitHub is the home for all of the Haskell exercises. - -If you have feedback about an exercise, or want to help implementing a new -one, head over there and create an issue. We'll do our best to help you! - -## 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/practice/zipper/.meta/config.json b/exercises/practice/zipper/.meta/config.json new file mode 100644 index 000000000..ac46491c9 --- /dev/null +++ b/exercises/practice/zipper/.meta/config.json @@ -0,0 +1,8 @@ +{ + "authors": [], + "files": { + "solution": [], + "test": [], + "example": [] + } +}