This file contains hidden or 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 in-context | |
"rebind a var, expecations are run in the defined context" | |
{:expectations-options :in-context} | |
[work] | |
(with-redefs [some-src/a-fn-to-be-rebound (constantly :a-rebound-val)] | |
(work))) |
This file contains hidden or 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
(defun char-at-point () | |
(interactive) | |
(buffer-substring-no-properties (point) (+ 1 (point)))) | |
(defun clj-string-name (s) | |
(substring s 1 -1)) | |
(defun clj-keyword-name (s) | |
(substring s 1)) |
This file contains hidden or 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
;;;; created by David Chelimsky | |
(ns leiningen.hooks.expand-resource-paths | |
(:use [clojure.java.io :only [as-file]]) | |
(:import [java.io File]) | |
(:require [robert.hooke] | |
[leiningen.javac] | |
[org.satta.glob :as glob])) |
This file contains hidden or 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
;;; justification: http://en.wikipedia.org/wiki/%E2%88%98 | |
(eval-after-load 'clojure-mode | |
'(font-lock-add-keywords | |
'clojure-mode `(("(\\(comp\\)[[:space:]]" | |
(0 (progn (compose-region (match-beginning 1) | |
(match-end 1) "∘") | |
nil)))))) |
This file contains hidden or 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
(doseq [[printer {:keys [id sub-ids]}] {(partial println "sub1") {:id :A :sub-ids [11 12 13 14]} | |
(partial println "sub2") {:id :B :sub-ids [21 22 23 24]}}] | |
(let [id-str (name id)] | |
(doseq [sub-id sub-ids] | |
(printer id-str sub-id)))) | |
;;; -output- | |
;;; sub1 A 11 | |
;;; sub1 A 12 | |
;;; sub1 A 13 |
This file contains hidden or 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
(doseq [[printer {:keys [id sub-ids]}] {(partial println "sub1") {:id :A :sub-ids [11 12 13 14]} | |
(partial println "sub2") {:id :B :sub-ids [21 22 23 24]}} | |
sub-id sub-ids] | |
(let [id-str (name id)] | |
(printer id-str sub-id))) |
This file contains hidden or 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
(doseq [[printer {:keys [id sub-ids]}] {(partial println "sub1") {:id :A :sub-ids [11 12 13 14]} | |
(partial println "sub2") {:id :B :sub-ids [21 22 23 24]}} | |
:let [id-str (do (println id) (name id))] | |
sub-id sub-ids] | |
(printer id-str sub-id)) | |
;;; :A | |
;;; sub1 A 11 | |
;;; sub1 A 12 | |
;;; sub1 A 13 |
This file contains hidden or 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
(doseq [[printer {:keys [id sub-ids]}] {(partial println "sub1") {:id :A :sub-ids [11 12 13 14]} | |
(partial println "sub2") {:id :B :sub-ids []}} | |
sub-id sub-ids | |
:let [sub-id-times-2 (do (println "binding occured") (* sub-id 2))]] | |
(printer id sub-id)) | |
;;; binding occured | |
;;; sub1 :A 11 | |
;;; binding occured | |
;;; sub1 :A 12 |
This file contains hidden or 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
;; clojure.core | |
;; 141 false greek: ⊥ - http://en.wikipedia.org/wiki/Tautology_(logic) | |
;; 163 -> key-chord: kl | |
;; 217 true greek: ⊤ - http://en.wikipedia.org/wiki/Tautology_(logic) | |
;; 255 nil greek: ∅ - http://en.wikipedia.org/wiki/Null_(mathematics) | |
;; 316 :keys key-chord: kk, greek: ӄ | |
;; testing | |
;; 224 interaction greek: ι | |
;; 265 no-op greek: ⒩ |
This file contains hidden or 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
(define-clojure-indent | |
(expect 'defun) | |
(expect-let 'defun) | |
(given 'defun) | |
(context 1) | |
(freeze-time 1) | |
(redef-state 1) | |
(from-each 1)) |