Floyd Hightower / Mar 30 2022
Simplex Big Data Generator
{:deps {org.clojure/clojure {:mvn/version "1.10.3"}
;; complient is used for autocompletion
;; add your libs here (and restart the runtime to pick up changes)
compliment/compliment {:mvn/version "0.3.9"}
org.clojure/data.csv {:mvn/version "1.0.0"}}}
Extensible Data Notation
{:hello (clojure-version)}
0.2s
(def :const starting-marbles 1)
(defn get-move []
(rand-int (+ starting-marbles 1)))
(defn find-winner [a-move b-move]
(if (> a-move b-move)
"a"
(if (< a-move b-move)
"b"
"t")))
(defn play []
(let [a-move (get-move)
b-move (get-move)]
[a-move b-move (find-winner a-move b-move)]))
(play)
0.1s
(require [clojure.data.csv :as csv]
[clojure.java.io :as io])
(defn gen-data [n file-name]
(with-open [writer (io/writer file-name)]
(let [data (cons ["a" "b" "r"] (repeatedly n play))]
(csv/write-csv writer data))))
0.0s
(gen-data 10000 "train.csv")
0.2s
cat train.csv
0.5s
(gen-data 1000 "test.csv")
0.0s
cat test.csv
0.5s