Browse Source

Problem: Two fer

master
Julio Biason 4 years ago
parent
commit
476322220b
  1. 1
      clojure/two-fer/.exercism/metadata.json
  2. 32
      clojure/two-fer/README.md
  3. 4
      clojure/two-fer/project.clj
  4. 5
      clojure/two-fer/src/two_fer.clj
  5. 12
      clojure/two-fer/test/two_fer_test.clj

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

@ -0,0 +1 @@
{"track":"clojure","exercise":"two-fer","id":"22ae6799da7142ea91b1330e4de7dd54","url":"https://exercism.io/my/solutions/22ae6799da7142ea91b1330e4de7dd54","handle":"JBiason","is_requester":true,"auto_approve":false}

32
clojure/two-fer/README.md

@ -0,0 +1,32 @@
# Two Fer
`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 X, one for me.
```
Where X 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
[https://github.com/exercism/problem-specifications/issues/757](https://github.com/exercism/problem-specifications/issues/757)
## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.

4
clojure/two-fer/project.clj

@ -0,0 +1,4 @@
(defproject two-fer "0.1.0-SNAPSHOT"
:description "two-fer exercise."
:url "https://github.com/exercism/clojure/tree/master/exercises/two-fer"
:dependencies [[org.clojure/clojure "1.8.0"]])

5
clojure/two-fer/src/two_fer.clj

@ -0,0 +1,5 @@
(ns two-fer)
(defn two-fer [name] ;; <- arglist goes here
;; your code goes here
)

12
clojure/two-fer/test/two_fer_test.clj

@ -0,0 +1,12 @@
(ns two-fer-test
(:require [clojure.test :refer [deftest is]]
two-fer))
(deftest two-fer-test
(is (= "One for you, one for me." (two-fer/two-fer))))
(deftest name-alice-test
(is (= "One for Alice, one for me." (two-fer/two-fer "Alice"))))
(deftest name-bob-test
(is (= "One for Bob, one for me." (two-fer/two-fer "Bob"))))
Loading…
Cancel
Save