Form

is a representation of a Carp source-form AST. Every form in Carp source maps to one Form variant

Arr

instantiate

(Fn [(Array (Box Form))] Form)

creates a Arr.

Bol

instantiate

(Fn [Bool] Form)

creates a Bol.

Byt

instantiate

(Fn [Byte] Form)

creates a Byt.

Chr

instantiate

(Fn [Char] Form)

creates a Chr.

Cmt

instantiate

(Fn [String] Form)

creates a Cmt.

Dbl

instantiate

(Fn [Double] Form)

creates a Dbl.

Dict

instantiate

(Fn [(Array (Box Form))] Form)

creates a Dict.

Flt

instantiate

(Fn [Float] Form)

creates a Flt.

Itg

instantiate

(Fn [Int] Form)

creates a Itg.

Lng

instantiate

(Fn [Long] Form)

creates a Lng.

Lst

instantiate

(Fn [(Array (Box Form))] Form)

creates a Lst.

Pat

instantiate

(Fn [String] Form)

creates a Pat.

StaticArr

instantiate

(Fn [(Array (Box Form))] Form)

creates a StaticArr.

Str

instantiate

(Fn [String] Form)

creates a Str.

Sym

instantiate

(Fn [(Array String)] Form)

creates a Sym.

copy

instantiate

(Fn [(Ref Form a)] Form)

copies a Form.

delete

instantiate

(Fn [Form] ())

deletes a Form. This should usually not be called manually.

get-tag

instantiate

(Fn [(Ref Form a)] Int)

Gets the tag from a Form.

prn

instantiate

(Fn [(Ref Form a)] String)

converts a Form to a string.

str

defn

(Fn [(Ref Form a)] String)

                        (str a)
                    

renders an Form back to source-like text. Round-trips for syntactic content; whitespace around comments is left to the caller's formatting pass.