aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Wardhaugh <twardhaugh@cap-rx.com>2021-08-24 11:53:22 -0700
committerTyler Wardhaugh <twardhaugh@cap-rx.com>2021-08-24 17:29:42 -0700
commit9ccfa73553690b0cbd210cc1926d844dea40e1a1 (patch)
tree930aa02c4b5a534f90a41b091264a4be69dc0f2b
parent82fefdf42654dc10a8427f4668a1c19ea611456d (diff)
downloadperlweeklychallenge-club-9ccfa73553690b0cbd210cc1926d844dea40e1a1.tar.gz
perlweeklychallenge-club-9ccfa73553690b0cbd210cc1926d844dea40e1a1.tar.bz2
perlweeklychallenge-club-9ccfa73553690b0cbd210cc1926d844dea40e1a1.zip
Ch127: prep for challenge
-rw-r--r--challenge-127/tyler-wardhaugh/clojure/README.md17
-rw-r--r--challenge-127/tyler-wardhaugh/clojure/bb.edn4
-rw-r--r--challenge-127/tyler-wardhaugh/clojure/deps.edn3
-rw-r--r--challenge-127/tyler-wardhaugh/clojure/src/tw/weekly/c127/core.clj12
-rw-r--r--challenge-127/tyler-wardhaugh/clojure/src/tw/weekly/c127/t1.clj15
-rw-r--r--challenge-127/tyler-wardhaugh/clojure/src/tw/weekly/c127/t2.clj14
-rw-r--r--challenge-127/tyler-wardhaugh/clojure/test/tw/weekly/c127_test.clj12
7 files changed, 64 insertions, 13 deletions
diff --git a/challenge-127/tyler-wardhaugh/clojure/README.md b/challenge-127/tyler-wardhaugh/clojure/README.md
index 99185b88b1..e040ae4a94 100644
--- a/challenge-127/tyler-wardhaugh/clojure/README.md
+++ b/challenge-127/tyler-wardhaugh/clojure/README.md
@@ -1,7 +1,7 @@
-# tw.weekly.c126
+# tw.weekly.c127
-The Weekly Challenge - #126 - Tyler Wardhaugh
+The Weekly Challenge - #127 - Tyler Wardhaugh
## Usage
@@ -9,7 +9,7 @@ Clojure ([installation instructions](https://clojure.org/guides/getting_started#
Run the project directly (shows default output from both tasks):
- $ clojure -M -m tw.weekly.c126.core
+ $ clojure -M -m tw.weekly.c127.core
# ... or ...
$ bb run both
@@ -21,15 +21,15 @@ Run the project's tests (which are samples from the task descriptions):
Run Task #1 with input
- $ clojure -M -m tw.weekly.c126.t1 N
+ $ clojure -M -m tw.weekly.c127.t1 S1 S2
# ... or ...
- $ bb run task-1 N
+ $ bb run task-1 S1 S2
Run Task #2 with input:
- $ clojure -M -m tw.weekly.c126.t2 F
+ $ clojure -M -m tw.weekly.c127.t2 I
# ... or ...
- $ bb run task-2 F
+ $ bb run task-2 I
View available tasks Babashka can run:
@@ -45,5 +45,4 @@ See [seancorfield/clj-new: Generate new projects based on clj, Boot, or Leininge
Copyright © 2021 Tyler Wardhaugh
-Distributed under the Eclipse Public License either version 1.0 or (at
-your option) any later version.
+Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
diff --git a/challenge-127/tyler-wardhaugh/clojure/bb.edn b/challenge-127/tyler-wardhaugh/clojure/bb.edn
index 463fcb5d14..09f356c675 100644
--- a/challenge-127/tyler-wardhaugh/clojure/bb.edn
+++ b/challenge-127/tyler-wardhaugh/clojure/bb.edn
@@ -23,12 +23,12 @@
(defn run-task
[task args]
(let [clj-options (format "-M -m %s " (get-task-ns task))]
- (clojure (apply str clj-options args))))
+ (apply clojure clj-options args)))
(defn run-task-bb
[task args]
(let [bb-cmd (format "bb -m %s " (get-task-ns task))]
- (shell (apply str bb-cmd args)))))
+ (apply shell bb-cmd args))))
clean {:doc "Clean out temporary files"
:task (run! fs/delete-tree [".nrepl-port" ".cpcache" ".lsp"])}
diff --git a/challenge-127/tyler-wardhaugh/clojure/deps.edn b/challenge-127/tyler-wardhaugh/clojure/deps.edn
index 54198fdfe8..5b1400b27e 100644
--- a/challenge-127/tyler-wardhaugh/clojure/deps.edn
+++ b/challenge-127/tyler-wardhaugh/clojure/deps.edn
@@ -1,6 +1,5 @@
{:paths ["src" "resources"]
- :deps {org.clojure/clojure {:mvn/version "1.10.3"}
- net.mikera/core.matrix {:mvn/version "0.62.0"}}
+ :deps {org.clojure/clojure {:mvn/version "1.10.3"}}
:aliases
{:test {:extra-paths ["test"]
:extra-deps {org.clojure/test.check {:mvn/version "1.1.0"}
diff --git a/challenge-127/tyler-wardhaugh/clojure/src/tw/weekly/c127/core.clj b/challenge-127/tyler-wardhaugh/clojure/src/tw/weekly/c127/core.clj
new file mode 100644
index 0000000000..4a0bb34914
--- /dev/null
+++ b/challenge-127/tyler-wardhaugh/clojure/src/tw/weekly/c127/core.clj
@@ -0,0 +1,12 @@
+(ns tw.weekly.c127.core
+ (:require [tw.weekly.c127.t1 :as t1])
+ (:require [tw.weekly.c127.t2 :as t2])
+ (:gen-class))
+
+(defn -main
+ "Run all tasks"
+ [& _]
+ (println "Task #1:")
+ (t1/-main)
+ (println "\nTask #2:")
+ (t2/-main))
diff --git a/challenge-127/tyler-wardhaugh/clojure/src/tw/weekly/c127/t1.clj b/challenge-127/tyler-wardhaugh/clojure/src/tw/weekly/c127/t1.clj
new file mode 100644
index 0000000000..9e17ac2590
--- /dev/null
+++ b/challenge-127/tyler-wardhaugh/clojure/src/tw/weekly/c127/t1.clj
@@ -0,0 +1,15 @@
+(ns tw.weekly.c127.t1
+ (:require [clojure.edn :as edn]
+ [clojure.pprint :refer [cl-format]]))
+
+;;;
+; Task description for TASK #1 › Disjoint Sets
+;;;
+(def DEFAULT-INPUT ['(1, 2, 5, 3, 4) '(4, 6, 7, 8, 9)])
+
+(defn -main
+ "Run Task 1 with a given input S1 and S2, defaulting to the first example
+ from the task description."
+ [& args]
+ (let [[S1 S2] (or (some->> args (map edn/read-string)) DEFAULT-INPUT)]
+ ))
diff --git a/challenge-127/tyler-wardhaugh/clojure/src/tw/weekly/c127/t2.clj b/challenge-127/tyler-wardhaugh/clojure/src/tw/weekly/c127/t2.clj
new file mode 100644
index 0000000000..85327d44f6
--- /dev/null
+++ b/challenge-127/tyler-wardhaugh/clojure/src/tw/weekly/c127/t2.clj
@@ -0,0 +1,14 @@
+ (:require [clojure.edn :as edn]))
+(ns tw.weekly.c127.t2
+
+;;;
+; Task description for TASK #2 › Conflict Intervals
+;;;
+(def DEFAULT-INPUT [])
+
+(defn -main
+ "Run Task 2 with a given input, defaulting to the first example from the
+ task description."
+ [& args]
+ (let [[I] (or (some->> args (map edn/read-string)) DEFAULT-INPUT)]
+ ))
diff --git a/challenge-127/tyler-wardhaugh/clojure/test/tw/weekly/c127_test.clj b/challenge-127/tyler-wardhaugh/clojure/test/tw/weekly/c127_test.clj
new file mode 100644
index 0000000000..13718f44c9
--- /dev/null
+++ b/challenge-127/tyler-wardhaugh/clojure/test/tw/weekly/c127_test.clj
@@ -0,0 +1,12 @@
+(ns tw.weekly.c127-test
+ (:require [clojure.test :refer [deftest is testing]]
+ [tw.weekly.c127.t1 :refer []]
+ [tw.weekly.c127.t2 :refer []]))
+
+(deftest task-1
+ (testing "Disjoint Sets"
+ ))
+
+(deftest task-2
+ (testing "Task 2, Conflict Intervals"
+ ))