Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ogeagla committed Feb 7, 2024
1 parent 6d0a8fb commit 8eb5d52
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
16 changes: 7 additions & 9 deletions src/closyr/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,17 @@
(defn validate-symreg-opts
[{:keys [ys xs infile]
:as opts}]
(let [opts (if (not (nil? infile))
(let [opts (if-not (nil? infile)
(let [csv-data (input-csv/get-csv-data infile)
xs (mapv :x csv-data)
ys (mapv :y csv-data)]
(assoc opts :xs xs :ys ys))
opts)]


(-> (cond
(and ys xs (not= (count ys) (count xs))) (println "Error: XS and YS count mismatch")
(and xs (nil? ys)) (println "Error: only XS provided, please provide YS")
:else opts)
(dissoc :infile))))
opts)
opts (cond
(and ys xs (not= (count ys) (count xs))) (println "Error: XS and YS count mismatch")
(and xs (nil? ys)) (println "Error: only XS provided, please provide YS")
:else opts)]
(dissoc opts :infile)))


(defn -main
Expand Down
8 changes: 4 additions & 4 deletions src/closyr/dataset/csv.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

(defn csv-data->maps
[csv-data]
(let [has-col-names (= "x" (first (first csv-data)))
data-content (->> (if has-col-names
(let [has-col-names (= "x" (ffirst csv-data))
data-content (map (fn [vs] (map #(Double/parseDouble %) vs))
(if has-col-names
(do
(println "Got CSV with column names " (first csv-data))
(rest csv-data))
(do
(println "Got CSV without column names " (first csv-data))
csv-data))
(map (fn [vs] (map #(Double/parseDouble %) vs))))
csv-data)))
col-names (if has-col-names
(->> (first csv-data)
(map keyword)
Expand Down
2 changes: 1 addition & 1 deletion src/closyr/ops/eval.clj
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
(fn [i]
(try
(let [^IExpr res (.getArg eval-p (inc i) F/Infinity)]
(if (or (.isReal res))
(if (.isReal res)
(ops-common/expr->double res)
Double/POSITIVE_INFINITY))
(catch Exception e
Expand Down
9 changes: 4 additions & 5 deletions src/closyr/ui/gui.clj
Original file line number Diff line number Diff line change
Expand Up @@ -724,11 +724,10 @@
x-scalar (/ (- canvas-w 100) diff-x)
y-scalar (min 10.0 (/ (- canvas-h 50) diff-y))

scaled-inputs (->>
input-data-maps
(map (fn [{:keys [x y]}]
{:x (* x-scalar x)
:y (* y-scalar y)})))]
scaled-inputs (map (fn [{:keys [x y]}]
{:x (* x-scalar x)
:y (* y-scalar y)})
input-data-maps)]
(reset! xs* (mapv :x scaled-inputs))
(doseq [[i {:keys [x y]}] (map-indexed (fn [i d] [i d]) scaled-inputs)]
(let []
Expand Down

0 comments on commit 8eb5d52

Please sign in to comment.