std/persistent

模块 zio.persistent — Persistent (immutable) collections · 6 个符号

Immutable operations built on Zio's persistent im::Vector and im::HashMap.

Status: Experimental. All functions are runnable; map iteration order (and therefore merge/set ordering) is not defined.

概览

conj

(defn conj [coll x] …)

(conj coll x) → collection with x added: vector → append, map → (put coll k v) from a [k v] entry, list → prepend.

pop

(defn pop [coll] …)

(pop coll) → collection without its last/first element: vector drops the tail, list drops the head, other values pass through.

peek

(defn peek [coll] …)

(peek coll) → last element of a vector or first of a list, else nil.

merge

(defn merge [& maps] …)

(merge & maps) → left-to-right key merge; later maps override earlier ones; non-map arguments are ignored.

contains?

(defn contains? [s item] …)

(contains? s item) → true when the map-backed set holds item. The set literal #{...} and (set ...) come from the bootstrap stdlib.

disj

(defn disj [s & items] …)

(disj s & items) → set with each item removed; non-sets pass through.