Browse Source

Two fer

master
Julio Biason 3 years ago
parent
commit
ab215e0ede
  1. 24
      racket/two-fer/.exercism/config.json
  2. 1
      racket/two-fer/.exercism/metadata.json
  3. 39
      racket/two-fer/HELP.md
  4. 48
      racket/two-fer/README.md
  5. 23
      racket/two-fer/two-fer-test.rkt
  6. 6
      racket/two-fer/two-fer.rkt

24
racket/two-fer/.exercism/config.json

@ -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"
}

1
racket/two-fer/.exercism/metadata.json

@ -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}

39
racket/two-fer/HELP.md

@ -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.

48
racket/two-fer/README.md

@ -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

23
racket/two-fer/two-fer-test.rkt

@ -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))

6
racket/two-fer/two-fer.rkt

@ -0,0 +1,6 @@
#lang racket
(provide two-fer)
(define (two-fer (name "you"))
(string-append "One for " name ", one for me."))
Loading…
Cancel
Save