11 Code as Picts
import: pict/rhombus | package: rhombus-pict-lib |
The pict/rhombus library provides a rhombus form form rendering literal shrubbery forms as a pict.
expression | ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
expression | ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
|
Within form, #, followed by a parenthesized expression is an escape where the expression must produce a pict. The pict is rendered in place of the escape.
If space is provided as ~var, then form is italicized. If space is ~datum, then form does not get a color. If space is ~value or ~result, then a corersponding uniform color is applied. Any other space determines the initial space for rendering form sensitive to meta_label imports.
> rhombus(arg, ~var)
> rhombus(3, ~result)
expression | |
|
Use rhombusblock with @ notation (see At-Notation Using @) to avoid the need to include , between multiple groups that are on separate lines.
> @rhombusblock(
// This is an example function:
fun add1(n):
n + 1
)
expression | |||
| |||
| |||
expression | |||
|
> rhombusblock_etc(~escape: $$):
// example use of `rhombusblock`
check: add1(#,(n))
~is #,(res)
)
context parameter | ||
| ||
| ||
context parameter | ||
| ||
| ||
context parameter | ||
| ||
| ||
context parameter | ||
| ||
| ||
context parameter | ||
| ||
| ||
context parameter | ||
| ||
| ||
context parameter | ||
The value of current_rhombus_tt is a function that takes a string and produces a pict for a shrubbery element. The result may be colorized, and the current font may have been adjusted to italic for ~var mode.