Back
dissoc (clj)
(source)function
(dissoc map)
(dissoc map key)
(dissoc map key & ks)
dissoc[iate]. Returns a new map of the same (hashed/sorted) type,
that does not contain a mapping for key(s).
Examples
penpot/penpot
#_:clj-kondo/ignore
(ns app.common.data.macros
"Data retrieval & manipulation specific macros."
(:refer-clojure :exclude [get-in select-keys str with-open min max])
#?(:cljs (:require-macros [app.common.data.macros]))
(:require
#?(:clj [clojure.core :as c]
:cljs [cljs.core :as c])
[app.common.data :as d]
[cljs.analyzer.api :as aapi]
[cuerdas.core :as str]))
;; Code for Clojure
(let [vr (resolve v)
m (meta vr)
n (:name m)
n (with-meta n
(cond-> {}
(:dynamic m) (assoc :dynamic true)
(:protocol m) (assoc :protocol (:protocol m))))]
`(let [m# (meta ~vr)]
(def ~n (deref ~vr))
(alter-meta! (var ~n) merge (dissoc m# :name))
;; (when (:macro m#)
;; (.setMacro (var ~n)))
~vr))))
replikativ/datahike
(ns datahike.http.writer
"Remote writer implementation for datahike.http.server through datahike.http.client."
(:require [datahike.writer :refer [PWriter create-writer create-database delete-database]]
[datahike.http.client :refer [request-json] :as client]
[datahike.json :as json]
[datahike.tools :as dt :refer [throwable-promise]]
[taoensso.timbre :as log]
[clojure.core.async :refer [promise-chan put!]]))
(defmethod create-database :datahike-server
[& args]
(let [p (throwable-promise)
{:keys [writer] :as config} (first args)]
;; redirect call to remote-peer as writer config
(deliver p (try (->
(request-json :post
"create-database-writer"
writer
(vec (concat [(-> config
(assoc :remote-peer writer)
(dissoc :writer))]
(rest args))))
(dissoc :remote-peer))
(catch Exception e
e)))
p))
(defmethod delete-database :datahike-server
[& args]
(let [p (throwable-promise)
{:keys [writer] :as config} (first args)]
;; redirect call to remote-peer as writer config
(deliver p (try
(-> (request-json :post
"delete-database-writer"
writer
(vec (concat [(-> config
(assoc :remote-peer writer)
(dissoc :writer))]
(rest args))))
(dissoc :remote-peer))
(catch Exception e
e)))
p))
clojure/core.typed
(ns ^:no-doc clojure.core.typed.import-macros
(:require [clojure.core :as core]))
;copied from ClojureScript
(defmacro import-macros [ns [& vars]]
(core/let [ns (find-ns ns)
vars (map (core/fn [vsym]
{:pre [(symbol? vsym)]
:post [(instance? clojure.lang.Var %)]}
(let [v (ns-resolve ns vsym)]
(assert v (str "Internal error: " vsym " does not exist"))
v))
vars)
syms (map (core/fn [^clojure.lang.Var v]
{:pre [(instance? clojure.lang.Var v)]
:post [(symbol? %)]}
(core/-> v .sym (with-meta {:macro true})))
vars)
defs (map (core/fn [sym var]
{:pre [(symbol? sym)
(instance? clojure.lang.Var var)]}
`(do (def ~sym (deref ~var))
;for AOT compilation
(alter-meta! (var ~sym)
merge
(dissoc (meta ~var) :ns :name)
{:macro true})))
syms vars)]
`(do ~@defs
:imported)))
noprompt/meander
(ns multimethods
(:refer-clojure :exclude [defmethod defmulti])
(:require
#?(:clj [clojure.core :as clj] :cljs [cljs.core :as cljs])
[meander.epsilon :as m]))
(defmacro defmulti [name]
(swap! cache_ dissoc name)
`(def ~name (MultiMeanderFn. nil)))
typedclojure/typedclojure
(ns ^:no-doc clojure.core.typed.import-macros
(:require [clojure.core :as core]))
;copied from ClojureScript
(defmacro import-macros [ns [& vars]]
(core/let [ns (find-ns ns)
vars (map (core/fn [vsym]
{:pre [(symbol? vsym)]
:post [(instance? clojure.lang.Var %)]}
(let [v (ns-resolve ns vsym)]
(assert v (str "Internal error: " vsym " does not exist"))
v))
vars)
syms (map (core/fn [^clojure.lang.Var v]
{:pre [(instance? clojure.lang.Var v)]
:post [(symbol? %)]}
(core/-> v .sym (with-meta {:macro true})))
vars)
defs (map (core/fn [sym var]
{:pre [(symbol? sym)
(instance? clojure.lang.Var var)]}
`(do (def ~sym (deref ~var))
;for AOT compilation
(alter-meta! (var ~sym)
merge
(dissoc (meta ~var) :ns :name)
{:macro true})))
syms vars)]
`(do ~@defs
:imported)))