Structured output
Keep tables, documents, slides, and graphics meaningful across RiX hosts.
Most expressions return a number, string, array, or map. An output value carries an additional promise about how it should be presented. A table remains a table, a plotted curve remains a graphic, and a report remains a sequence of document parts. That lets the CLI, RiX Web, and a notebook choose an appropriate renderer without asking your calculation to produce HTML or SVG itself.
Output is still a value
Create an output value with a system constructor, bind it like any other value, then return it. RiX Web renders this small table as a table; a text-only host can still show the same headers and rows faithfully.
The value is portable data, not a browser widget. Keep the calculation that produces it separate from the choice to show it here, in a report, or in a future export.
Choose the shape that matches the meaning
- Use
.Tablefor labeled rows and columns of data. - Use
.Gridwhen spacing and rules are part of mathematical notation. - Use
.Fragment,.Heading,.Paragraph, and.Figurefor documents. - Use
.Slideand.Slidesfor an ordered presentation. - Use core
.Graphicsplus optional.plotand.drawplugins for portable two-dimensional scenes.
The following lessons give each of these forms enough room to explore. Start with tables and grids if your output is primarily data; go straight to Drawing with .Graphics and .draw when you want to construct a diagram from shapes.
One calculation, several destinations
This polynomial is ordinary exact RiX data. The next lessons will use the same coefficient array both in a table and in a graphic.