Public Vars

Back

partition-by (clj)

(source)

function

(partition-by f) (partition-by f coll)
Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of partitions. 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/partition-by (t/All [x] (t/IFn [[x :-> t/Any] :-> (t/Transducer x (t/NonEmptyAVec x))]
                                  [[x :-> t/Any] (t/Seqable x) :-> (t/ASeq (t/NonEmptyASeq x))]))