tur/rc
reference-counted pointer (rc<T>) for shared ownership.
rc<T> is an owning handle; rc-clone increments the count, rc-drop decrements.
Since: Phase 9
rc-payload
(rc-payload [A])
read the value stored in an rc<A>.
Borrows its handle, so reading does not consume the caller's rc. v1 assumes the payload is a plain int64_t carrier.
| r | the rc<A> to read (borrowed, not consumed) |
The contained value. Zero for a null handle.
(let [r (rc/of 7)] (println (rc-payload r))) ; => 7
Since: Phase HKT S6
Functor[rc]
(definstance Functor [rc])
Functor instance for rc<T>.
Since: Phase HKT H3
Foldable
(defclass Foldable [^t])
containers that can be reduced to a single summary value.
| ^t | the container's type constructor (kind * -> *) |
(foldl [ta :(t a) init :b fn :(fn [b a] b)] :b)-
combine the elements of
tafirst to last, starting frominit (foldr [ta :(t a) init :b fn :(fn [a b] b)] :b)-
combine the elements of
talast to first, ending ininit
The same class stdlib/typeclass.tur declares; declared here too so rc.tur stays standalone. An rc holds one value x, so its instance below is (fn init x) for foldl and (fn x init) for foldr.
Since: Phase HKT S6
Foldable[rc]
(definstance Foldable [rc])
Foldable instance for rc<T>.
Since: Phase HKT S6
Clone[rc]
(definstance Clone [rc])
shallow-clone a TY_RC value by incrementing the strong refcount.
Since: Phase B1