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 com.palletops.brick-server.fs-watch | |
"Watch a filesystem path" | |
(:require | |
[clojure.java.io :refer [file]] | |
[clojure.set :refer [map-invert]] | |
[clojure.tools.logging :refer [debugf]] | |
[clojure.string :refer [join]]) | |
(:import | |
[java.nio.file | |
ClosedWatchServiceException FileSystems Path StandardWatchEventKinds |
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
(defvar clojure-test-ediff-buffers nil) | |
(defun clojure-test-ediff-cleanup () | |
"A function for ediff-cleanup-hook, to cleanup the temporary ediff buffers" | |
(mapc #'kill-buffer clojure-test-ediff-buffers)) | |
(defconst re1 | |
"Expected \\(?:.\\|\n\\)*, got (not ([^ ]+ \\(\"\\(?:.\\|\n\\)+\"\\) \\(\"\\(?:.\\|\n\\)+\"\\)))" | |
"Match predicate on strings test") | |
(defconst re2 | |
"Expected \\(?:.\\|\n\\)*, got (not ([^ ]+ \\(\\(?:.\\|\n\\)+\\) \\(\\(?:.\\|\n\\)+\\)))" |
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
(defmacro mfn* | |
[[argv] body & args] | |
(let [[argv] args] | |
body)) | |
(defmacro mfn | |
"An macro form which looks like an anonymous function, and can be used to | |
inline a function call " | |
[args body & arg-vals] | |
`(let [~args ~(vec arg-vals)] |
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
(defmacro as | |
"Binds name to the result of each of the forms. Within each form the previous | |
binding is available. Returns the final binding." | |
[name & forms] | |
`(let [~@(interleave (repeat name) forms)] | |
~name)) | |
;; (as a | |
;; 1 | |
;; (+ a 2)) |
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
(defmacro when-> | |
"When expr is logical true, threads it into the first form (via ->), | |
and when that result is logical true, through the next etc" | |
{:added "1.5"} | |
[expr & forms] | |
(let [[g forms] (if (vector? (first forms)) | |
[(ffirst forms) (rest forms)] | |
[(gensym) forms]) | |
pstep (fn [step] `(when ~g (-> ~g ~step)))] | |
`(let [~g ~expr |
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
> lein deps :tree | |
Performing task 'deps' with profile(s): 'default,dev' | |
This could be due to a typo in :dependencies or network issues. | |
Error encountered performing task 'deps' with profile(s): 'default,dev' | |
Could not resolve dependencies | |
> |
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
No implementation of method: :lb of protocol: #'clojure.core.logic/IInterval found for class: clojure.lang.Keyword | |
java.lang.IllegalArgumentException | |
Restarts: | |
0: [CONTINUE] Pass exception to program | |
1: [ABORT] Abort request. | |
2: [IGNORE] Do not enter debugger for this exception type | |
3: [IGNORE-MSG] Do not enter debugger for this exception message | |
4: [IGNORE-CATCH] Do not enter debugger for exceptions with catch location clojure.lang.LazySeq.* | |
5: [IGNORE-LOC] Do not enter debugger for exceptions with throw location clojure.core.* |
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
No implementation of method: :lb of protocol: #'clojure.core.logic/IInterval found for class: clojure.lang.Keyword | |
java.lang.IllegalArgumentException | |
Restarts: | |
0: [CONTINUE] Pass exception to program | |
1: [ABORT] Abort request. | |
2: [IGNORE] Do not enter debugger for this exception type | |
3: [IGNORE-MSG] Do not enter debugger for this exception message | |
4: [IGNORE-CATCH] Do not enter debugger for exceptions with catch location clojure.lang.LazySeq.* | |
5: [IGNORE-LOC] Do not enter debugger for exceptions with throw location clojure.core.* |
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
(rewrite-layer | |
{:mapping {:y :mpg} | |
:stat (stat/quantiles)}) | |
;; => | |
{:mapping {:upper :q75, :min :min, :lower :q25, :max :max, :middle :q50, :y :mpg} | |
:stat #com.keminglabs/c2po$stat$quantiles {:dimension :mpg} | |
:geom #com.keminglabs/c2po$geom$boxplot {}} |
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
(run* [q] | |
(fresh [pattern production guards rule rule-name] | |
(membero | |
{:pattern pattern :production production} | |
[{:pattern (partial-map {:a :clojure.core.logic/not-found :x 1}) | |
:production {:a 1}} | |
{:pattern (partial-map {:a '?a :c :clojure.core.logic/not-found}) | |
:production {:c '(* ?a 2)}}]) | |
(== {:x 1} pattern) | |
(== q production))) |