Public Vars
- * (clj)
- *' (clj)
- *1 (clj)
- *2 (clj)
- *3 (clj)
- *clojure-version* (clj)
- *data-readers* (clj)
- *default-data-reader-fn* (clj)
- *e (clj)
- *print-length* (clj)
- *print-level* (clj)
- *print-namespace-maps* (clj)
- *repl* (clj)
- *verbose-defrecords* (clj)
- + (clj)
- +' (clj)
- - (clj)
- -' (clj)
- -> (clj)
- ->> (clj)
- ->ArrayChunk (clj)
- ->Eduction (clj)
- ->Vec (clj)
- ->VecNode (clj)
- ->VecSeq (clj)
- -cache-protocol-fn (clj)
- -reset-methods (clj)
- .. (clj)
- / (clj)
- < (clj)
- <= (clj)
- = (clj)
- == (clj)
- > (clj)
- >= (clj)
- ArrayChunk (clj)
- ArrayManager (clj)
- EMPTY-NODE (clj)
- Eduction (clj)
- IVecImpl (clj)
- Inst (clj)
- NaN? (clj)
- PrintWriter-on (clj)
- StackTraceElement->vec (clj)
- Throwable->map (clj)
- Vec (clj)
- VecNode (clj)
- VecSeq (clj)
- abs (clj)
- accessor (clj)
- aclone (clj)
- add-classpath (clj)
- add-tap (clj)
- add-watch (clj)
- agent (clj)
- agent-error (clj)
- agent-errors (clj)
- aget (clj)
- alength (clj)
- alias (clj)
- all-ns (clj)
- alter (clj)
- alter-meta! (clj)
- alter-var-root (clj)
- amap (clj)
- ancestors (clj)
- and (clj)
- any? (clj)
- apply (clj)
- areduce (clj)
- array (clj)
- array-map (clj)
- arrayFor (clj)
- as-> (clj)
- aset (clj)
- assert (clj)
- assoc (clj)
- assoc! (clj)
- assoc-in (clj)
- associative? (clj)
- atom (clj)
- await (clj)
- await-for (clj)
- await1 (clj)
- bases (clj)
- bean (clj)
- bigdec (clj)
- bigint (clj)
- biginteger (clj)
- binding (clj)
- bit-and (clj)
- bit-and-not (clj)
- bit-clear (clj)
- bit-flip (clj)
- bit-not (clj)
- bit-or (clj)
- bit-set (clj)
- bit-shift-left (clj)
- bit-shift-right (clj)
- bit-test (clj)
- bit-xor (clj)
- boolean (clj)
- boolean-array (clj)
- boolean? (clj)
- bound-fn (clj)
- bound-fn* (clj)
- bound? (clj)
- bounded-count (clj)
- butlast (clj)
- byte (clj)
- byte-array (clj)
- bytes? (clj)
- case (clj)
- cast (clj)
- cat (clj)
- char (clj)
- char-array (clj)
- char-escape-string (clj)
- char-name-string (clj)
- char? (clj)
- chunk (clj)
- chunk-append (clj)
- chunk-buffer (clj)
- chunk-cons (clj)
- chunk-first (clj)
- chunk-next (clj)
- chunk-rest (clj)
- chunked-seq? (clj)
- class (clj)
- class? (clj)
- clear-agent-errors (clj)
- clojure-version (clj)
- coll? (clj)
- comment (clj)
- commute (clj)
- comp (clj)
- comparator (clj)
- compare (clj)
- compare-and-set! (clj)
- compile (clj)
- complement (clj)
- completing (clj)
- concat (clj)
- cond (clj)
- cond-> (clj)
- cond->> (clj)
- condp (clj)
- conj (clj)
- conj! (clj)
- cons (clj)
- constantly (clj)
- construct-proxy (clj)
- contains? (clj)
- count (clj)
- counted? (clj)
- create-ns (clj)
- create-struct (clj)
- cycle (clj)
- dec (clj)
- dec' (clj)
- decimal? (clj)
- declare (clj)
- dedupe (clj)
- default-data-readers (clj)
- definline (clj)
- definterface (clj)
- defmacro (clj)
- defmethod (clj)
- defmulti (clj)
- defn (clj)
- defn- (clj)
- defonce (clj)
- defprotocol (clj)
- defrecord (clj)
- defstruct (clj)
- deftype (clj)
- delay (clj)
- delay? (clj)
- deliver (clj)
- denominator (clj)
- deref (clj)
- derive (clj)
- descendants (clj)
- destructure (clj)
- disj (clj)
- disj! (clj)
- dissoc (clj)
- dissoc! (clj)
- distinct (clj)
- distinct? (clj)
- doAssoc (clj)
- doall (clj)
- dorun (clj)
- doseq (clj)
- dosync (clj)
- dotimes (clj)
- doto (clj)
- double (clj)
- double-array (clj)
- double? (clj)
- drop (clj)
- drop-last (clj)
- drop-while (clj)
- eduction (clj)
- empty (clj)
- empty? (clj)
- ensure (clj)
- ensure-reduced (clj)
- enumeration-seq (clj)
- error-handler (clj)
- error-mode (clj)
- eval (clj)
- even? (clj)
- every-pred (clj)
- every? (clj)
- ex-cause (clj)
- ex-data (clj)
- ex-info (clj)
- ex-message (clj)
- extend (clj)
- extend-protocol (clj)
- extend-type (clj)
- extenders (clj)
- extends? (clj)
- false? (clj)
- ffirst (clj)
- file-seq (clj)
- filter (clj)
- filterv (clj)
- find (clj)
- find-keyword (clj)
- find-ns (clj)
- find-protocol-impl (clj)
- find-protocol-method (clj)
- find-var (clj)
- first (clj)
- flatten (clj)
- float (clj)
- float-array (clj)
- float? (clj)
- flush (clj)
- fn (clj)
- fn? (clj)
- fnext (clj)
- fnil (clj)
- for (clj)
- force (clj)
- format (clj)
- frequencies (clj)
- future (clj)
- future-call (clj)
- future-cancel (clj)
- future-cancelled? (clj)
- future-done? (clj)
- future? (clj)
- gen-class (clj)
- gen-interface (clj)
- gensym (clj)
- get (clj)
- get-in (clj)
- get-method (clj)
- get-proxy-class (clj)
- get-thread-bindings (clj)
- get-validator (clj)
- global-hierarchy (clj)
- group-by (clj)
- halt-when (clj)
- hash (clj)
- hash-combine (clj)
- hash-map (clj)
- hash-ordered-coll (clj)
- hash-set (clj)
- hash-unordered-coll (clj)
- ident? (clj)
- identical? (clj)
- identity (clj)
- if-let (clj)
- if-not (clj)
- if-some (clj)
- ifn? (clj)
- import (clj)
- inc (clj)
- inc' (clj)
- indexed? (clj)
- infinite? (clj)
- init-proxy (clj)
- inst-ms (clj)
- inst-ms* (clj)
- inst? (clj)
- instance? (clj)
- int (clj)
- int-array (clj)
- int? (clj)
- integer? (clj)
- interleave (clj)
- intern (clj)
- interpose (clj)
- into (clj)
- into-array (clj)
- io! (clj)
- isa? (clj)
- iterate (clj)
- iteration (clj)
- iterator-seq (clj)
- juxt (clj)
- keep (clj)
- keep-indexed (clj)
- key (clj)
- keys (clj)
- keyword (clj)
- keyword? (clj)
- last (clj)
- lazy-cat (clj)
- lazy-seq (clj)
- let (clj)
- letfn (clj)
- line-seq (clj)
- list (clj)
- list* (clj)
- list? (clj)
- load (clj)
- load-reader (clj)
- load-string (clj)
- loaded-libs (clj)
- locking (clj)
- long (clj)
- long-array (clj)
- loop (clj)
- macroexpand (clj)
- macroexpand-1 (clj)
- make-array (clj)
- make-hierarchy (clj)
- map (clj)
- map-entry? (clj)
- map-indexed (clj)
- map? (clj)
- mapcat (clj)
- mapv (clj)
- max (clj)
- max-key (clj)
- memfn (clj)
- memoize (clj)
- merge (clj)
- merge-with (clj)
- meta (clj)
- method-sig (clj)
- methods (clj)
- min (clj)
- min-key (clj)
- mix-collection-hash (clj)
- mod (clj)
- munge (clj)
- name (clj)
- namespace (clj)
- namespace-munge (clj)
- nat-int? (clj)
- neg-int? (clj)
- neg? (clj)
- newPath (clj)
- newline (clj)
- next (clj)
- nfirst (clj)
- nil? (clj)
- nnext (clj)
- not (clj)
- not-any? (clj)
- not-empty (clj)
- not-every? (clj)
- not= (clj)
- ns (clj)
- ns-aliases (clj)
- ns-imports (clj)
- ns-interns (clj)
- ns-map (clj)
- ns-name (clj)
- ns-publics (clj)
- ns-refers (clj)
- ns-resolve (clj)
- ns-unalias (clj)
- ns-unmap (clj)
- nth (clj)
- nthnext (clj)
- nthrest (clj)
- num (clj)
- number? (clj)
- numerator (clj)
- object-array (clj)
- odd? (clj)
- or (clj)
- parents (clj)
- parse-boolean (clj)
- parse-double (clj)
- parse-long (clj)
- parse-uuid (clj)
- partial (clj)
- partition (clj)
- partition-all (clj)
- partition-by (clj)
- partitionv (clj)
- partitionv-all (clj)
- pcalls (clj)
- peek (clj)
- persistent! (clj)
- pmap (clj)
- pop (clj)
- pop! (clj)
- pop-thread-bindings (clj)
- popTail (clj)
- pos-int? (clj)
- pos? (clj)
- pr (clj)
- pr-str (clj)
- prefer-method (clj)
- prefers (clj)
- primitives-classnames (clj)
- print (clj)
- print-ctor (clj)
- print-dup (clj)
- print-method (clj)
- print-simple (clj)
- print-str (clj)
- printf (clj)
- println (clj)
- println-str (clj)
- prn (clj)
- prn-str (clj)
- process-annotation (clj)
- promise (clj)
- proxy (clj)
- proxy-call-with-super (clj)
- proxy-mappings (clj)
- proxy-name (clj)
- proxy-super (clj)
- push-thread-bindings (clj)
- pushTail (clj)
- pvalues (clj)
- qualified-ident? (clj)
- qualified-keyword? (clj)
- qualified-symbol? (clj)
- quot (clj)
- rand (clj)
- rand-int (clj)
- rand-nth (clj)
- random-sample (clj)
- random-uuid (clj)
- range (clj)
- ratio? (clj)
- rational? (clj)
- rationalize (clj)
- re-find (clj)
- re-groups (clj)
- re-matcher (clj)
- re-matches (clj)
- re-pattern (clj)
- re-seq (clj)
- read (clj)
- read+string (clj)
- read-line (clj)
- read-string (clj)
- reader-conditional (clj)
- reader-conditional? (clj)
- realized? (clj)
- record? (clj)
- reduce (clj)
- reduce-kv (clj)
- reduced (clj)
- reduced? (clj)
- reductions (clj)
- ref (clj)
- ref-history-count (clj)
- ref-max-history (clj)
- ref-min-history (clj)
- ref-set (clj)
- refer (clj)
- refer-clojure (clj)
- reify (clj)
- release-pending-sends (clj)
- rem (clj)
- remove (clj)
- remove-all-methods (clj)
- remove-method (clj)
- remove-ns (clj)
- remove-tap (clj)
- remove-watch (clj)
- repeat (clj)
- repeatedly (clj)
- replace (clj)
- replicate (clj)
- require (clj)
- requiring-resolve (clj)
- reset! (clj)
- reset-meta! (clj)
- reset-vals! (clj)
- resolve (clj)
- rest (clj)
- restart-agent (clj)
- resultset-seq (clj)
- reverse (clj)
- reversible? (clj)
- rseq (clj)
- rsubseq (clj)
- run! (clj)
- satisfies? (clj)
- second (clj)
- select-keys (clj)
- send (clj)
- send-off (clj)
- send-via (clj)
- seq (clj)
- seq-to-map-for-destructuring (clj)
- seq? (clj)
- seqable? (clj)
- seque (clj)
- sequence (clj)
- sequential? (clj)
- set (clj)
- set-agent-send-executor! (clj)
- set-agent-send-off-executor! (clj)
- set-error-handler! (clj)
- set-error-mode! (clj)
- set-validator! (clj)
- set? (clj)
- short (clj)
- short-array (clj)
- shuffle (clj)
- shutdown-agents (clj)
- simple-ident? (clj)
- simple-keyword? (clj)
- simple-symbol? (clj)
- slurp (clj)
- some (clj)
- some-> (clj)
- some->> (clj)
- some-fn (clj)
- some? (clj)
- sort (clj)
- sort-by (clj)
- sorted-map (clj)
- sorted-map-by (clj)
- sorted-set (clj)
- sorted-set-by (clj)
- sorted? (clj)
- special-symbol? (clj)
- spit (clj)
- split-at (clj)
- split-with (clj)
- splitv-at (clj)
- str (clj)
- string? (clj)
- struct (clj)
- struct-map (clj)
- subs (clj)
- subseq (clj)
- subvec (clj)
- supers (clj)
- swap! (clj)
- swap-vals! (clj)
- symbol (clj)
- symbol? (clj)
- sync (clj)
- tagged-literal (clj)
- tagged-literal? (clj)
- tailoff (clj)
- take (clj)
- take-last (clj)
- take-nth (clj)
- take-while (clj)
- tap> (clj)
- test (clj)
- the-ns (clj)
- thread-bound? (clj)
- time (clj)
- to-array (clj)
- to-array-2d (clj)
- trampoline (clj)
- transduce (clj)
- transient (clj)
- tree-seq (clj)
- true? (clj)
- type (clj)
- unchecked-add (clj)
- unchecked-add-int (clj)
- unchecked-byte (clj)
- unchecked-char (clj)
- unchecked-dec (clj)
- unchecked-dec-int (clj)
- unchecked-divide-int (clj)
- unchecked-double (clj)
- unchecked-float (clj)
- unchecked-inc (clj)
- unchecked-inc-int (clj)
- unchecked-int (clj)
- unchecked-long (clj)
- unchecked-multiply (clj)
- unchecked-multiply-int (clj)
- unchecked-negate (clj)
- unchecked-negate-int (clj)
- unchecked-remainder-int (clj)
- unchecked-short (clj)
- unchecked-subtract (clj)
- unchecked-subtract-int (clj)
- underive (clj)
- unquote (clj)
- unquote-splicing (clj)
- unreduced (clj)
- unsigned-bit-shift-right (clj)
- update (clj)
- update-in (clj)
- update-keys (clj)
- update-proxy (clj)
- update-vals (clj)
- uri? (clj)
- use (clj)
- uuid? (clj)
- val (clj)
- vals (clj)
- var-get (clj)
- var-set (clj)
- var? (clj)
- vary-meta (clj)
- vec (clj)
- vector (clj)
- vector-of (clj)
- vector? (clj)
- volatile! (clj)
- volatile? (clj)
- vreset! (clj)
- vswap! (clj)
- when (clj)
- when-first (clj)
- when-let (clj)
- when-not (clj)
- when-some (clj)
- while (clj)
- with-bindings (clj)
- with-bindings* (clj)
- with-in-str (clj)
- with-loading-context (clj)
- with-local-vars (clj)
- with-meta (clj)
- with-open (clj)
- with-out-str (clj)
- with-precision (clj)
- with-redefs (clj)
- with-redefs-fn (clj)
- xml-seq (clj)
- zero? (clj)
- zipmap (clj)
Back
assoc (clj)
(source)variable
(assoc map key val)
(assoc map key val & kvs)
assoc[iate]. When applied to a map, returns a new map of the
same (hashed/sorted) type, that contains the mapping of key(s) to
val(s). When applied to a vector, returns a new vector that
contains val at index. Note - index must be <= (count vector).
Examples
clojure
(ns clojure.test-clojure.reducers
(:require [clojure.core.reducers :as r]
[clojure.test.generative :refer (defspec)]
[clojure.data.generators :as gen])
(:use clojure.test))
(deftest test-nil
(is (= {:k :v} (reduce-kv assoc {:k :v} nil)))
(is (= 0 (r/fold + nil))))
TechEmpower/FrameworkBenchmarks
(ns io.github.kit-clj.te-bench.cache.inmem
(:require
[clojure.core.cache :as cache]
[integrant.core :as ig]
[next.jdbc :as jdbc]
[next.jdbc.result-set :as rs]))
(defmethod ig/init-key :cache/inmem
[_ {:keys [db-conn threshold]}]
(cache/fifo-cache-factory
(reduce
(fn [out {:keys [id] :as obj}]
(assoc out id obj))
{}
(jdbc/execute! db-conn ["select * from \"World\""] {:builder-fn rs/as-unqualified-lower-maps}))
{:threshold threshold}))
pedestal/pedestal
(ns io.pedestal.http.jetty.container
(:require [io.pedestal.http.container :as container]
[clojure.core.async :as async])
(:import (java.nio.channels ReadableByteChannel)
(java.nio ByteBuffer)
(org.eclipse.jetty.server Response)))
(extend-protocol container/WriteNIOByteBody
org.eclipse.jetty.server.Response
(write-byte-channel-body [servlet-response ^ReadableByteChannel body resume-chan context]
(let [os ^org.eclipse.jetty.server.HttpOutput (.getHttpOutput servlet-response)]
(.sendContent os body (reify org.eclipse.jetty.util.Callback
(succeeded [this]
(.close body)
(async/put! resume-chan context)
(async/close! resume-chan))
(failed [this throwable]
(.close body)
(async/put! resume-chan (assoc context :io.pedestal.impl.interceptor/error throwable))
(async/close! resume-chan))))))
(write-byte-buffer-body [servlet-response ^ByteBuffer body resume-chan context]
(let [os ^org.eclipse.jetty.server.HttpOutput (.getHttpOutput servlet-response)]
(.sendContent os body (reify org.eclipse.jetty.util.Callback
(succeeded [this]
(async/put! resume-chan context)
(async/close! resume-chan))
(failed [this throwable]
(async/put! resume-chan (assoc context :io.pedestal.impl.interceptor/error throwable))
(async/close! resume-chan)))))))
thheller/shadow-cljs
(ns shadow.remote.runtime.cljs.js-builtins
(:require
[goog.object :as gobj]
[clojure.core.protocols :as p]))
(extend-protocol p/Datafiable
;; FIXME: this is kind of a bad idea
;; can't do this for all objects, since none of the CLJS types implement this
;; protocol either. the protocol dispatch will end up using object
;; FIXME: this could detect CLJS types to some extent
;; or should it just implement the protocols for the types?
object
(datafy [o]
(if-not (identical? (.-__proto__ o) js/Object.prototype)
o
(with-meta
(->> (gobj/getKeys o)
(reduce
(fn [m key]
(assoc! m key (gobj/get o key)))
(transient {}))
(persistent!))
js/Error
(datafy [e]
(let [data (ex-data e)
file (.-fileName e)
line (.-lineNumber e)
column (.-columnNumber e)]
(-> {:message (.-message e)
:name (.-name e)
:stack (.-stack e)}
(cond->
(some? data)
(assoc :data data)
file
(assoc :file file)
line
(assoc :line line)
column
(assoc :column column)
)))))
nextjournal/clerk
(ns nextjournal.clerk.atom
"Demo of Clerk's two-way bindings."
{:nextjournal.clerk/visibility {:code :hide :result :hide}}
(:require [clojure.core :as core]
[nextjournal.clerk :as clerk]))
(def slider-viewer
{:render-fn '(fn [x] [:input {:type :range :value (:counter @@(resolve x)) :on-change #(swap! @(resolve x) assoc :counter (int (.. % -target -value)))}])
:transform-fn transform-var})
nextjournal/clerk
(ns viewers.controls
"Demo of Clerk's two-way bindings."
{:nextjournal.clerk/visibility {:code :show :result :show}}
(:require [clojure.core :as core]
[nextjournal.clerk :as clerk]
[nextjournal.clerk.viewer :as viewer]))
^{::clerk/viewers (clerk/add-viewers [(assoc var-viewer :render-fn (list 'comp render-text-input 'deref))])}
#'name-atom