From 304c2c81295ce8e9e84018261ad3d08cb6dce671 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Sun, 21 Nov 2021 12:57:33 -0500 Subject: roman numerals skeleton --- .../roman-numerals/.exercism/config.json | 22 ++++++++ .../roman-numerals/.exercism/metadata.json | 1 + exercism/emacs-lisp/roman-numerals/HELP.md | 41 ++++++++++++++ exercism/emacs-lisp/roman-numerals/README.md | 60 ++++++++++++++++++++ .../roman-numerals/roman-numerals-test.el | 64 ++++++++++++++++++++++ .../emacs-lisp/roman-numerals/roman-numerals.el | 10 ++++ 6 files changed, 198 insertions(+) create mode 100644 exercism/emacs-lisp/roman-numerals/.exercism/config.json create mode 100644 exercism/emacs-lisp/roman-numerals/.exercism/metadata.json create mode 100644 exercism/emacs-lisp/roman-numerals/HELP.md create mode 100644 exercism/emacs-lisp/roman-numerals/README.md create mode 100644 exercism/emacs-lisp/roman-numerals/roman-numerals-test.el create mode 100644 exercism/emacs-lisp/roman-numerals/roman-numerals.el diff --git a/exercism/emacs-lisp/roman-numerals/.exercism/config.json b/exercism/emacs-lisp/roman-numerals/.exercism/config.json new file mode 100644 index 0000000..4b56a88 --- /dev/null +++ b/exercism/emacs-lisp/roman-numerals/.exercism/config.json @@ -0,0 +1,22 @@ +{ + "blurb": "Write a function to convert from normal numbers to Roman Numerals.", + "authors": [], + "contributors": [ + "bakhti", + "canweriotnow", + "vermiculus" + ], + "files": { + "solution": [ + "roman-numerals.el" + ], + "test": [ + "roman-numerals-test.el" + ], + "example": [ + ".meta/example.el" + ] + }, + "source": "The Roman Numeral Kata", + "source_url": "http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals" +} diff --git a/exercism/emacs-lisp/roman-numerals/.exercism/metadata.json b/exercism/emacs-lisp/roman-numerals/.exercism/metadata.json new file mode 100644 index 0000000..90b743a --- /dev/null +++ b/exercism/emacs-lisp/roman-numerals/.exercism/metadata.json @@ -0,0 +1 @@ +{"track":"emacs-lisp","exercise":"roman-numerals","id":"48151a69733b44aba8ec4b86ced01f31","url":"https://exercism.org/tracks/emacs-lisp/exercises/roman-numerals","handle":"orbekk","is_requester":true,"auto_approve":false} \ No newline at end of file diff --git a/exercism/emacs-lisp/roman-numerals/HELP.md b/exercism/emacs-lisp/roman-numerals/HELP.md new file mode 100644 index 0000000..4440358 --- /dev/null +++ b/exercism/emacs-lisp/roman-numerals/HELP.md @@ -0,0 +1,41 @@ +# Help + +## Running the tests + +Tests can be run several ways: + +1. Interactively and individually, with `M-x ert RET test-name RET` +2. Interactively and all at once, with `M-x ert RET t RET` +3. From the terminal, in batch mode, with `emacs -batch -l ert -l my-test.el -f ert-run-tests-batch-and-exit` +4. Other options can be found in the docs, `C-h i m ert RET` + +## Submitting your solution + +You can submit your solution using the `exercism submit roman-numerals.el` command. +This command will upload your solution to the Exercism website and print the solution page's URL. + +It's possible to submit an incomplete solution which allows you to: + +- See how others have completed the exercise +- Request help from a mentor + +## Need to get help? + +If you'd like help solving the exercise, check the following pages: + +- The [Emacs Lisp track's documentation](https://exercism.org/docs/tracks/emacs-lisp) +- [Exercism's support channel on gitter](https://gitter.im/exercism/support) +- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs) + +Should those resources not suffice, you could submit your (incomplete) solution to request mentoring. + +To get help if you're having trouble, you can use one of the following resources: + +- [The Emacs Wiki](http://emacswiki.org/) is invaluable. Spend lots of time here. +- [The Emacs Editor](http://www.gnu.org/software/emacs/manual/html_node/emacs/index.html) is the official manual for GNU Emacs. +- IRC - there are [freenode](https://freenode.net/) channels for `#emacs`, `#prelude`, and many Emacs + packages, and many helpful folks around. And with emacs, IRC is as close as + `M-x erc`. +- [Exercism Support](https://gitter.im/exercism/support) Gitter chat is also a good place to get help from the + exercism community. +- [StackOverflow](http://stackoverflow.com/questions/tagged/elisp) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions. \ No newline at end of file diff --git a/exercism/emacs-lisp/roman-numerals/README.md b/exercism/emacs-lisp/roman-numerals/README.md new file mode 100644 index 0000000..6a95273 --- /dev/null +++ b/exercism/emacs-lisp/roman-numerals/README.md @@ -0,0 +1,60 @@ +# Roman Numerals + +Welcome to Roman Numerals on Exercism's Emacs Lisp Track. +If you need help running the tests or submitting your code, check out `HELP.md`. + +## 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 + +## Source + +### Contributed to by + +- @bakhti +- @canweriotnow +- @vermiculus + +### Based on + +The Roman Numeral Kata - http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals \ No newline at end of file diff --git a/exercism/emacs-lisp/roman-numerals/roman-numerals-test.el b/exercism/emacs-lisp/roman-numerals/roman-numerals-test.el new file mode 100644 index 0000000..a250532 --- /dev/null +++ b/exercism/emacs-lisp/roman-numerals/roman-numerals-test.el @@ -0,0 +1,64 @@ +;;; roman-numerals-test.el --- Tests for roman-numerals (exercism) + +;;; Commentary: + +;;; Code: + +(load-file "roman-numerals.el") + +(ert-deftest to-roman-1 () + (should (equal (to-roman 1) "I"))) + +(ert-deftest to-roman-2 () + (should (equal (to-roman 2) "II"))) + +(ert-deftest to-roman-3 () + (should (equal (to-roman 3) "III"))) + +(ert-deftest to-roman-4 () + (should (equal (to-roman 4) "IV"))) + +(ert-deftest to-roman-5 () + (should (equal (to-roman 5) "V"))) + +(ert-deftest to-roman-6 () + (should (equal (to-roman 6) "VI"))) + +(ert-deftest to-roman-9 () + (should (equal (to-roman 9) "IX"))) + +(ert-deftest to-roman-27 () + (should (equal (to-roman 27) "XXVII"))) + +(ert-deftest to-roman-48 () + (should (equal (to-roman 48) "XLVIII"))) + +(ert-deftest to-roman-59 () + (should (equal (to-roman 59) "LIX"))) + +(ert-deftest to-roman-93 () + (should (equal (to-roman 93) "XCIII"))) + +(ert-deftest to-roman-141 () + (should (equal (to-roman 141) "CXLI"))) + +(ert-deftest to-roman-163 () + (should (equal (to-roman 163) "CLXIII"))) + +(ert-deftest to-roman-402 () + (should (equal (to-roman 402) "CDII"))) + +(ert-deftest to-roman-575 () + (should (equal (to-roman 575) "DLXXV"))) + +(ert-deftest to-roman-911 () + (should (equal (to-roman 911) "CMXI"))) + +(ert-deftest to-roman-1024 () + (should (equal (to-roman 1024) "MXXIV"))) + +(ert-deftest to-roman-3000 () + (should (equal (to-roman 3000) "MMM"))) + +(provide 'roman-numerals) +;;; roman-numerals-test.el ends here diff --git a/exercism/emacs-lisp/roman-numerals/roman-numerals.el b/exercism/emacs-lisp/roman-numerals/roman-numerals.el new file mode 100644 index 0000000..7ee7f15 --- /dev/null +++ b/exercism/emacs-lisp/roman-numerals/roman-numerals.el @@ -0,0 +1,10 @@ +;;; roman-numerals.el --- roman-numerals Exercise (exercism) + +;;; Commentary: + +;;; Code: + + + +(provide 'roman-numerals) +;;; roman-numerals.el ends here -- cgit v1.2.3