Public Vars

Back

filter (clj)

(source)

function

(filter pred) (filter pred coll)
Returns a lazy sequence of the items in coll for which (pred item) returns logical true. pred must be free of side-effects. Returns a transducer when no collection is provided.

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))

(defequivtest test-filter
  [filter r/filter #(into [] %)]
  [even? odd? #(< 200 %) identity])
eliben/code-for-blog
(ns reducers.benchmark
  (:require [clojure.core.reducers :as r]))

;(def s (range 0 9999999))
;(time (reduce + 0 (map inc (filter even? s))))
;(time (reduce + 0 (r/map inc (r/filter even? s)))))
hraberg/deuce
(ns deuce.emacs.process
  (:use [deuce.emacs-lisp :only (defun defvar) :as el])
  (:require [clojure.core :as c]
            [clojure.java.shell :as sh])
  (:refer-clojure :exclude []))

  :buffer BUFFER -- BUFFER is the buffer (or buffer-name) to associate
  with the process.  Process output goes at end of that buffer, unless
  you specify an output stream or filter function to handle the output.
  BUFFER may be also nil, meaning that this process is not associated
  with any buffer.

  :filter FILTER -- Install FILTER as the process filter.

  :filter-multibyte BOOL -- If BOOL is non-nil, strings given to the
  process filter are multibyte, otherwise they are unibyte.
  If this keyword is not specified, the strings are multibyte if
  the default value of `enable-multibyte-characters' is non-nil.

  - The client's process name is constructed by concatenating the server
  process' NAME and a client identification string.
  - If the FILTER argument is non-nil, the client process will not get a
  separate process buffer; otherwise, the client's process buffer is a newly
  created buffer named after the server process' BUFFER name or process
  NAME concatenated with the client identification string.
  - The connection type and the process filter and sentinel parameters are
  inherited from the server process' TYPE, FILTER and SENTINEL.
  - The client process' contact info is set according to the client's
  addressing information (typically an IP address and a port number).
  - The client process' plist is initialized from the server's plist.

(defun process-filter (process)
  "Returns the filter function of PROCESS; nil if none.
  See `set-process-filter' for more info on filter functions."
  )

(defun process-filter-multibyte-p (process)
  "This function is obsolete since 23.1.

  Return t if a multibyte string is given to PROCESS's filter."
  )

(defun waiting-for-user-input-p ()
  "Returns non-nil if Emacs is waiting for input from the user.
  This is intended for use by asynchronous process output filters and sentinels."
  )

(defun process-buffer (process)
  "Return the buffer PROCESS is associated with.
  Output from PROCESS is inserted in this buffer unless PROCESS has a filter."
  )

(defun set-process-filter (process filter)
  "Give PROCESS the filter function FILTER; nil means no filter.
  A value of t means stop accepting output from the process.

  When a process has a filter, its buffer is not used for output.
  Instead, each time it does output, the entire string of output is
  passed to the filter.

  The filter gets two arguments: the process and the string of output.
  The string argument is normally a multibyte string, except:
  - if the process' input coding system is no-conversion or raw-text,
    it is a unibyte string (the non-converted input), or else
  - if `default-enable-multibyte-characters' is nil, it is a unibyte
    string (the result of converting the decoded input multibyte
    string to unibyte with `string-make-unibyte')."
  )

  :buffer BUFFER -- BUFFER is the buffer (or buffer-name) to associate
  with the process.  Process output goes at the end of that buffer,
  unless you specify an output stream or filter function to handle the
  output.  If BUFFER is not given, the value of NAME is used.

  :filter FILTER -- Install FILTER as the process filter.

(defun set-process-filter-multibyte (process flag)
  "This function is obsolete since 23.1.

  Set multibyteness of the strings given to PROCESS's filter.
  If FLAG is non-nil, the filter is given multibyte strings.
  If FLAG is nil, the filter is given unibyte strings.  In this case,
  all character code conversion except for end-of-line conversion is
  suppressed."
  )

(defun accept-process-output (&optional process seconds millisec just-this-one)
  "Allow any pending output from subprocesses to be read by Emacs.
  It is read into the process' buffers or given to their filter functions.
  Non-nil arg PROCESS means do not return until some output has been received
  from PROCESS.

  Process output (both standard output and standard error streams) goes
  at end of BUFFER, unless you specify an output stream or filter
  function to handle the output.  BUFFER may also be nil, meaning that
  this process is not associated with any buffer.
hraberg/deuce
(ns deuce.emacs.dired
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c]
            [clojure.java.io :as io]
            [deuce.emacs-lisp.cons :as cons])
  (:import [java.io File])
  (:refer-clojure :exclude []))

(defun directory-files (directory &optional full match nosort)
  "Return a list of names of files in DIRECTORY.
  There are three optional arguments:
  If FULL is non-nil, return absolute file names.  Otherwise return names
   that are relative to the specified directory.
  If MATCH is non-nil, mention only file names that match the regexp MATCH.
  If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
   Otherwise, the list returned is sorted with `string-lessp'.
   NOSORT is useful if you plan to sort the result yourself."
  (cons/maybe-seq
   ((if nosort identity sort)
    (filter (if match
              #(re-find (re-pattern
                         ((ns-resolve 'deuce.emacs.search
                                      'emacs-regex-to-java) match)) %)
              identity)
            (map (fn [^File f]
                   (if full
                     (.getCanonicalPath f)
                     (.getName f)))
                 (.listFiles (io/file directory)))))))
hraberg/deuce
(ns deuce.emacs.alloc
  (:use [deuce.emacs-lisp :only (defun defvar) :as el]
        [taoensso.timbre :as timbre
         :only (trace debug info warn error fatal spy)])
  (:require [clojure.core :as c]
            [clojure.walk :as w]
            [deuce.emacs-lisp.cons :as cons])
  (:refer-clojure :exclude [vector cons list])
  (:import [java.util Arrays]
           [java.lang.management ManagementFactory MemoryNotificationInfo MemoryType MemoryPoolMXBean]
           [javax.management NotificationListener NotificationEmitter Notification]))

;; From http://www.javaspecialists.eu/archive/Issue092.html
(let [^MemoryPoolMXBean tenured-gen-pool (->> (ManagementFactory/getMemoryPoolMXBeans)
                                              (filter (fn [^MemoryPoolMXBean mb]
                                                        (and (= (.getType mb) MemoryType/HEAP) (.isUsageThresholdSupported mb))))
                                              first)
      warning-level 0.8]
  (.setUsageThreshold tenured-gen-pool
                      (long (* warning-level (.getMax (.getUsage tenured-gen-pool)))))
  (.addNotificationListener ^NotificationEmitter (ManagementFactory/getMemoryMXBean)
                            (proxy [NotificationListener] []
                              (handleNotification [^Notification n hb]
                                (when (= (.getType n) MemoryNotificationInfo/MEMORY_THRESHOLD_EXCEEDED)
                                  (el/setq memory-full true)))) nil nil))
typedclojure/typedclojure
(ns ^:no-doc typed.ann.clojure
  "Type annotations for the base Clojure distribution."
  #?(:cljs (:require-macros [typed.ann-macros.clojure :as macros]))
  (:require [clojure.core :as cc]
            [typed.clojure :as t]
            #?(:clj [typed.ann-macros.clojure :as macros])
            #?(:clj typed.ann.clojure.jvm) ;; jvm annotations
            #?(:clj clojure.core.typed))
  #?(:clj
     (:import (clojure.lang PersistentHashSet PersistentList
                            APersistentMap #_IPersistentCollection
                            #_ITransientSet
                            IRef)
              (java.util Comparator Collection))))

cc/find-ns [t/Sym :-> (t/Nilable t/Namespace)]
cc/create-ns [t/Sym :-> t/Namespace]
#?@(:cljs [] :default [
cc/remove-ns [t/Sym :-> t/Namespace]
cc/ns-map [(t/U t/Sym t/Namespace) :-> t/Sym]
cc/ns-aliases [(t/U t/Sym t/Namespace) :-> (t/Map t/Sym t/Namespace)]
cc/the-ns [(t/U t/Sym t/Namespace) :-> t/Namespace]
cc/in-ns [t/Sym :-> nil]
cc/import [t/Any :* :-> nil]
])
cc/namespace [(t/U t/Sym t/Keyword) :-> (t/Nilable t/Str)]
cc/ns-name [(t/U t/Sym t/Namespace) :-> t/Sym]
cc/name [(t/U t/Str t/Named) :-> t/Str]
cc/identity (t/All [x] [x :-> x
                        :filters {:then (! (t/U nil false) 0)
                                  :else (is (t/U nil false) 0)}
                        :object {:id 0}])
cc/gensym [(t/? (t/U t/Sym t/Str)) :-> t/Sym]
#?@(:cljs [] :default [
cc/intern [(t/U t/Sym t/Namespace) t/Sym (t/? t/Any) :-> t/AnyVar]
])


;TODO flip filters
cc/complement (t/All [x] [[x :-> t/Any] :-> [x :-> t/Bool]])
; should preserve filters
cc/boolean [t/Any :-> t/Bool]

cc/filter (t/All [x y] (t/IFn
                         [[x :-> t/Any :filters {:then (is y 0)}] :-> (t/Transducer x y)]
                         [[x :-> t/Any :filters {:then (! y 0)}] :-> (t/Transducer x (t/I x (t/Not y)))]
                         [[x :-> t/Any] :-> (t/Transducer x x)]
                         [[x :-> t/Any :filters {:then (is y 0)}] (t/Seqable x) :-> (t/ASeq y)]
                         [[x :-> t/Any :filters {:then (! y 0)}] (t/Seqable x) :-> (t/ASeq (t/I x (t/Not y)))]
                         [[x :-> t/Any] (t/Seqable x) :-> (t/ASeq x)]))
cc/filterv (t/All [x y] (t/IFn
                          [[x :-> t/Any :filters {:then (is y 0)}] (t/Seqable x) :-> (t/AVec y)]
                          [[x :-> t/Any] (t/Seqable x) :-> (t/AVec x)]))
cc/remove (t/All [x y] (t/IFn
                         [[x :-> t/Any :filters {:else (is y 0)}] :-> (t/Transducer x y)]
                         [[x :-> t/Any :filters {:else (! y 0)}] :-> (t/Transducer x (t/I x (t/Not y)))]
                         [[x :-> t/Any] :-> (t/Transducer x x)]
                         [[x :-> t/Any :filters {:else (is y 0)}] (t/Seqable x) :-> (t/ASeq y)]
                         [[x :-> t/Any :filters {:else (! y 0)}] (t/Seqable x) :-> (t/ASeq (t/I x (t/Not y)))]
                         [[x :-> t/Any] (t/Seqable x) :-> (t/ASeq x)]))

cc/split-with (t/All [x y z] (t/IFn
                               [[x :-> t/Any :filters {:then (is y 0), :else (is z 0)}] (t/Seqable x) :-> '[(t/ASeq y) (t/ASeq z)]]
                               [[x :-> t/Any] (t/Seqable x) :-> '[(t/ASeq x) (t/ASeq x)]]))

; Unions need to support dots for this to work:
;
; (t/All [t0 b :..]
;    (t/IFn [[t/Any :-> t/Any :filters {:then (is t0 0) :else (! t0 0)}] 
;            [t/Any :-> t/Any :filters {:then (is b 0) :else (! b 0)}] :.. b
;             :-> (t/IFn [t/Any :-> t/Any :filters {:then (is (t/U t0 b :.. b) 0) :else (! (t/U t0 b :.. b) 0)}]
;                        [t/Any :* :-> t/Any])]))
cc/some-fn 
(t/All [t0 t1 t2 t3 t4 t5]
       (t/IFn [[t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}] 
               :-> (t/IFn [t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}]
                          [t/Any :* :-> t/Any])]
              [[t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}] 
               [t/Any :-> t/Bool :filters {:then (is t1 0) :else (! t1 0)}]
               :-> (t/IFn [t/Any :-> t/Bool :filters {:then (is (t/U t0 t1) 0) :else (! (t/U t0 t1) 0)}]
                          [t/Any :* :-> t/Any])]
              [[t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}] 
               [t/Any :-> t/Bool :filters {:then (is t1 0) :else (! t1 0)}]
               [t/Any :-> t/Bool :filters {:then (is t2 0) :else (! t2 0)}]
               :-> (t/IFn [t/Any :-> t/Bool :filters {:then (is (t/U t0 t1 t2) 0) :else (! (t/U t0 t1 t2) 0)}]
                          [t/Any :* :-> t/Any])]
              [[t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}] 
               [t/Any :-> t/Bool :filters {:then (is t1 0) :else (! t1 0)}]
               [t/Any :-> t/Bool :filters {:then (is t2 0) :else (! t2 0)}]
               [t/Any :-> t/Bool :filters {:then (is t3 0) :else (! t3 0)}]
               :-> (t/IFn [t/Any :-> t/Bool :filters {:then (is (t/U t0 t1 t2 t3) 0) :else (! (t/U t0 t1 t2 t3) 0)}]
                          [t/Any :* :-> t/Any])]
              [[t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}] 
               [t/Any :-> t/Bool :filters {:then (is t1 0) :else (! t1 0)}]
               [t/Any :-> t/Bool :filters {:then (is t2 0) :else (! t2 0)}]
               [t/Any :-> t/Bool :filters {:then (is t3 0) :else (! t3 0)}]
               [t/Any :-> t/Bool :filters {:then (is t4 0) :else (! t4 0)}]
               :-> (t/IFn [t/Any :-> t/Bool :filters {:then (is (t/U t0 t1 t2 t3 t4) 0) :else (! (t/U t0 t1 t2 t3 t4) 0)}]
                          [t/Any :* :-> t/Any])]
              [[t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}] 
               [t/Any :-> t/Bool :filters {:then (is t1 0) :else (! t1 0)}]
               [t/Any :-> t/Bool :filters {:then (is t2 0) :else (! t2 0)}]
               [t/Any :-> t/Bool :filters {:then (is t3 0) :else (! t3 0)}]
               [t/Any :-> t/Bool :filters {:then (is t4 0) :else (! t4 0)}]
               [t/Any :-> t/Bool :filters {:then (is t5 0) :else (! t5 0)}]
               :-> (t/IFn [t/Any :-> t/Bool :filters {:then (is (t/U t0 t1 t2 t3 t4 t5) 0) :else (! (t/U t0 t1 t2 t3 t4 t5) 0)}]
                          [t/Any :* :-> t/Any])]
              [[t/Any :-> t/Any] :+ :-> [t/Any :* :-> t/Any]]))
cc/every-pred
(t/All [t0 t1 t2 t3 t4 t5]
       (t/IFn [[t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}] 
               :-> (t/IFn [t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}]
                          [t/Any :* :-> t/Any])]
              [[t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}] 
               [t/Any :-> t/Bool :filters {:then (is t1 0) :else (! t1 0)}]
               :-> (t/IFn [t/Any :-> t/Bool :filters {:then (is (t/I t0 t1) 0) :else (! (t/I t0 t1) 0)}]
                          [t/Any :* :-> t/Any])]
              [[t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}] 
               [t/Any :-> t/Bool :filters {:then (is t1 0) :else (! t1 0)}]
               [t/Any :-> t/Bool :filters {:then (is t2 0) :else (! t2 0)}]
               :-> (t/IFn [t/Any :-> t/Bool :filters {:then (is (t/I t0 t1 t2) 0) :else (! (t/I t0 t1 t2) 0)}]
                          [t/Any :* :-> t/Any])]
              [[t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}] 
               [t/Any :-> t/Bool :filters {:then (is t1 0) :else (! t1 0)}]
               [t/Any :-> t/Bool :filters {:then (is t2 0) :else (! t2 0)}]
               [t/Any :-> t/Bool :filters {:then (is t3 0) :else (! t3 0)}]
               :-> (t/IFn [t/Any :-> t/Bool :filters {:then (is (t/I t0 t1 t2 t3) 0) :else (! (t/I t0 t1 t2 t3) 0)}]
                          [t/Any :* :-> t/Any])]
              [[t/Any :-> t/Bool :filters {:then (is t0 0) :else (! t0 0)}] 
               [t/Any :-> t/Bool :filters {:then (is t1 0) :else (! t1 0)}]
               [t/Any :-> t/Bool :filters {:then (is t2 0) :else (! t2 0)}]
               [t/Any :-> t/Bool :filters {:then (is t3 0) :else (! t3 0)}]
               [t/Any :-> t/Bool :filters {:then (is t4 0) :else (! t4 0)}]
               :-> (t/IFn [t/Any :-> t/Bool :filters {:then (is (t/I t0 t1 t2 t3 t4) 0) :else (! (t/I t0 t1 t2 t3 t4) 0)}]
                          [t/Any :* :-> t/Any])]
              [[t/Any :-> t/Any :filters {:then (is t0 0) :else (! t0 0)}] 
               [t/Any :-> t/Any :filters {:then (is t1 0) :else (! t1 0)}]
               [t/Any :-> t/Any :filters {:then (is t2 0) :else (! t2 0)}]
               [t/Any :-> t/Any :filters {:then (is t3 0) :else (! t3 0)}]
               [t/Any :-> t/Any :filters {:then (is t4 0) :else (! t4 0)}]
               [t/Any :-> t/Any :filters {:then (is t5 0) :else (! t5 0)}]
               :-> (t/IFn [t/Any :-> t/Bool :filters {:then (is (t/I t0 t1 t2 t3 t4 t5) 0) :else (! (t/I t0 t1 t2 t3 t4 t5) 0)}]
                          [t/Any :* :-> t/Any])]
              [(t/+ [t/Any :-> t/Any]) :-> [t/Any :* :-> t/Any]]))

cc/keyword
(t/IFn [(t/U t/Keyword t/Sym t/Str) :-> t/Keyword 
        :object {:id 0 :path [Keyword]}
        :filters {:then tt
                  :else ff}]
       [nil :-> nil 
        :object {:id 0 :path [Keyword]}
        :filters {:then ff
                  :else tt}]
       [t/Any :-> (t/U nil t/Keyword) 
        :object {:id 0 :path [Keyword]}
        :filters {:then (is (t/U t/Keyword t/Sym t/Str) 0)
                  :else (! (t/U t/Keyword t/Sym t/Str) 0)}]
       [(t/Option t/Str) t/Str :-> t/Keyword
        :filters {:then tt
                  :else ff}])

; would be nice
; (t/Pred (t/Not nil))
cc/some? [t/Any :-> t/Bool :filters {:then (! nil 0)
                                    :else (is nil 0)}]

cc/string? (t/Pred t/Str)
cc/char? #?(:clj (t/Pred Character)
            :cljs [t/Any :-> t/Bool :filters {:then (is t/Str 0)}])

 ;would be nice, not quite correct though
; (t/All [x y [m :< (t/Map x y)] k]
;    [(t/Set m) (t/Vec k) :-> (t/Set (t/Map k (Get m k)))])
clojure.set/project (t/All [x y] [(t/Set (t/Map x y)) (t/Vec t/Any) :-> (t/Set (t/Map x y))])
clojure.set/rename (t/All [x y] [(t/Set (t/Map x y)) (t/Map t/Any x) :-> (t/Set (t/Map x y))])
clojure.set/rename-keys (t/All [x y] [(t/Map x y) (t/Map t/Any x) :-> (t/Map x y)])
 ;like filter
clojure.set/select (t/All [x y] (t/IFn [[x :-> t/Any :filters {:then (is y 0)}] (t/Set x) :-> (t/Set y)]
                                       [[x :-> t/Any :filters {:then (! y 0)}] (t/Set x) :-> (t/Set (t/I x (t/Not y)))]
                                       [[x :-> t/Any] (t/Set x) :-> (t/Set x)]))
clojure.set/union (t/All [x] [(t/Set x) :* :-> (t/Set x)])
clojure.set/intersection (t/All [x] [(t/+ (t/Set x)) :-> (t/Set x)])
clojure.set/difference (t/All [x] [(t/Set x) (t/Set t/Any) :* :-> (t/Set x)])
 
; FIXME should be [t/Str [t/Any :-> t/Any] :-> t/Str]
clojure.string/escape [t/Str (t/U (t/Map t/Any t/Any) [t/Any :-> t/Any]) :-> t/Str]
clojure.string/split-lines [t/Str :-> (t/Vec t/Str)]

;cc/every? (t/All [x y] 
;                         (t/IFn [[x :-> t/Any :filters {:then (is y 0)}] (t/Coll x) :-> t/Bool
;                              :filters {:then (is (t/Coll (t/I x y)) 1)}]
;                             ; argument could be nil
;                             [[x :-> t/Any :filters {:then (is y 0)}] (t/U nil (t/Coll x)) :-> t/Bool
;                              :filters {:then (is (t/U nil (t/Coll (t/I x y))) 1)}]
;                             [[x :-> t/Any] (t/Seqable x) :-> t/Bool]))
cc/every? (t/All [x y] (t/IFn [[x :-> t/Any :filters {:then (is y 0)}] (t/Coll x) :-> t/Bool
                               :filters {:then (is (t/Coll y) 1)}]
                              ; argument could be nil
                              [[x :-> t/Any :filters {:then (is y 0)}] (t/U nil (t/Coll x)) :-> t/Bool
                               :filters {:then (is (t/U nil (t/Coll y)) 1)}]
                              [[x :-> t/Any] (t/Seqable x) :-> t/Bool]))

;;TODO clojure.core/not-empty
cc/seq (t/All [[x :< t/AnySeqable]]
              [x :-> (t/SeqOn x) :object {:id 0 :path [Seq]}])
#_(t/All [x] (t/IFn [(t/NonEmptyColl x) :-> (t/NonEmptyASeq x)
                          :filters {:then tt
                                    :else ff}]
                         [(t/Option (t/Coll x)) :-> (t/NilableNonEmptyASeq x)
                          :filters {:then (& (is t/NonEmptyCount 0)
                                             (! nil 0))
                                    :else (| (is nil 0)
                                             (is t/EmptyCount 0))}]
                         [(t/Seqable x) :-> (t/NilableNonEmptyASeq x)]))

cc/empty? (t/IFn [(t/Option (t/HSequential [t/Any :*])) :-> t/Bool
                  :filters {:then (| (is t/EmptyCount 0)
                                     (is nil 0))
                            :else (is t/NonEmptyCount 0)}]
                 [(t/Option (t/Coll t/Any)) :-> t/Bool
                  :filters {:then (| (is t/EmptyCount 0)
                                     (is nil 0))
                            :else (is t/NonEmptyCount 0)}]
                 [t/AnySeqable :-> t/Bool])

cc/first (t/All [x] (t/IFn [(t/HSequential [x t/Any :*]) :-> x
                            :object {:id 0 :path [(Nth 0)]}]
                           [(t/EmptySeqable x) :-> nil]
                           [(t/NonEmptySeqable x) :-> x]
                           [(t/Seqable x) :-> (t/Option x)]))
cc/second (t/All [x] (t/IFn [(t/HSequential [t/Any x t/Any :*]) :-> x
                             :object {:id 0 :path [(Nth 1)]}]
                            [(t/Option (t/I (t/Seqable x) (t/CountRange 0 1))) :-> nil]
                            [(t/I (t/Seqable x) (t/CountRange 2)) :-> x]
                            [(t/Seqable x) :-> (t/Option x)]))
cc/ffirst (t/All [x] [(t/Seqable (t/Seqable x)) :-> (t/Nilable x)])
cc/nfirst (t/All [x] [(t/Seqable (t/Seqable x)) :-> (t/NilableNonEmptyASeq x)])
cc/group-by (t/All [x y] [[x :-> y] (t/Seqable x) :-> (t/Map y (t/NonEmptyAVec x))])
cc/fnext (t/All [x] [(t/Seqable x) :-> (t/Option x)])
cc/nnext (t/All [x] [(t/Seqable x) :-> (t/NilableNonEmptyASeq x)])
cc/nthnext (t/All [x] (t/IFn [nil t/AnyInteger :-> nil]
                             [(t/Seqable x) t/AnyInteger :-> (t/NilableNonEmptyASeq x)]))
cc/rest (t/All [x] [(t/Seqable x) :-> (t/ASeq x)])
cc/last (t/All [x] (t/IFn [(t/NonEmptySeqable x) :-> x]
                          [(t/Seqable x) :-> (t/U nil x)]))
cc/butlast (t/All [x] [(t/Seqable x) :-> (t/NilableNonEmptyASeq x)])
cc/next (t/All [x] (t/IFn [(t/Option (t/Coll x)) :-> (t/NilableNonEmptyASeq x)
                           :filters {:then (& (is (t/CountRange 2) 0)
                                              (! nil 0))
                                     :else (| (is (t/CountRange 0 1) 0)
                                              (is nil 0))}]
                          [(t/Seqable x) :-> (t/NilableNonEmptyASeq x)]))

cc/integer? (t/Pred t/AnyInteger)
cc/int? (t/Pred #?(:clj (t/U Long
                             Integer
                             Short
                             Byte)
                   :cljs (t/U t/CLJSInteger
                              goog.math.Integer
                              goog.math.Long)))
cc/pos-int? [t/Any :-> t/Bool
             :filters {:then (is #?(:clj (t/U Long
                                              Integer
                                              Short
                                              Byte)
                                    :cljs (t/U t/CLJSInteger
                                               goog.math.Integer
                                               goog.math.Long)) 0)}]
cc/neg-int? [t/Any :-> t/Bool
             :filters {:then (is #?(:clj (t/U Long
                                              Integer
                                              Short
                                              Byte)
                                    :cljs (t/U t/CLJSInteger
                                               goog.math.Integer
                                               goog.math.Long)) 0)}]
cc/nat-int? [t/Any :-> t/Bool
             :filters {:then (is #?(:clj (t/U Long
                                              Integer
                                              Short
                                              Byte)
                                    :cljs (t/U t/CLJSInteger
                                               goog.math.Integer
                                               goog.math.Long)) 0)}]
cc/number? (t/Pred t/Num)
cc/double? (t/Pred #?(:clj Double
                      :cljs t/Num))
cc/float? (t/Pred #?(:clj (t/U Double Float)
                     :cljs t/Num))
cc/ident? (t/Pred t/Ident)
cc/simple-ident? [t/Any :-> t/Bool :filters {:then (is t/Ident 0)}]
cc/qualified-ident? [t/Any :-> t/Bool :filters {:then (is t/Ident 0)}]
cc/simple-symbol? [t/Any :-> t/Bool :filters {:then (is t/Sym 0)}]
cc/qualified-symbol? [t/Any :-> t/Bool :filters {:then (is t/Sym 0)}]
cc/simple-keyword? [t/Any :-> t/Bool :filters {:then (is t/Kw 0)}]
cc/qualified-keyword? [t/Any :-> t/Bool :filters {:then (is t/Kw 0)}]
cc/var? (t/Pred t/AnyVar)