Skip to content

Instantly share code, notes, and snippets.

(ns clojure-kata.core
(:require [clojure.test :refer :all]))
(defn nil-add
"Nil-safe add"
[& args]
(->> args
(filter identity)
(ns programming-problems.template
(:import (java.io BufferedReader ByteArrayInputStream InputStreamReader)))
; STDIN generator ------------------------------
(defn str->reader [str]
(BufferedReader. (InputStreamReader. (ByteArrayInputStream. (.getBytes str)))))
(defn dev-stdin []
@sashton
sashton / explore_datafy_nav.clj
Last active October 25, 2024 01:51
Clojure datafy/nav exploration
(ns explore-datafy-nav
"Sample code demonstrating naving around a random graph of data.
The graph very likely will have circular references, which is not a problem.
To see the results, execute the entire file.
Each step in the nav process will be printed out, as well as the initial db.
Subsequent executions will generate a new random db."
(:require [clojure.datafy :refer [datafy nav]]))
(defn generate-db
"Generate a random database of users and departments.