aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-117/tyler-wardhaugh/clojure/README.md12
-rw-r--r--challenge-117/tyler-wardhaugh/clojure/bb.edn43
-rw-r--r--challenge-117/tyler-wardhaugh/clojure/deps.edn19
-rw-r--r--challenge-117/tyler-wardhaugh/clojure/pom.xml18
-rw-r--r--challenge-117/tyler-wardhaugh/clojure/resources/input.txt14
-rw-r--r--challenge-117/tyler-wardhaugh/clojure/src/tw/weekly/c117/core.clj12
-rw-r--r--challenge-117/tyler-wardhaugh/clojure/src/tw/weekly/c117/t1.clj17
-rw-r--r--challenge-117/tyler-wardhaugh/clojure/src/tw/weekly/c117/t2.clj18
-rw-r--r--challenge-117/tyler-wardhaugh/clojure/test/tw/weekly/c117_test.clj12
9 files changed, 123 insertions, 42 deletions
diff --git a/challenge-117/tyler-wardhaugh/clojure/README.md b/challenge-117/tyler-wardhaugh/clojure/README.md
index 25387710fe..46dde45ce4 100644
--- a/challenge-117/tyler-wardhaugh/clojure/README.md
+++ b/challenge-117/tyler-wardhaugh/clojure/README.md
@@ -1,7 +1,7 @@
-# tw.weekly.c116
+# tw.weekly.c117
-The Weekly Challenge - #116 - Tyler Wardhaugh
+The Weekly Challenge - #117 - 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.c116.core
+ $ clojure -M -m tw.weekly.c117.core
# ... or ...
$ bb run both
@@ -21,13 +21,13 @@ Run the project's tests (which are samples from the task descriptions):
Run Task #1 with input
- $ clojure -M -m tw.weekly.c116.t1 N
+ $ clojure -M -m tw.weekly.c117.t1 FILE
# ... or ...
- $ bb run task-1 N
+ $ bb run task-1 FILE
Run Task #2 with input:
- $ clojure -M -m tw.weekly.c116.t2 N
+ $ clojure -M -m tw.weekly.c117.t2 N
# ... or ...
$ bb run task-2 N
diff --git a/challenge-117/tyler-wardhaugh/clojure/bb.edn b/challenge-117/tyler-wardhaugh/clojure/bb.edn
index 6b36f27eb2..d6814eab4a 100644
--- a/challenge-117/tyler-wardhaugh/clojure/bb.edn
+++ b/challenge-117/tyler-wardhaugh/clojure/bb.edn
@@ -1,6 +1,6 @@
{
:paths ["src"]
- :deps {org.clojure/math.numeric-tower {:mvn/version "0.0.4"}}
+ :deps {}
:tasks
{
@@ -30,9 +30,35 @@
(let [bb-cmd (format "bb -m %s " (get-task-ns task))]
(shell (apply str bb-cmd args)))))
+ clean {:doc "Clean out temporary files"
+ :task (run! fs/delete-tree [".nrepl-port" ".cpcache" ".lsp"])}
+
+ generate-pom {:doc "Generate POM file"
+ :task (clojure "-X:deps mvn-pom")}
+
+ generate-jar {:doc "Generate JAR file"
+ :depends [generate-pom]
+ :task (clojure "-X:jar")}
+
+ publish {:doc "Publish branch via git-push to REPO (default: origin)"
+ :requires ([clojure.string :as str]
+ [babashka.process :as p :refer [process]])
+ :task (let [repo (or (first *command-line-args*) "origin")
+ current-branch (-> (p/$ git branch --show-current)
+ p/check
+ :out
+ slurp
+ str/trim-newline)
+ cmd '[git push --force-with-lease --set-upstream]
+ args [repo current-branch]]
+ (-> (process (concat cmd args) {:inherit true})
+ p/check))}
+
test {:doc "Run tests"
:task (clojure "-M:test:runner")}
+ c**** {:doc "CHALLENGE TASKS"}
+
task-1 {:doc "Run Task 1 (via clojure)"
:task (run-task :t1 *command-line-args*)}
@@ -59,20 +85,5 @@
(println "\nTask 2:")
(run 'task-2-bb))}
-
- publish {:doc "Publish branch via git-push to REPO (default: origin)"
- :requires ([clojure.string :as str]
- [babashka.process :as p :refer [process]])
- :task (let [repo (or (first *command-line-args*) "origin")
- current-branch (-> (p/$ git branch --show-current)
- p/check
- :out
- slurp
- str/trim-newline)
- cmd '[git push --force-with-lease --set-upstream]
- args [repo current-branch]]
- (-> (process (concat cmd args) {:inherit true})
- p/check))}
-
}
}
diff --git a/challenge-117/tyler-wardhaugh/clojure/deps.edn b/challenge-117/tyler-wardhaugh/clojure/deps.edn
index 71837236a5..803cdffd33 100644
--- a/challenge-117/tyler-wardhaugh/clojure/deps.edn
+++ b/challenge-117/tyler-wardhaugh/clojure/deps.edn
@@ -1,15 +1,18 @@
{:paths ["src" "resources"]
- :deps {org.clojure/clojure {:mvn/version "1.10.1"}
- org.clojure/math.numeric-tower {:mvn/version "0.0.4"}}
+ :deps {org.clojure/clojure {:mvn/version "1.10.3"}}
:aliases
- {:test {:extra-paths ["test"]
- :extra-deps {org.clojure/test.check {:mvn/version "1.0.0"}}}
+ {:test
+ {:extra-paths ["test"]
+ :extra-deps {org.clojure/test.check {:mvn/version "1.0.0"}}}
+
:runner
{:extra-deps {com.cognitect/test-runner
{:git/url "https://github.com/cognitect-labs/test-runner"
- :sha "f7ef16dc3b8332b0d77bc0274578ad5270fbfedd"}}
+ :sha "705ad25bbf0228b1c38d0244a36001c2987d7337"}}
:main-opts ["-m" "cognitect.test-runner"
"-d" "test"]}
- :uberjar {:extra-deps {seancorfield/depstar {:mvn/version "1.0.99"}}
- :main-opts ["-m" "hf.depstar.uberjar" "tw.weekly.c112.jar"
- "-C" "-m" "tw.weekly.c112"]}}}
+
+ :jar
+ {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.0.216"}}
+ :exec-fn hf.depstar/jar
+ :exec-args {:jar "tw-weekly.jar" :sync-pom true}}}}
diff --git a/challenge-117/tyler-wardhaugh/clojure/pom.xml b/challenge-117/tyler-wardhaugh/clojure/pom.xml
index b6737dd838..e133db1508 100644
--- a/challenge-117/tyler-wardhaugh/clojure/pom.xml
+++ b/challenge-117/tyler-wardhaugh/clojure/pom.xml
@@ -2,11 +2,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>tw.weekly</groupId>
- <artifactId>tw.weekly.c102</artifactId>
+ <artifactId>tw.weekly.c117</artifactId>
<version>0.1.0-SNAPSHOT</version>
- <name>tw.weekly.c102</name>
- <description>Challenge #102</description>
- <url>https://github.com/tw.weekly/tw.weekly.c102</url>
+ <name>tw.weekly.c117</name>
+ <description>Challenge #117</description>
+ <url>https://github.com/tw.weekly/tw.weekly.c117</url>
<licenses>
<license>
<name>Eclipse Public License</name>
@@ -15,20 +15,14 @@
</licenses>
<developers>
<developer>
- <name>Tyler</name>
+ <name>Tyler Wardhaugh</name>
</developer>
</developers>
- <scm>
- <url>https://github.com/tw.weekly/tw.weekly.c102</url>
- <connection>scm:git:git://github.com/tw.weekly/tw.weekly.c102.git</connection>
- <developerConnection>scm:git:ssh://git@github.com/tw.weekly/tw.weekly.c102.git</developerConnection>
- <tag>HEAD</tag>
- </scm>
<dependencies>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
- <version>1.10.1</version>
+ <version>1.10.3</version>
</dependency>
</dependencies>
<build>
diff --git a/challenge-117/tyler-wardhaugh/clojure/resources/input.txt b/challenge-117/tyler-wardhaugh/clojure/resources/input.txt
new file mode 100644
index 0000000000..5b9d9ab1ce
--- /dev/null
+++ b/challenge-117/tyler-wardhaugh/clojure/resources/input.txt
@@ -0,0 +1,14 @@
+11, Line Eleven
+1, Line one
+9, Line Nine
+13, Line Thirteen
+2, Line two
+6, Line Six
+8, Line Eight
+10, Line Ten
+7, Line Seven
+4, Line Four
+14, Line Fourteen
+3, Line three
+15, Line Fifteen
+5, Line Five
diff --git a/challenge-117/tyler-wardhaugh/clojure/src/tw/weekly/c117/core.clj b/challenge-117/tyler-wardhaugh/clojure/src/tw/weekly/c117/core.clj
new file mode 100644
index 0000000000..3bbe2db07c
--- /dev/null
+++ b/challenge-117/tyler-wardhaugh/clojure/src/tw/weekly/c117/core.clj
@@ -0,0 +1,12 @@
+(ns tw.weekly.c117.core
+ (:require [tw.weekly.c117.t1 :as t1])
+ (:require [tw.weekly.c117.t2 :as t2])
+ (:gen-class))
+
+(defn -main
+ "Run all tasks"
+ [& _]
+ (println "Task #1:")
+ (t1/-main)
+ (println "\nTask #2:")
+ (t2/-main))
diff --git a/challenge-117/tyler-wardhaugh/clojure/src/tw/weekly/c117/t1.clj b/challenge-117/tyler-wardhaugh/clojure/src/tw/weekly/c117/t1.clj
new file mode 100644
index 0000000000..661a1f8fc5
--- /dev/null
+++ b/challenge-117/tyler-wardhaugh/clojure/src/tw/weekly/c117/t1.clj
@@ -0,0 +1,17 @@
+(ns tw.weekly.c117.t1
+ (:require [clojure.edn :as edn]))
+
+;;;
+; Task description for TASK #1 › Missing Row
+;;;
+(def DEFAULT-INPUT [])
+
+(defn missing-row
+ [file])
+
+(defn -main
+ "Run Task 1 with a given input FILE, defaulting to the first example from the
+ task description."
+ [& args]
+ (let [[FILE] (or (some->> args (map edn/read-string)) DEFAULT-INPUT)]
+ (println (missing-row FILE))))
diff --git a/challenge-117/tyler-wardhaugh/clojure/src/tw/weekly/c117/t2.clj b/challenge-117/tyler-wardhaugh/clojure/src/tw/weekly/c117/t2.clj
new file mode 100644
index 0000000000..48a8519f75
--- /dev/null
+++ b/challenge-117/tyler-wardhaugh/clojure/src/tw/weekly/c117/t2.clj
@@ -0,0 +1,18 @@
+(ns tw.weekly.c117.t2
+ (:require [clojure.edn :as edn]))
+
+;;;
+; Task description for TASK #2 › Find Possible Paths
+;;;
+(def DEFAULT-INPUT [2])
+
+(defn find-possible-paths
+ ""
+ [n])
+
+(defn -main
+ "Run Task 2 with a given input N, defaulting to the first example from the
+ task description."
+ [& args]
+ (let [[N] (or (some->> args (map edn/read-string)) DEFAULT-INPUT)]
+ (println (find-possible-paths N))))
diff --git a/challenge-117/tyler-wardhaugh/clojure/test/tw/weekly/c117_test.clj b/challenge-117/tyler-wardhaugh/clojure/test/tw/weekly/c117_test.clj
new file mode 100644
index 0000000000..0516bce664
--- /dev/null
+++ b/challenge-117/tyler-wardhaugh/clojure/test/tw/weekly/c117_test.clj
@@ -0,0 +1,12 @@
+(ns tw.weekly.c117-test
+ (:require [clojure.test :refer [deftest is testing]]
+ [tw.weekly.c117.t1 :refer [missing-row]]
+ [tw.weekly.c117.t2 :refer [find-possible-paths]]))
+
+(deftest task-1
+ (testing "Task 1, Missing Row"
+ ))
+
+(deftest task-2
+ (testing "Task 2, Find Possible Paths"
+ ))