CompoundElement

CompoundElement[{spec1,spec2,}]

represents a form or interpreter specification for a list of fields or inputs that gives a list of results.

CompoundElement[key1spec1,key2spec2,]

represents a form or interpreter specification that gives an association of results.

Details

  • In the context of Interpreter, speci can be any specification used for Interpreter, including CompoundElement or RepeatingElement.
  • In the context of FormObject and FormFunction, speci can be any specification used for forms, including the full association, but only simple structures can be visualized as a table of fields.
  • Interpreter[CompoundElement[{form1,form2,}][{input1,input2,}] is effectively equivalent to {Interpreter[form1][input1],Interpreter[form2][input2],}.
  • In Interpreter[CompoundElement[{form1,form2,}][{input1,input2,}], the list of inputi must be the same length as the list of formi. If it is not, a Failure object is generated.
  • The result from Interpreter[CompoundElement[<|key1->spec1,|>][input] is an association that contains elements for each of the keyi. If input is a list, each successive keyi is used in order. If input is an association, any keyi missing from it is returned as a missing element, and any value associated with a key that is not one of the keyi is dropped.
  • Any of the speci can themselves be CompoundElement or RepeatingElement objects.

Examples

open allclose all

Basic Examples  (4)

Use CompoundElement to combine Interpreter calls of any kind:

Use CompoundElement to speed up Interpreter by grouping calls that require connectivity to the Wolfram Cloud:

CompoundElement will fail on data that does not have the correct shape:

Use in a form to create a row of fields:

The result will be a nested association:

Applications  (2)

Interpret data that has a complex structure:

Use an association input to coerce the data to the right shape:

Properties & Relations  (3)

Use CompoundElement with RepeatingElement to interpret even more complicated structures:

Use with RepeatingElement in the context of FormFunction to generate a table of fields:

Use CompoundElement in conjunction with Alternatives to interpret data that can have different shapes:

Wolfram Research (2015), CompoundElement, Wolfram Language function, https://reference.wolfram.com/language/ref/CompoundElement.html.

Text

Wolfram Research (2015), CompoundElement, Wolfram Language function, https://reference.wolfram.com/language/ref/CompoundElement.html.

CMS

Wolfram Language. 2015. "CompoundElement." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CompoundElement.html.

APA

Wolfram Language. (2015). CompoundElement. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CompoundElement.html

BibTeX

@misc{reference.wolfram_2024_compoundelement, author="Wolfram Research", title="{CompoundElement}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/CompoundElement.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_compoundelement, organization={Wolfram Research}, title={CompoundElement}, year={2015}, url={https://reference.wolfram.com/language/ref/CompoundElement.html}, note=[Accessed: 22-December-2024 ]}