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.
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 all close allBasic Examples (4)
Use CompoundElement to combine Interpreter calls of any kind:
Interpreter[CompoundElement[{"GivenName", {"home", "office", "mobile"}, "PhoneNumber"}]][{{"Alice", "home", "+44 020 1234 5678"}, {"Bob", "mobile", "+1 (202) 456-1111"}}]Use CompoundElement to speed up Interpreter by grouping calls that require connectivity to the Wolfram Cloud:
Interpreter[CompoundElement[{"City", "Country", "Integer"}]][{"rome", "italy", "4"}]CompoundElement will fail on data that does not have the correct shape:
Interpreter[CompoundElement[{"Integer", "ComplexNumber"}]][{"2"}]Use in a form to create a row of fields:
CloudDeploy[FormFunction["name" -> CompoundElement[{"first" -> "String", "last" -> "String"}]]]Applications (2)
Interpret data that has a complex structure:
Interpreter[CompoundElement[<|"location" -> CompoundElement[{"City", "USState"}], "singer" -> "MusicAct", "song" -> "MusicWork"|>]][<|"location" -> {"memphis", "tennessee"}, "singer" -> "elvis", "song" -> "hound dog"|>]Use an association input to coerce the data to the right shape:
Interpreter[CompoundElement[<|"x" -> "Real", "y" -> "Real"|>]][{"12.4", "-5"}]Interpreter[CompoundElement[<|"x" -> "Real", "y" -> "Real"|>]][<|"y" -> "12.4", "x" -> "-5"|>]Properties & Relations (3)
Use CompoundElement with RepeatingElement to interpret even more complicated structures:
Interpreter[CompoundElement[<|"numbers" -> RepeatingElement["Integer"], "fruit" -> RepeatingElement[{"apple" -> "pomme", "orange" -> "orange", "grapefruit" -> "pamplemousse"}]|>]][<|"numbers" -> {"1", "14", "-4"}, "fruit" -> {"apple", "pomme", "grapefruit"}|>]Use with RepeatingElement in the context of FormFunction to generate a table of fields:
CloudDeploy[FormFunction["names" -> RepeatingElement[CompoundElement[<|"first" -> "String", "last" -> "String"|>]]]]Use CompoundElement in conjunction with Alternatives to interpret data that can have different shapes:
Interpreter[CompoundElement[{"City", "USState"}] | "City"]["bangkok"]Interpreter[CompoundElement[{"City", "USState"}]][{"trenton", "indonesia" | "NJ"}]History
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_2026_compoundelement, author="Wolfram Research", title="{CompoundElement}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/CompoundElement.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_compoundelement, organization={Wolfram Research}, title={CompoundElement}, year={2015}, url={https://reference.wolfram.com/language/ref/CompoundElement.html}, note=[Accessed: 12-June-2026]}