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
; Released under the Apache License, Version 2.0 | |
; http://www.apache.org/licenses/LICENSE-2.0.html | |
(defmacro try-let | |
"A combination of try and let such that exceptions thrown in the binding or | |
body can be handled by catch clauses in the body, and all bindings are | |
available to the catch and finally clauses. If an exception is thrown while | |
evaluating a binding value, it and all subsequent binding values will be nil. | |
Example: |
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
(defn take-until | |
"Returns a lazy sequence of successive items from coll until | |
(pred item) returns true, including that item. pred must be | |
free of side-effects. | |
E.g., (take-until zero? [1 2 0 3]) => (1 2 0)" | |
[pred coll] | |
(lazy-seq | |
(when-let [s (seq coll)] | |
(if (pred (first s)) | |
(cons (first s) nil) |
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
(defn arities | |
"Returns a vector of the arities of function f, or of the dispatch | |
function if f is a multifn. | |
Example: | |
=> (arities (fn ([]) ([x]) ([x y & z]))) | |
[0 1 2 :more]" | |
[f] | |
(let [f (if (instance? clojure.lang.MultiFn f) (.dispatchFn f) f) | |
methods (.getDeclaredMethods (class f)) |
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
(defn left-join | |
"When passed 2 rels, returns the rel corresponding to the natural | |
left-join. When passed an additional keymap, joins on the corresponding | |
keys." | |
([xrel yrel] | |
(if (and (seq xrel) (seq yrel)) | |
(let [ks (intersection (set (keys (first xrel))) | |
(set (keys (first yrel)))) | |
idx (index yrel ks)] | |
(reduce (fn [ret x] |
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
(defproject example "0.1.0" | |
:description "Example configuration for using log4j2 as the concrete logging | |
implementation. Libraries that depend on other well-known java | |
logging abstractions (e.g., SLF4J) will be logged with log4j2. | |
Also configures tools.logging to choose log4j2." | |
:dependencies [; Provide the log4j2 logging implementation: | |
[org.apache.logging.log4j/log4j-api "2.13.0"] | |
[org.apache.logging.log4j/log4j-core "2.13.0"] | |
; Provide log4j2 adapters for other java logging abstractions: |