diff --git a/clojure/two-fer/.exercism/metadata.json b/clojure/two-fer/.exercism/metadata.json new file mode 100644 index 0000000..8761983 --- /dev/null +++ b/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} \ No newline at end of file diff --git a/clojure/two-fer/README.md b/clojure/two-fer/README.md new file mode 100644 index 0000000..00756db --- /dev/null +++ b/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. diff --git a/clojure/two-fer/project.clj b/clojure/two-fer/project.clj new file mode 100644 index 0000000..8d19a53 --- /dev/null +++ b/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"]]) diff --git a/clojure/two-fer/src/two_fer.clj b/clojure/two-fer/src/two_fer.clj new file mode 100644 index 0000000..ab89be3 --- /dev/null +++ b/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 +) diff --git a/clojure/two-fer/test/two_fer_test.clj b/clojure/two-fer/test/two_fer_test.clj new file mode 100644 index 0000000..a1ac329 --- /dev/null +++ b/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"))))