Skip to content

Fragments

Andrew Johnson edited this page Oct 2, 2024 · 30 revisions

Fragments are the main data structure in the compiler used to represent code objects as they are rendered. A Fragment is modelled as a map from Strings to S-Expressions.

Fragments are available transparently to the type-system, compiler, AND the programmer. Fragments may be used to model a wide variety of code objects, so the data structure is fundamentally dynamic.

What is a Blob?

A blob function is a function that will become a fragment directly when called. Blob can be annotated to any function as a calling convention. The Blob calling convention can be described as an idiomatic "inline" calling convention.

f := λ: Blob(: x X). (
   (:program x)
   (:frame x)
   (:unframe x)
);

Here the x and y arguments are destructured as individual fragments to create another fragment which will become the result of applying the f function.

Clone this wiki locally