Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge master into pull/158/head (@jpb's replace changes)
Conflicts: project.clj src/kibit/driver.clj
- Loading branch information
Showing
10 changed files
with
84 additions
and
17 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
(defproject jonase/kibit "0.1.2" | ||
(defproject jonase/kibit "0.1.4-SNAPSHOT" | ||
:description "There's a function for that!" | ||
:url "https://github.com/jonase/kibit" | ||
:license {:name "Eclipse Public License - v 1.0" | ||
:url "http://www.eclipse.org/legal/epl-v10.html" | ||
:distribution :repo | ||
:comments "Contact if any questions"} | ||
:dependencies [[org.clojure/clojure "1.6.0"] | ||
[org.clojure/core.logic "0.8.10"] | ||
[org.clojure/tools.cli "0.3.1"] | ||
:dependencies [[org.clojure/clojure "1.8.0"] | ||
[org.clojure/core.logic "0.8.11"] | ||
[org.clojure/tools.cli "0.3.5"] | ||
[rewrite-clj "0.4.12"]] | ||
:profiles {:dev {:dependencies [[lein-marginalia "0.8.0"]] | ||
:profiles {:dev {:dependencies [[lein-marginalia "0.9.0"]] | ||
:resource-paths ["test/resources"]}} | ||
:deploy-repositories [["releases" :clojars]] | ||
:warn-on-reflection false) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(ns kibit.monkeypatch | ||
"Various helpers providing a with-monkeypatches form which wraps" | ||
(:require [clojure.core.logic :as c.c.l]) | ||
(:import [clojure.lang | ||
Var | ||
IPersistentSet] | ||
[clojure.core.logic.protocols | ||
ITreeTerm])) | ||
|
||
(defn ^:pivate tree-term? [x] | ||
(and (or (coll? x) | ||
(instance? ITreeTerm x)) | ||
(not (instance? IPersistentSet x)))) | ||
|
||
(def kibit-redefs | ||
{#'c.c.l/tree-term? tree-term?}) | ||
|
||
(defmacro with-monkeypatches | ||
"Builds a try/finally which captures Var bindings (and ^:macro tags) comming in, creates new Var | ||
bindings within the try and in the finally restores the original bindings. This allows users to | ||
establish stack-local patched contexts." | ||
{:style/indent [1]} | ||
[redefs & forms] | ||
(let [redefs (eval redefs) | ||
original-bindings (into {} | ||
(for [k (keys redefs)] | ||
[k (gensym)]))] | ||
`(let [~@(for [[k v] original-bindings | ||
f [v `(deref ~k)]] | ||
f)] | ||
(try ~@(for [[k v] redefs] | ||
`(do (.bindRoot ~k ~v) | ||
~(if (.isMacro ^Var k) | ||
`(.setMacro ~k)))) | ||
~@forms | ||
(finally | ||
~@(for [[k v] redefs] | ||
`(do (.bindRoot ~k ~(get original-bindings k)) | ||
~(if (.isMacro ^Var k) | ||
`(.setMacro ~k))))))))) |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(ns resources.sets) | ||
|
||
(defn killit [coll] | ||
(not-any? #{"string1" "string2"} (map ffirst coll))) |