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:

In[1]:=
Click for copyable input
Out[1]=

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

In[1]:=
Click for copyable input
Out[1]=

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

In[1]:=
Click for copyable input
Out[1]=

Use in a form to create a row of fields:

In[1]:=
Click for copyable input
Out[1]=

The result will be a nested association:

Applications  (2)

Properties & Relations  (3)

See Also

Interpreter  DelimitedSequence  RepeatingElement  List  Association  FormFunction

Introduced in 2015
(10.1)