Julio Biason
4 years ago
5 changed files with 54 additions and 0 deletions
@ -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} |
@ -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. |
@ -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"]]) |
@ -0,0 +1,5 @@
|
||||
(ns two-fer) |
||||
|
||||
(defn two-fer [name] ;; <- arglist goes here |
||||
;; your code goes here |
||||
) |
@ -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…
Reference in new issue