Public Vars

Back

distinct (clj)

(source)

function

(distinct) (distinct coll)
Returns a lazy sequence of the elements of coll with duplicates removed. Returns a stateful transducer when no collection is provided.

Examples

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/distinct (t/All [x] (t/IFn [:-> (t/Transducer x x)]
                              [(t/Seqable x) :-> (t/ASeq x)]))

cc/= [(t/+ t/Any) :-> t/Bool]
cc/identical? [t/Any t/Any :-> t/Bool]
#?@(:cljs [
cc/keyword-identical? [t/Any t/Any :-> t/Bool]
])
cc/distinct? [(t/+ t/Any) :-> t/Bool]
Quantisan/docker-clojure
(ns docker-clojure.config
  (:require [clojure.spec.alpha :as s]
            [clojure.string :as str]
            [docker-clojure.core :as-alias core]))

(s/def ::jdk-version
  (s/and pos-int? #(<= 8 %)))
(s/def ::jdk-versions (s/coll-of ::jdk-version :distinct true :into #{}))

(s/def ::base-image ::non-blank-string)
(s/def ::base-images (s/coll-of ::base-image :distinct true :into #{}))

(s/def ::distro qualified-keyword?)
(s/def ::distros (s/coll-of ::distro :distinct true :into #{}))

(s/def ::maintainers
  (s/coll-of ::non-blank-string :distinct true :into #{}))

(s/def ::architecture ::non-blank-string)
(s/def ::architectures (s/coll-of ::architecture :distinct true :into #{}))
ReilySiegel/EQLizr
(ns eqlizr.impl.sheets
  (:require [eqlizr.database :as database]
            [eqlizr.resolvers :as resolvers]
            [clojure-sheets.core :as sheets]
            [clojure-sheets.key-fns :as sheets.key-fns]
            [com.wsscode.pathom.core]
            [com.wsscode.pathom.connect :as pc]
            [eqlizr.impl.keyword :as k]
            [clojure.core.async :as a]))

(defmethod database/column-map :sheets
  [{::sheets/keys   [id page key-fn unique-keys primary-key]
    ::database/keys [columns]
    :or             {page        1
                     key-fn       sheets.key-fns/idiomatic-keyword
                     primary-key ::sheets/row
                     unique-keys #{}
                     columns     #?(:clj (into []
                                               (comp (map first)
                                                     (map key-fn))
                                               (a/<!! (sheets/sheet->vecs
                                                       id
                                                       {:page  page
                                                        :key-fn key-fn})))
                                    :cljs [])}}]
  (reduce
   (fn [acc column]
     (assoc acc column
            {:column/name         column
             :column/unique?      (or (= column primary-key)
                                      (unique-keys column))
             :column/primary-key? (= column primary-key)}))
   {}
   ;; Ensure row  is in columns, in case columns are user-specified.
   (distinct (conj columns ::sheets/row))))
reborg/clojure-essential-reference
(ns myns (:require [clojure.pprint :refer [pprint]]))
(pprint (ns-map 'myns)) ; <1>
;; {primitives-classnames #'clojure.core/primitives-classnames,
;;  +' #'clojure.core/+',
;;  Enum java.lang.Enum,
;;  decimal? #'clojure.core/decimal?,
;;  restart-agent #'clojure.core/restart-agent,
;;  sort-by #'clojure.core/sort-by,
...

(distinct (map #(map type %) (ns-map 'myns)))
;; ((clojure.lang.Symbol clojure.lang.Var)
;;  (clojure.lang.Symbol java.lang.Class))
Netflix/mantis-mql
   Finally MQL also provides an 'any' search for handling unknown property
   locations:
   `select * from stream where e['falcor.paths'][*]['path'] == 'search'`"
  (:require [clojure.test :refer :all]
            [io.mantisrx.mql.jvm.core :as mql]
            [io.mantisrx.mql.transformers :as t]
            [rx.lang.clojure.core :as rx]
            [rx.lang.clojure.blocking :as rxb]
            [io.mantisrx.mql.properties :as mqlp])
  (:import rx.Observable java.util.concurrent.TimeUnit))

(deftest distinct-count-correctly-counts
  (testing "select COUNT(distinct node) from stream correctly computes
            disinct count of nodes."
    (let
      [q "select COUNT(distinct node) from stream"
       context {"stream" (Observable/from (conj data {"node" 1}))}
       result (rxb/into [] (mql/eval-mql q context))]
      (is (= {"COUNT(node)" 3})))))