;;;; A container holding four different types at once. ;;;; ;;;; (vec-new dyn) is not a (Vec dyn) — it is the dyn runtime's own vector, and ;;;; its type is dyn like everything else the runtime hands back. That is what ;;;; lets push, at and len on it be the dyn operations rather than a ;;;; type-erased Vec over eight-byte elements, and it is why no allocator is ;;;; named: the storage is the collector's to walk. (defn main [] () (let [xs (vec-new dyn)] (push xs 1) (push xs 2.5) (push xs "three") (push xs true) (print (len xs)) (print "\n") (print xs) (print "\n") ;; Read back out one at a time, to show that at answers a dyn and that the ;; four of them are still four different things. (dotimes [i (len xs)] (print (at xs i)) (print " ")) (print "\n")))