Skip to Content
ReferencetupleList

<tupleList>

A list of math tuples, parsed from parenthesized comma-separated pieces

<tupleList> is a math-list component that stores a list of math tuples β€” parenthesized, comma-separated groups such as (1, 2) or (a, b, c). It is a specialized form of <mathList> in which each list item must be written as a parenthesized group.

When creating a <tupleList>, separate items by spaces, not commas. The component will default to displaying the list with commas. (The commas inside each pair of parentheses are part of one tuple, not separators between items.)

Because <tupleList> extends <mathList>, all of the attributes and properties of <mathList> are also available here (unordered, maxNumber, asList, mergeMathLists, numComponents, latex, text, etc.).

Attributes and Properties

Attributes for <tupleList>

Highlighted (1)
asList

boolean. Default value: true. Whether to render the items separated by commas (true) or with no separator (false).

Number display (5)
avoidScientificNotationAdded in 0.7.16

boolean. Default value: false. Whether to render numbers in full decimal form rather than scientific notation.

displayDecimals

integer. Default value: 2. Number of decimal places to display when rendering this number.

displayDigits

integer. Default value: 3. Number of significant digits to display when rendering this number.

displaySmallAsZero

number. Default value: 1e-14. Threshold below which numbers are displayed as zero.

padZeros

boolean. Default value: false. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.

Other (7)
functionSymbols

textList. Default value: ["f","g"]. Symbols treated as function names when parsing items.

number. Default value: Infinity. Maximum number of items to retain in the list.

mergeMathLists

boolean. Whether nested math-list children should be flattened into this list.

parseScientificNotation

boolean. Default value: false. Whether to parse expressions like 1e3 as scientific notation.

referencesAreFunctionSymbols

reference. References whose names should be treated as function symbols when parsing items.

splitSymbols

boolean. Default value: true. Whether multi-character symbols are split into a product of variables.

boolean. Default value: false. Whether the order of items in this list should be treated as unordered (e.g. for matching).

Common to all components (9)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

hide

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. Default value: 1. The style number used to select this component's visual styling from the available style definitions.

Properties for <tupleList name="t">

Number display (5)
$t.avoidScientificNotationIn development

boolean. Whether to render numbers in full decimal form rather than scientific notation.

$t.displayDecimalsIn development

integer. Number of decimal places to display when rendering this number.

$t.displayDigitsIn development

integer. Number of significant digits to display when rendering this number.

$t.displaySmallAsZeroIn development

number. Threshold below which numbers are displayed as zero.

$t.padZerosIn development

boolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.

Other (8)
$t.functionSymbols

textList. Symbols treated as function names when parsing items.

$t.maxNumber

number. Maximum number of items to retain in the list.

$t.mergeMathLists

boolean. Whether nested math lists are merged into the parent list.

$t.numComponents

number. The number of items in the list.

$t.numValues

number. The number of values in the list.

$t.parseScientificNotation

boolean. Whether to parse expressions like 1e3 as scientific notation.

$t.splitSymbols

boolean. Whether multi-character symbols are split into a product of variables.

$t.unordered

boolean. Whether the order of items in this list should be treated as unordered (e.g. for matching).

Common to all components (8)
$t.disabledIn development

boolean. Whether this component is disabled and cannot be interacted with.

$t.doenetML

text. The DoenetML source code that produced this component.

$t.fixedIn development

boolean. Whether this component's value is fixed and cannot be modified.

$t.fixLocationIn development

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$t.hiddenIn development

boolean. Whether this component is hidden from the rendered output.

$t.hide

boolean. Whether to hide this component from the rendered output.

$t.isResponseIn development

boolean. Whether this component is treated as a response for the purposes of assessment.

$t.styleNumber

integer. The style number used to select this component's visual styling from the available style definitions.

Examples

Example: Defining a <tupleList> and retrieving a tuple

Each parenthesized group becomes one math tuple. Spaces between the groups separate the items; the commas inside each (...) are part of one tuple. Individual tuples are accessed by index.


Example: A <tupleList> of 3-tuples

Tuples may have any number of components. Each tuple is itself a math expression and its components can be indexed individually.


Example: Mixed-arity items

The items in a <tupleList> do not need to share the same arity or the same content type.

Attribute Examples

Attribute Example: unordered

The unordered attribute makes comparisons (e.g., inside a <boolean> or an <award>) ignore the order of the items.


Attribute Example: maxNumber

The maxNumber attribute limits the number of tuples retained in the list, regardless of how many are supplied.

Comparison with <mathList>

The difference between <tupleList> and <mathList> is in how the children are parsed:

  • <mathList>x y z</mathList> β†’ a list of 3 maths (x, y, z). Commas inside the body would create a single tuple math instead.
  • <tupleList>(1, 2) (3, 4)</tupleList> β†’ a list of 2 tuples ((1,2), (3,4)). Non-parenthesized text is not accepted as an item.

Use <tupleList> when every item must be a tuple β€” for example, a list of coordinate pairs that should not specifically be a list of <point> or <interval> components.

Last updated on