This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (def argses (->> (s/exercise ::cs/xy-chart-args 10 ex/generators) | |
| (mapv first))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (require '[cognitect.transcriptor :refer (check!)]) | |
| (+ 1 2) | |
| (check! pos-int?) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; clojure.spec's missing piece, work in progress | |
| ;; this is only halfway done, somebody else will need to do the other 95% | |
| (require | |
| '[clojure.spec :as s] | |
| '[clojure.spec.test :as test]) | |
| (defn naive-english-explain | |
| "Copy and paste this into your app. Figure out what it does by | |
| trying it in production." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; spec errors are data, and as such are composable with all the rest | |
| ;; of Clojure. The forms below show getting to an interesting part | |
| ;; of an error in a larger data structure, taking advantage of | |
| ;; edn-reading, pretty-printing, *print-length* and threading macro. | |
| ;; It is difficult to maintain the compositionality shown here | |
| ;; once you convert error data into e.g. ASCII art. | |
| (require | |
| '[clojure.edn :as edn] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (a/transduce | |
| (comp | |
| (halt-when error?) | |
| (map ...) | |
| (filter ...)) | |
| (completing ...) | |
| accumulator | |
| query) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; non-working add-at | |
| (require '[boot.core :as core] | |
| '[boot.tmpdir :as tmpd] | |
| '[clojure.java.io :as io]) | |
| (deftask add-at | |
| "Like sift :add-*, but lets you make a dest path in fileset" | |
| [r rolekey ROLEKEY kw "rolekey" | |
| s source SOURCE file "source path in project" | |
| d dest DEST file "dest path in fileset"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (s/keys :req [::first-name | |
| ::last-name | |
| ::middle-initial]) | |
| (s/keys :req [::first-name | |
| ::last-name | |
| ::middle-initial] | |
| :opt-un [::middle-name]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; bin/run log_size.clj DB-URI t | |
| ;; Estimates the total in-memory size of all log entries from t to end of data. | |
| ;; Scans log from t to the end, so run against a backup instead of production if possible! | |
| (require | |
| '[clojure.edn :as edn] | |
| '[clojure.pprint :as pp] | |
| '[datomic.api :as d] | |
| '[datomic.memory-size :as size]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; bin/run crosscheck_tx_instants.clj DB-URI t | |
| ;; This program walks the log to find txInstants | |
| ;; and then finds the same instants in the indexes. | |
| ;; Scans log from t to the end, so run against a backup instead of production if possible! | |
| (require | |
| '[clojure.edn :as edn] | |
| '[clojure.pprint :as pp] | |
| '[datomic.api :as d]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; bin/run log_as.clj DB-URI t attr | |
| ;; This program walks the log extracting datoms about a particular attribute. | |
| ;; Reveals domain data, but only about that one attribute. | |
| ;; Scans log from t to the end, so run against a backup instead of production if possible! | |
| (require | |
| '[clojure.edn :as edn] | |
| '[clojure.pprint :as pp] | |
| '[datomic.api :as d]) |