This file contains 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
(let [undefined-value (atom :undefined-value)] | |
(defn pick-and-rename [col pick-map] | |
(apply assoc | |
{} | |
(flatten | |
(filter (fn [[k v]] | |
(not (= v undefined-value))) | |
(map (fn [[k v]] | |
[v (get col k undefined-value)]) | |
pick-map)))))) |
This file contains 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
(ns test-helpers | |
(:import [java.io InputStream OutputStream IOException]) | |
(:require [clojure.java.io :as io])) | |
(defn- swap-! | |
"Atomically swaps the value of atom to be: | |
(apply f current-value-of-atom args). Note that f may be called | |
multiple times, and thus should be free of side effects. Returns | |
the value prior to the update." | |
[a f & args] |
This file contains 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
(ns template | |
(:require [clojure.edn :as edn] | |
[clojure.string :as string])) | |
;; Tagged literals do not need to be limited to being represented by a single string. Here we represent a value with a tuple of `magic` and `value`. | |
(defn read-magic [[magic value]] | |
(case magic | |
:c (string/capitalize value) | |
:l (string/lower-case value) | |
:u (string/upper-case value))) |
OlderNewer