Public Vars

Back

boolean (clj)

(source)

function

(boolean x)
Coerce to boolean

Examples

clj-commons/manifold
(ns manifold.stream.async
  {:no-doc true}
  (:require
    [manifold.deferred :as d]
    [clojure.core.async :as a]
    [manifold.stream
     [graph :as g]
     [core :as s]]
    [manifold
     [executor :as executor]
     [utils :as utils]])
  (:import
    [java.util.concurrent.atomic
     AtomicReference]))

        :else
        (let [d  (d/deferred)
              d' (.getAndSet last-put d)
              f  (fn [_]
                   (a/go
                     (d/success! d
                                 (boolean
                                   (a/>! ch x)))))]
          (if (d/realized? d')
            (f nil)
            (d/on-realized d' f f))
          d))))
arohner/spectrum
(ns spectrum.core-specs
  (:require [clojure.core :as core]
            [clojure.spec.alpha :as s]
            [spectrum.core :as st]
            [spectrum.types :as t]
            [spectrum.util :refer [def-instance-predicate]]))

(st/var-spec #'clojure.core/*ns* #'namespace?)
(st/var-spec #'clojure.core/*file* #'string?)
(st/var-spec #'clojure.core/*print-dup* #'boolean?)
(st/var-spec #'clojure.core/*unchecked-math* #'boolean?)
(st/var-spec #'clojure.core/*agent* (t/or-t [(t/class-t clojure.lang.Agent) (t/value-t nil)]))
(st/var-spec #'clojure.core/*warn-on-reflection* #'boolean?)

(st/var-spec #'clojure.core/*flush-on-newline* #'boolean?)
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))))

(t/defalias
  ^{:doc "A boolean"
    :forms '[Bool]}
  t/Bool
  #?(:clj java.lang.Boolean
     :cljs t/JSboolean))


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

cc/seq? (t/Pred (t/Seq t/Any))
cc/set? (t/Pred (t/Set t/Any))
cc/vector? (t/Pred (t/Vec t/Any))
cc/nil? (t/Pred nil)
#?@(:cljs [
cc/undefined? (t/Pred t/JSundefined)
])
cc/false? (t/Pred false)
cc/true? (t/Pred true)
cc/symbol? (t/Pred t/Sym)
cc/keyword? (t/Pred t/Keyword)
cc/map? (t/Pred (t/Map t/Any t/Any))
cc/boolean? (t/Pred t/Bool)
cc/any? [t/Any :-> true]
cc/record? (t/Pred #?(:clj clojure.lang.IRecord
                      :cljs cljs.core/IRecord))

;coercions
#?@(:cljs [] :default [
cc/bigdec [(t/U t/Str t/Num) :-> BigDecimal]
cc/bigint [(t/U t/Str t/Num) :-> clojure.lang.BigInt]
cc/biginteger [(t/U t/Str t/Num) :-> java.math.BigInteger]
])
cc/boolean [t/Any :-> t/Bool]
cc/parse-boolean [t/Str :-> (t/Option t/Bool)]
cc/byte [(t/U Character t/Num) :-> Byte]
#?@(:cljs [
cc/char [(t/U t/Str t/Num) :-> t/Str]
] :default [
cc/char [(t/U Character t/Num) :-> Character]
])
cc/double [t/Num :-> #?(:cljs t/Num :default Double)]
cc/parse-double [t/Str :-> (t/Option #?(:cljs t/Num :default Double))]

;array ctors
#?@(:cljs [] :default [
cc/boolean-array (t/IFn [(t/U t/Num (t/Seqable t/Bool)) :-> (Array boolean)]
                        [t/Num (t/U t/Bool (t/Seqable t/Bool)) :-> (Array boolean)])
cc/byte-array (t/IFn [(t/U t/Num (t/Seqable Byte)) :-> (Array byte)]
                     [t/Num (t/U Byte (t/Seqable Byte)) :-> (Array byte)])
cc/char-array (t/IFn [(t/U t/Num (t/Seqable Character)) :-> (Array char)]
                     [t/Num (t/U t/Num (t/Seqable Character)) :-> (Array char)])
cc/short-array (t/IFn [(t/U t/Num (t/Seqable Short)) :-> (Array short)]
                      [t/Num (t/U Short (t/Seqable Short)) :-> (Array short)])
cc/int-array (t/IFn [(t/U t/Num (t/Seqable t/Num)) :-> (Array int)]
                    [t/Num (t/U t/Num (t/Seqable t/Num)) :-> (Array int)])
cc/double-array (t/IFn [(t/U t/Num (t/Seqable t/Num)) :-> (Array double)]
                       [t/Num (t/U t/Num (t/Seqable t/Num)) :-> (Array double)])
])

;cast to java array
;; TODO rethink input and output types. eg.,
;;      cc/booleans [(ReadyOnlyArray boolean) :-> (t/U nil (Array boolean))]
;; TODO objects??
;;      cc/objects [(ReadyOnlyArray Object) :-> (t/U nil (ReadyOnlyArray Object))]
;;                                  
;; TODO propagate to Numbers/booleans etc
;cc/booleans [t/Any :-> (t/U nil (Array boolean))]
;cc/bytes [t/Any :-> (t/U nil (Array byte))]
;cc/chars [t/Any :-> (t/U nil (Array char))]
;cc/shorts [t/Any :-> (t/U nil (Array short))]
;cc/ints [t/Any :-> (t/U nil (Array int))]
;cc/longs [t/Any :-> (t/U nil (Array long))]
;cc/floats [t/Any :-> (t/U nil (Array float))]
;cc/doubles [t/Any :-> (t/U nil (Array double))]
bsless/more.async
(ns more.async.dataflow.node
  (:require
   [clojure.spec.alpha :as s]
   [clojure.core.async :as a]
   [more.async :as ma]
   [clojure.data]))

(s/def ::to ::name)
(s/def ::to* (s/* ::to))
(s/def ::to-map (s/map-of any? ::to))
(s/def ::from ::name)
(s/def ::size nat-int?)
(s/def ::xf fn?)
(s/def ::rf fn?)
(s/def ::fn fn?)
(s/def ::init-fn fn?)
(s/def ::async? boolean?)
(s/def ::timeout pos-int?)

(s/def ::checked? boolean?)
(s/def ::consume (s/keys :req [::from ::fn] :opt [::async? ::checked?]))

(s/def ::split (s/keys :req [::from ::to-map ::fn] :opt [::dropping?]))
(s/def ::dropping? boolean?)
liquidz/merr
(ns merr.spec
  (:require
   [clojure.core.specs.alpha :as c.s]
   [clojure.spec.alpha :as s]
   [merr.core :as core]))

(s/fdef core/error?
  :args (s/cat :x any?)
  :ret boolean?)