Back
empty (clj)
(source)function
(empty coll)
Returns an empty collection of the same category as coll, or nil
Examples
clojure/core.typed
(ns ^:skip-wiki clojure.core.typed.ann.clojure
"Type annotations for the base Clojure distribution."
(:require [#?(:clj clojure.core.typed
:cljs cljs.core.typed)
:refer [defalias] :as t]))
(defalias
^{:doc "A non-empty lazy sequence of type t"
:forms '[(NonEmptyLazySeq t)]}
t/NonEmptyLazySeq
(t/TFn [[t :variance :covariant]]
(t/I (clojure.lang.LazySeq t)
t/NonEmptyCount)))
(defalias
^{:doc "A sequential non-empty seq retured from clojure.core/seq"
:forms '[(NonEmptyASeq t)]}
t/NonEmptyASeq
(t/TFn [[x :variance :covariant]]
(t/I (t/ASeq x)
t/NonEmptyCount)))
clojure/core.typed
(ns clojure.core.typed.checker.indirect-ops
(:require [clojure.core.typed.checker.indirect-utils :as in]))
(in/make-indirection unparse-type
parse-type
check-funapp
assoc-pairs-noret
subtype?
-FS
-top-fn
-empty-fn
infer
PropEnv?
-or
-and
type-of-nofail)
clojure/core.typed
;copied from clojure.tools.analyzer.passes.constant-lifter
(ns clojure.core.typed.analyzer.common.passes.constant-lifter
(:require [clojure.core.typed.analyzer.common :as common]
[clojure.core.typed.analyzer.common.utils :refer [const-val]]))
(defmethod constant-lift :vector
[{:keys [items form env] :as ast}]
(if (and (every? :literal? items)
(empty? (meta form)))
(merge (dissoc ast :items :children)
{:op :const
::common/op ::common/const
:val (mapv const-val items)
:type :vector
:literal? true})
ast))
(defmethod constant-lift :map
[{:keys [keys vals form env] :as ast}]
(if (and (every? :literal? keys)
(every? :literal? vals)
(empty? (meta form)))
(let [c (into (empty form)
(zipmap (mapv const-val keys)
(mapv const-val vals)))
c (if (= (class c) (class form))
c
(apply array-map (mapcat identity c)))]
(merge (dissoc ast :keys :vals :children)
{:op :const
::common/op ::common/const
:val c
:type :map
:literal? true}))
ast))
(defmethod constant-lift :set
[{:keys [items form env] :as ast}]
(if (and (every? :literal? items)
(empty? (meta form)))
(merge (dissoc ast :items :children)
{:op :const
::common/op ::common/const
:val (into (empty form) (mapv const-val items))
:type :set
:literal? true})
ast))
PrecursorApp/precursor
(ns pc.http.routes.api
(:require [cemerick.url :as url]
[cheshire.core :as json]
[clojure.core.memoize :as memo]
[clojure.string :as str]
[clojure.tools.reader.edn :as edn]
[crypto.equality :as crypto]
[defpage.core :as defpage :refer (defpage)]
[pc.auth :as auth]
[pc.crm :as crm]
[pc.datomic :as pcd]
[pc.early-access]
[pc.http.doc :as doc-http]
[pc.http.team :as team-http]
[pc.http.handlers.custom-domain :as custom-domain]
[pc.models.chat-bot :as chat-bot-model]
[pc.models.doc :as doc-model]
[pc.models.flag :as flag-model]
[pc.models.team :as team-model]
[pc.profile :as profile]
[ring.middleware.anti-forgery :as csrf]
[slingshot.slingshot :refer (try+ throw+)]))
(defpage create-team [:post "/api/v1/create-team"] [req]
(let [params (some-> req :body slurp edn/read-string)
subdomain (some-> params :subdomain str/lower-case str/trim)
coupon-code (some-> params :coupon-code)
cust (get-in req [:auth :cust])]
(cond (empty? cust)
{:status 400 :body (pr-str {:error :not-logged-in
:msg "You must log in first."})}
(empty? subdomain)
{:status 400 :body (pr-str {:error :missing-subdomain
:msg "Subdomain is missing."})}
hraberg/deuce
(ns deuce.emacs
(:require [clojure.core :as c]
[deuce.emacs-lisp :as el]
[deuce.emacs-lisp.globals :as globals])
(:refer-clojure :only [])
(:use [deuce.emacs-lisp :only [and apply-partially catch cond condition-case defconst define-compiler-macro defmacro
defun defvar function if interactive lambda let let* or prog1 prog2 progn quote
save-current-buffer save-excursion save-restriction setq setq-default
unwind-protect while throw]]
[deuce.emacs.alloc]
[deuce.emacs.buffer]
[deuce.emacs.bytecode]
[deuce.emacs.callint]
[deuce.emacs.callproc]
[deuce.emacs.casefiddle]
[deuce.emacs.casetab]
[deuce.emacs.category]
[deuce.emacs.ccl]
[deuce.emacs.character]
[deuce.emacs.charset]
[deuce.emacs.chartab]
[deuce.emacs.cmds]
[deuce.emacs.coding]
[deuce.emacs.composite]
[deuce.emacs.data]
[deuce.emacs.dired]
[deuce.emacs.dispnew]
[deuce.emacs.doc]
[deuce.emacs.editfns]
[deuce.emacs.emacs]
[deuce.emacs.eval]
[deuce.emacs.fileio]
[deuce.emacs.filelock]
[deuce.emacs.floatfns]
[deuce.emacs.fns]
[deuce.emacs.font]
[deuce.emacs.frame]
[deuce.emacs.indent]
[deuce.emacs.insdel]
[deuce.emacs.keyboard]
[deuce.emacs.keymap]
[deuce.emacs.lread]
[deuce.emacs.macros]
[deuce.emacs.marker]
[deuce.emacs.menu]
[deuce.emacs.minibuf]
[deuce.emacs.print]
[deuce.emacs.process]
[deuce.emacs.search]
[deuce.emacs.syntax]
[deuce.emacs.term]
[deuce.emacs.terminal]
[deuce.emacs.textprop]
[deuce.emacs.undo]
[deuce.emacs.window]
[deuce.emacs.xdisp]
[deuce.emacs.xfaces]
[deuce.emacs.xml]))
;; Create *Deuce* log buffer first so it won't get selected.
(get-buffer-create "*Deuce*")
;; *Messages* is created by xdisp.c
(get-buffer-create "*Messages*")
;; *scratch* is created by buffer.c
(set-window-buffer (selected-window)
(get-buffer-create "*scratch*"))
;; Minibuffer 0 is the empty one, this is either created by frame.c or minibuffer.c
;; Not the leading space for buffers in the minibuffer window. *Minibuf-1* etc. gets created once it gets activated.
;; You can switch to these buffers in a normal window in Emacs and see them change as they're used.
(set-window-buffer (minibuffer-window)
(get-buffer-create " *Minibuf-0*"))
;; ensure_echo_area_buffers in xdisp.c creates (at least) two echo areas.
(get-buffer-create " *Echo Area 0*")
(get-buffer-create " *Echo Area 1*")