Size

The type of things with some fixed size.

Sizes larger than Zero are represented by nested applications of Size.

For example, things of size 2 are typed: (Size (Size Zero))

Functions that rely on information about the size or length of a structure are implemented in terms of Size and Zero.

copy

template

(Fn [(Ref (Size a) b)] (Size a))

copies a (Size s).

delete

template

(Fn [(Size a)] ())

deletes a (Size s). Should usually not be called manually.

empty?

defn

(Fn [(Ref (Vector (Size a) b) c)] Bool)

                    (empty? v)
                

get-tag

instantiate

(Fn [(Ref (Size a) b)] Int)

Gets the tag from a Size.

len

defn

(Fn [(Ref (Vector (Size a) b) c)] Int)

                    (len v)
                

prn

template

(Fn [(Ref (Size a) b)] String)

stringifies a "Size".

replicate

defn

(Fn [a] (Vector (Size b) a))

                    (replicate x)
                

size

macro

Macro

                    (size n)
                

Size types can be quite a pain to type out in full, as the rely on significant nesting.

The size macro generates an appropriate Size based on an integer value, and
may be used to generate a size type in functions signatures and macros.

str

template

(Fn [(Ref (Size a) b)] String)

stringifies a "Size".