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
;; | |
;; Not having used clojure with more than one person, I'm curious if code like this | |
;; would generally be considered too dense/unclear | |
;; | |
(defn changes | |
"Takes two maps and returns a map of the differences" | |
[suspense-data master-data] | |
(let [sd (set suspense-data), md (set master-data) | |
keyz (distinct (map first (clojure.set/difference |
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
;; | |
;; Several methods that were helpful in development when working with large | |
;; legacy java objects. I wouldn't be too surprised if somebody told me that | |
;; emacs does some of this stuff already | |
;; | |
;; This function (which is arguably not really an appropriate use of multimethods) | |
;; is an alternative to the (bean) method, which I found returns a "map" that | |
;; will throw an exception if |
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 my-split-with | |
[pred coll] | |
(let [evaled (map (fn [x] [x (pred x)]) coll) | |
t (take-while #(% 1) evaled) | |
d (drop-while #(% 1) evaled)] | |
[(map first t) (map first d)])) |
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
;; Both of these are inputs at runtime, separately | |
(def lib "(ns my-ns) (defn x [n] (+ n 5))") | |
(def code '(x 12)) | |
(eval code) ;; doesn't work of course | |
;; I want to be able to do this without "using" the namespace |
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
; in repl | |
(ns x) | |
(defn y [n] (+ 3 n)) | |
(ns user) | |
(remove-ns x) ;java.lang.Exception: Unable to resolve symbol: x in this context |
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- my-split-at | |
"A reimplementation of clojure.core/split-at that doesn't | |
compute the sequence twice." | |
[n coll] | |
(loop [nn n l [] r coll] | |
(if (or (zero? nn) (empty? r)) | |
[l r] | |
(let [[rx & rs] r] | |
(recur | |
(dec nn) |
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- add-seq-at | |
[colls new-seq] | |
(let [target (first new-seq) | |
existing (or (colls target) [])] | |
(assoc colls target (cons new-seq existing)))) | |
(defn- check-stuff | |
[seq-seq-map z] | |
(let [ssmz (seq-seq-map z)] | |
(if ssmz |
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
; Had this | |
(let [g (nf.graph6/graph6-to-set (:graph6 rec)), | |
unfairness (nf.graphs/unfairness g)] | |
...) | |
; and replaced with this | |
(let [unfairness (-> rec | |
:graph6 |
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 return-true | |
[f ob] | |
(loop [[a & as] (iterate f ob), [_ b & bs] (iterate f ob)] | |
(if (= a b) | |
true | |
(recur as bs)))) |
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
Reflection warning, plaza/triple_spaces/multi_remote_server/auxiliary.clj:42 - call to write can't be resolved. | |
Reflection warning, plaza/triple_spaces/multi_remote_server/auxiliary.clj:69 - call to write can't be resolved. | |
Reflection warning, plaza/triple_spaces/multi_remote_server/auxiliary.clj:75 - reference to field getBytes can't be resolved. | |
Reflection warning, plaza/triple_spaces/multi_remote_server/auxiliary.clj:99 - call to write can't be resolved. | |
Reflection warning, plaza/triple_spaces/multi_remote_server/auxiliary.clj:120 - call to write can't be resolved. | |
Reflection warning, plaza/triple_spaces/multi_remote_server/auxiliary.clj:140 - call to write can't be resolved. | |
Reflection warning, plaza/triple_spaces/multi_remote_server/auxiliary.clj:154 - reference to field getBytes can't be resolved. | |
Reflection warning, plaza/triple_spaces/multi_remote_server/auxiliary.clj:176 - call to write can't be resolved. | |
Reflection warning, plaza/triple_spaces/multi_remote_server/auxiliary.clj:188 - call to write ca |
OlderNewer