Julio Biason
3 years ago
6 changed files with 141 additions and 0 deletions
@ -0,0 +1,24 @@
|
||||
{ |
||||
"blurb": "Create a sentence of the form \"One for X, one for me.\"", |
||||
"authors": [ |
||||
"benreyn" |
||||
], |
||||
"contributors": [ |
||||
"cousinitt", |
||||
"robertpostill", |
||||
"sjwarner-bp", |
||||
"timotheosh" |
||||
], |
||||
"files": { |
||||
"solution": [ |
||||
"two-fer.rkt" |
||||
], |
||||
"test": [ |
||||
"two-fer-test.rkt" |
||||
], |
||||
"example": [ |
||||
".meta/example.rkt" |
||||
] |
||||
}, |
||||
"source_url": "https://github.com/exercism/problem-specifications/issues/757" |
||||
} |
@ -0,0 +1 @@
|
||||
{"track":"racket","exercise":"two-fer","id":"62bc87053dc145deaa236c398ab91793","url":"https://exercism.org/tracks/racket/exercises/two-fer","handle":"JBiason","is_requester":true,"auto_approve":false} |
@ -0,0 +1,39 @@
|
||||
# Help |
||||
|
||||
## Running the tests |
||||
|
||||
To run the test through DrRacket, simply open the test file and click the 'Run' button in the upper right. |
||||
|
||||
To run the test from the command line, run the test from the exercise directory with the following command: |
||||
|
||||
``` |
||||
raco test <exercise>-test.rkt |
||||
``` |
||||
|
||||
where `<exercise>` should be replaced with the exercise's slug. |
||||
|
||||
## Submitting your solution |
||||
|
||||
You can submit your solution using the `exercism submit two-fer.rkt` 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 [Racket track's documentation](https://exercism.org/docs/tracks/racket) |
||||
- [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 Racket Reference](http://docs.racket-lang.org/reference/index.html) |
||||
- [/r/racket](https://www.reddit.com/r/racket) is the Racket subreddit. |
||||
- [StackOverflow](http://stackoverflow.com/questions/tagged/racket) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions. |
@ -0,0 +1,48 @@
|
||||
# Two Fer |
||||
|
||||
Welcome to Two Fer on Exercism's Racket Track. |
||||
If you need help running the tests or submitting your code, check out `HELP.md`. |
||||
|
||||
## Instructions |
||||
|
||||
`Two-fer` or `2-fer` is short for two for one. One for you and one for me. |
||||
|
||||
Given a name, return a string with the message: |
||||
|
||||
```text |
||||
One for name, one for me. |
||||
``` |
||||
|
||||
Where "name" is the given name. |
||||
|
||||
However, if the name is missing, return the string: |
||||
|
||||
```text |
||||
One for you, one for me. |
||||
``` |
||||
|
||||
Here are some examples: |
||||
|
||||
|Name |String to return |
||||
|:-------|:------------------ |
||||
|Alice |One for Alice, one for me. |
||||
|Bob |One for Bob, one for me. |
||||
| |One for you, one for me. |
||||
|Zaphod |One for Zaphod, one for me. |
||||
|
||||
## Source |
||||
|
||||
### Created by |
||||
|
||||
- @benreyn |
||||
|
||||
### Contributed to by |
||||
|
||||
- @cousinitt |
||||
- @robertpostill |
||||
- @sjwarner-bp |
||||
- @timotheosh |
||||
|
||||
### Based on |
||||
|
||||
https://github.com/exercism/problem-specifications/issues/757 |
@ -0,0 +1,23 @@
|
||||
#lang racket |
||||
|
||||
; Tests adapted from `problem-specifications/canonical-data.json v1.2.0 |
||||
(require "two-fer.rkt") |
||||
|
||||
(module+ test |
||||
(require rackunit rackunit/text-ui) |
||||
|
||||
(define suite |
||||
(test-suite |
||||
"two fer tests" |
||||
|
||||
(test-equal? "no name given" |
||||
(two-fer) |
||||
"One for you, one for me.") |
||||
(test-equal? "a name given" |
||||
(two-fer "Alice") |
||||
"One for Alice, one for me.") |
||||
(test-equal? "another name given" |
||||
(two-fer "Bob") |
||||
"One for Bob, one for me."))) |
||||
|
||||
(run-tests suite)) |
Loading…
Reference in new issue