This document is my personal writeup of trying to make sense of all the clojure(script) tooling chain. It might contain errors and it actually contains a few questions
REPL: A prompt in its simples form.
- Waits for and Reads input,
(defn re-named-groups | |
"Returns the groups from the most recent match/find. If there are no | |
nested groups, returns a string of the entire match. If there are | |
nested groups, returns a vector of the groups, the first element | |
being the entire match." | |
[^java.util.regex.Matcher m kw] | |
(let [gc (. m (groupCount))] | |
(if (zero? gc) | |
(. m (group)) | |
(into {} (map (fn[x] [x (. m (group (name x)))]) kw))))) |
(def xf-a | |
(atom (map inc))) | |
(defn xf [& args-out] | |
(fn [& args] | |
;; TODO: Cache the inner (apply...) | |
(apply (apply @xf-a args-out) args))) | |
(def ch (chan 1 xf)) |
(ns x.y | |
(:import | |
[java.io File])) | |
(defn ls-match | |
"Given the directory handle d, lists all files matching the given | |
regex. Returns the Java File instances. | |
Example: | |
(ls-match (File. \"./dir\") #\"(?i).drl$\")" | |
([^File d] |
(ns x.y | |
(:use [plumbing.core]) ;; Just for the map-vals | |
(:require [clojure.walk :refer [postwalk prewalk prewalk-demo postwalk-demo]] | |
[clojure.core.match :refer [match]] | |
[schema.utils :refer [named-error-explain validation-error-explain]] | |
[schema.core :as s]) | |
(:import (schema.utils NamedError ValidationError))) | |
;; Partially FROM: | |
;; https://github.com/puppetlabs/clj-schema-tools |
(defn between | |
[min max] | |
(s/pred #(<= min % max) (list 'between min max))) |
(defmacro assoc-if-nil | |
"Takes a map as the first argument and a succession of key value pairs that | |
are used to set the key to value if the key of the map is nil. The value part | |
is only evaluated if the key is nil (thus different semantics to (merge)). | |
Example: | |
(assoc-if-nil {:a {:b :set}} | |
[:a :b] :non-def | |
[:a :c] :non-def | |
:d :non-def) | |
;; =>{:a {:b :set, :c :non-def}, :d :non-def}" |
(defn quantizer | |
"Returns a function that quantizes input data which when called with 'x' returns: | |
o <1st val> if -Inf < x <= <1st bound> | |
o <2st val> if <1st bound> < x <= <2st bound> | |
o ... | |
o <last val> if <last-1 bound> < x <= <last bound> | |
o >max if x > <last bound> | |
where m is a vector of vectors where the first element specifies the boundary and | |
the second element the value which to return. |
CLJ_NREPL_PORT:=22340 | |
FIGWHEEL_PORT:=22345 | |
CLJS_JAR_VERSION:=1.7.48 | |
CLJS_JAR_URL:=https://github.com/clojure/clojurescript/releases/download/r$(CLJS_JAR_VERSION)/cljs.jar | |
.PHONY: def_target | |
def_target : null |
(ns srs-s.routes.core | |
(:require [io.pedestal.http :as pedestal] | |
[io.pedestal.http.route.definition :refer [defroutes]] | |
[io.pedestal.interceptor.helpers :as interceptor] | |
[io.pedestal.http.body-params :as body-params] | |
[ring.util.response :as ring-response] | |
[cognitect.transit :as transit] | |
[om.next.server :as om] | |
[om.tempid :as tempid]) | |
(:import [java.io OutputStream] |