summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--clojure/hello-world/HELP.md57
-rw-r--r--clojure/hello-world/README.md65
-rw-r--r--clojure/hello-world/project.clj4
-rw-r--r--clojure/hello-world/src/hello_world.clj4
-rw-r--r--clojure/hello-world/test/hello_world_test.clj6
-rw-r--r--clojure/two-fer/HELP.md57
-rw-r--r--clojure/two-fer/README.md47
-rw-r--r--clojure/two-fer/project.clj4
-rw-r--r--clojure/two-fer/src/two_fer.clj5
-rw-r--r--clojure/two-fer/test/two_fer_test.clj12
10 files changed, 261 insertions, 0 deletions
diff --git a/clojure/hello-world/HELP.md b/clojure/hello-world/HELP.md
new file mode 100644
index 0000000..ff81e83
--- /dev/null
+++ b/clojure/hello-world/HELP.md
@@ -0,0 +1,57 @@
+# Help
+
+## Running the tests
+
+Leiningen can be used to run the exercise's test by running the following command from the exercise's directory:
+
+```bash
+lein test
+```
+
+## REPL
+
+To use the REPL to run the exercise's test, run the following command from the exercise's directory:
+
+```bash
+$ lein repl
+```
+
+Then `require` the exercise's test namespace and the Clojure test namespace):
+
+```clojure
+;; replace <exercise> with the exercise's name
+=> (require '<exercise>-test)
+```
+
+Then call `run-tests` on `<exercise>-test`:
+
+```clojure
+;; replace <exercise> with the exercise's name
+=> (clojure.test/run-tests '<exercise>-test)
+```
+
+## Submitting your solution
+
+You can submit your solution using the `exercism submit src/hello_world.clj` 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 [Clojure track's documentation](https://exercism.org/docs/tracks/clojure)
+- [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:
+
+- [ClojureDocs](https://clojuredocs.org) A repository of language references and examples by function or keyword.
+- [/r/clojure](https://www.reddit.com/r/clojure) is the C# subreddit.
+- [StackOverflow](http://stackoverflow.com/questions/tagged/clojure) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions.
\ No newline at end of file
diff --git a/clojure/hello-world/README.md b/clojure/hello-world/README.md
new file mode 100644
index 0000000..2426951
--- /dev/null
+++ b/clojure/hello-world/README.md
@@ -0,0 +1,65 @@
+# Hello World
+
+Welcome to Hello World on Exercism's Clojure Track.
+If you need help running the tests or submitting your code, check out `HELP.md`.
+
+## Instructions
+
+The classical introductory exercise. Just say "Hello, World!".
+
+["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is
+the traditional first program for beginning programming in a new language
+or environment.
+
+The objectives are simple:
+
+- Write a function that returns the string "Hello, World!".
+- Run the test suite and make sure that it succeeds.
+- Submit your solution and check it at the website.
+
+If everything goes well, you will be ready to fetch your first real exercise.
+
+## Project Structure
+
+Clojure exercises in exercism use [leiningen](http://leiningen.org/) to configure and run your code
+and use [leiningen standard directory structure](https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#directory-layout).
+
+You will find a test file named `hello_world_test.clj` inside `test` directory.
+Write your code in `src/hello_world.clj`. It should use the namespace `hello-world` so that tests can pick it up.
+
+## Running tests
+
+Run the tests using `lein test` command and make them pass:
+
+```
+$ lein test
+
+lein test hello-world-test
+
+Ran 3 tests containing 3 assertions.
+0 failures, 0 errors.
+```
+
+Then submit the exercise using:
+
+```
+$ exercism submit src/hello_world.clj
+```
+
+For more detailed instructions and learning resources refer [exercism's clojure language page](http://exercism.io/languages/clojure).
+
+## Source
+
+### Contributed to by
+
+- @AndreaCrotti
+- @christianpoveda
+- @haus
+- @jcorrado
+- @sjwarner-bp
+- @tejasbubane
+- @yurrriq
+
+### Based on
+
+This is an exercise to introduce users to using Exercism - http://en.wikipedia.org/wiki/%22Hello,_world!%22_program
\ No newline at end of file
diff --git a/clojure/hello-world/project.clj b/clojure/hello-world/project.clj
new file mode 100644
index 0000000..b6b1aec
--- /dev/null
+++ b/clojure/hello-world/project.clj
@@ -0,0 +1,4 @@
+(defproject hello-world "0.1.0-SNAPSHOT"
+  :description "hello-world exercise."
+  :url "https://github.com/exercism/clojure/tree/master/exercises/hello-world"
+  :dependencies [[org.clojure/clojure "1.10.0"]])
diff --git a/clojure/hello-world/src/hello_world.clj b/clojure/hello-world/src/hello_world.clj
new file mode 100644
index 0000000..b81d18f
--- /dev/null
+++ b/clojure/hello-world/src/hello_world.clj
@@ -0,0 +1,4 @@
+(ns hello-world)
+
+(defn hello []
+  "Hello, World!")
diff --git a/clojure/hello-world/test/hello_world_test.clj b/clojure/hello-world/test/hello_world_test.clj
new file mode 100644
index 0000000..ce032d9
--- /dev/null
+++ b/clojure/hello-world/test/hello_world_test.clj
@@ -0,0 +1,6 @@
+(ns hello-world-test
+  (:require [clojure.test :refer [deftest is]]
+            hello-world))
+
+(deftest hello-world-test
+  (is (= "Hello, World!" (hello-world/hello))))
diff --git a/clojure/two-fer/HELP.md b/clojure/two-fer/HELP.md
new file mode 100644
index 0000000..02919a0
--- /dev/null
+++ b/clojure/two-fer/HELP.md
@@ -0,0 +1,57 @@
+# Help
+
+## Running the tests
+
+Leiningen can be used to run the exercise's test by running the following command from the exercise's directory:
+
+```bash
+lein test
+```
+
+## REPL
+
+To use the REPL to run the exercise's test, run the following command from the exercise's directory:
+
+```bash
+$ lein repl
+```
+
+Then `require` the exercise's test namespace and the Clojure test namespace):
+
+```clojure
+;; replace <exercise> with the exercise's name
+=> (require '<exercise>-test)
+```
+
+Then call `run-tests` on `<exercise>-test`:
+
+```clojure
+;; replace <exercise> with the exercise's name
+=> (clojure.test/run-tests '<exercise>-test)
+```
+
+## Submitting your solution
+
+You can submit your solution using the `exercism submit src/two_fer.clj` 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 [Clojure track's documentation](https://exercism.org/docs/tracks/clojure)
+- [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:
+
+- [ClojureDocs](https://clojuredocs.org) A repository of language references and examples by function or keyword.
+- [/r/clojure](https://www.reddit.com/r/clojure) is the C# subreddit.
+- [StackOverflow](http://stackoverflow.com/questions/tagged/clojure) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions.
\ 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..150ad00
--- /dev/null
+++ b/clojure/two-fer/README.md
@@ -0,0 +1,47 @@
+# Two Fer
+
+Welcome to Two Fer on Exercism's Clojure 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
+
+- @sjwarner-bp
+
+### Contributed to by
+
+- @AndreaCrotti
+- @haus
+- @sjwarner
+
+### Based on
+
+https://github.com/exercism/problem-specifications/issues/757
\ No newline at end of file
diff --git a/clojure/two-fer/project.clj b/clojure/two-fer/project.clj
new file mode 100644
index 0000000..6c67fbd
--- /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.10.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"))))