|
| 1 | +# Two Fer |
| 2 | + |
| 3 | +`Two-fer` or `2-fer` is short for two for one. One for you and one for me. |
| 4 | + |
| 5 | +Given a name, return a string with the message: |
| 6 | + |
| 7 | +```text |
| 8 | +One for X, one for me. |
| 9 | +``` |
| 10 | + |
| 11 | +Where X is the given name. |
| 12 | + |
| 13 | +However, if the name is missing, return the string: |
| 14 | + |
| 15 | +```text |
| 16 | +One for you, one for me. |
| 17 | +``` |
| 18 | + |
| 19 | +Here are some examples: |
| 20 | + |
| 21 | +|Name |String to return |
| 22 | +|:-------|:------------------ |
| 23 | +|Alice |One for Alice, one for me. |
| 24 | +|Bob |One for Bob, one for me. |
| 25 | +| |One for you, one for me. |
| 26 | +|Zaphod |One for Zaphod, one for me. |
| 27 | + |
| 28 | +## Setup |
| 29 | + |
| 30 | +Check out [Installing Common |
| 31 | +Lisp](https://exercism.io/tracks/common-lisp/installation) for |
| 32 | +instructions to get started or take a look at the guides available in |
| 33 | +the [track's side bar](https://exercism.io/my/tracks/common-lisp). |
| 34 | + |
| 35 | +## Formatting |
| 36 | + |
| 37 | +While Common Lisp doesn't care about indentation and layout of code, |
| 38 | +nor whether you use spaces or tabs, this is an important consideration |
| 39 | +for submissions to exercism.io. Excercism.io's code widget cannot |
| 40 | +handle mixing of tab and space characters well so using only spaces is recommended to make |
| 41 | +the code more readable to the human reviewers. Please review your |
| 42 | +editors settings on how to accomplish this. Below are instructions for |
| 43 | +popular editors for Common Lisp. |
| 44 | + |
| 45 | +### VIM |
| 46 | + |
| 47 | +Use the following commands to ensure VIM uses only spaces for |
| 48 | +indentation: |
| 49 | + |
| 50 | +```vimscript |
| 51 | +:set tabstop=2 |
| 52 | +:set shiftwidth=2 |
| 53 | +:set expandtab |
| 54 | +``` |
| 55 | + |
| 56 | +(or as a oneliner `:set tabstop=2 shiftwidth=2 expandtab`). This can |
| 57 | +be added to your `~/.vimrc` file to use it all the time. |
| 58 | + |
| 59 | +### Emacs |
| 60 | + |
| 61 | +Emacs is very well suited for editing Common Lisp and has many |
| 62 | +powerful add-on packages available. The only thing that one needs to |
| 63 | +do with a stock emacs to make it work well with exercism.io is to |
| 64 | +evaluate the following code: |
| 65 | + |
| 66 | +`(setq-default indent-tabs-mode nil)` |
| 67 | + |
| 68 | +This can be placed in your `~/.emacs` (or `~/.emacs.d/init.el`) in |
| 69 | +order to have it set whenever Emacs is launched. |
| 70 | + |
| 71 | +One suggested add-on for Emacs and Common Lisp is |
| 72 | +[SLIME](https://github.com/slime/slime) which offers tight integration |
| 73 | +with the REPL; making iterative coding and testing very easy. |
| 74 | + |
| 75 | +## Source |
| 76 | + |
| 77 | +[https://github.com/exercism/problem-specifications/issues/757](https://github.com/exercism/problem-specifications/issues/757) |
| 78 | + |
| 79 | +## Submitting Incomplete Solutions |
| 80 | +It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
0 commit comments