RepeatingElement[spec]
represents an arbitrarily repeated type of element in an interpreter, API or form specification.
RepeatingElement[spec,max]
represents an element that can appear at most max times.
RepeatingElement[spec,{min,max}]
represents an element that can appear between min and max times.
RepeatingElement[spec,{n,{min,max}}]
represents an element that initially appears n times in a form.
RepeatingElement[spec,{{i,n},{min,max}}]
represents an element where i takes successive values.
RepeatingElement
RepeatingElement[spec]
represents an arbitrarily repeated type of element in an interpreter, API or form specification.
RepeatingElement[spec,max]
represents an element that can appear at most max times.
RepeatingElement[spec,{min,max}]
represents an element that can appear between min and max times.
RepeatingElement[spec,{n,{min,max}}]
represents an element that initially appears n times in a form.
RepeatingElement[spec,{{i,n},{min,max}}]
represents an element where i takes successive values.
Details
- In the context of Interpreter, spec can be any specification used for Interpreter, including CompoundElement or RepeatingElement.
- In the context of FormObject and FormFunction, spec can be any specification used for forms, including the full association and CompoundElement.
- If no minimum repeat is specified, RepeatingElement initially represents a single element in a form.
- Interpreter[RepeatingElement[spec]][input] is effectively equivalent to Interpreter[spec][input], since Interpreter automatically lists on input.
- RepeatingElement can appear nested inside a CompoundElement specification in the context of Interpreter.
Examples
open all close allBasic Examples (5)
RepeatingElement can be used in FormFunction to repeat a field:
FormFunction["field" -> RepeatingElement["String"]][]RepeatingElement fields can also be filled programmatically:
api = APIFunction["field" -> RepeatingElement["City"], f];
api["field" -> {"helsinki", "goteborg"}]api["field[1]" -> "oslo"]In an APIFunction, RepeatingElement specifies that all instances of a particular parameter should be used:
APIFunction[{"x" -> RepeatingElement["Integer"]}, #x ^ 2&][{"x" -> 2, "x" -> 3}]Without RepeatingElement, only the last instance is used:
APIFunction[{"x" -> "Integer"}, #x ^ 2&][{"x" -> 2, "x" -> 3}]Interpreter threads over lists, so RepeatingElement is not needed here:
Interpreter[RepeatingElement["Integer"]][{"1", "2", "5"}]Interpreter["Integer"][{"1", "2", "5"}]This interprets lists containing a single integer and a repeating list of integers:
Interpreter[CompoundElement[{"Integer", RepeatingElement["Integer"]}]][{"6", {"1", "2", "3"}}]RepeatingElement can be used to limit the number of elements:
Interpreter[RepeatingElement["Integer", 2]][{"1", "7"}]Interpreter[RepeatingElement["Integer", 2]][{"1", "7", "5"}]Scope (3)
Use the second argument to limit the number of elements:
Interpreter[RepeatingElement["String", 2]][{"foo", "bar", "baz"}]Interpreter[RepeatingElement["String", {3, 5}]][{"foo", "bar"}]Use the second argument to set the initial number of fields to be displayed:
CloudDeploy[FormFunction["field" -> RepeatingElement["String", {2, {1, 5}}]]]Use the second argument to change the label of the fields:
CloudDeploy[FormFunction["number of occupants" -> RepeatingElement[<|"Interpreter" -> "Integer", "Label" :> "room " <> ToString[i]|>, {{i, 2}, {1, 5}}]]]Properties & Relations (4)
Use RepeatingElement in conjunction with CompoundElement to interpret complicated structures:
Interpreter[CompoundElement[<|"numbers" -> RepeatingElement["Integer"], "fruit" -> RepeatingElement[{"apple" -> "pomme", "orange" -> "orange", "grapefruit" -> "pamplemousse"}]|>]][<|"numbers" -> {"1", "14", "-4"}, "fruit" -> {"apple", "pomme", "grapefruit"}|>]Use it in conjunction with Alternatives to interpret data that can have different shapes:
Interpreter[CompoundElement[<|"x" -> RepeatingElement["City" | "Country"]|>]][<|"x" -> {"berlin", "portugal", "tegucigalpa"}|>]Interpreter[CompoundElement[<|"x" -> RepeatingElement["AmusementPark"]|>]][<|"x" -> {"coliseum" | "disneyland", "six flags" | "central park" }|>]RepeatingElement should not be confused with DelimitedSequence. RepeatingElement does not permit a single string separated by delimiters:
Interpreter[RepeatingElement["Integer"]]["1,2,3"]Use DelimitedSequence for elements separated by delimiters:
Interpreter[DelimitedSequence["Integer"]]["1,2,3"]Use with CompoundElement in the context of FormFunction to generate a table of fields:
CloudDeploy[FormFunction["names" -> RepeatingElement[CompoundElement[<|"first" -> "String", "last" -> "String"|>]]]]Possible Issues (1)
When using the second argument of RepeatingElement with an index in the context of a web form or an API, the "Interpreter" field cannot depend on the index:
FormObject["x" -> RepeatingElement[<|"Interpreter" :> Range[i], "Label" :> ToString[i]|>, {{i, 1}, {1, 4}}]]This is due to the fact that the "Interpreter" field cannot be delayed:
FormObject["x" -> <|"Interpreter" :> (Print["evaluated"];"String")|>]//InputFormHistory
Text
Wolfram Research (2015), RepeatingElement, Wolfram Language function, https://reference.wolfram.com/language/ref/RepeatingElement.html.
CMS
Wolfram Language. 2015. "RepeatingElement." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RepeatingElement.html.
APA
Wolfram Language. (2015). RepeatingElement. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RepeatingElement.html
BibTeX
@misc{reference.wolfram_2026_repeatingelement, author="Wolfram Research", title="{RepeatingElement}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/RepeatingElement.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_repeatingelement, organization={Wolfram Research}, title={RepeatingElement}, year={2015}, url={https://reference.wolfram.com/language/ref/RepeatingElement.html}, note=[Accessed: 12-June-2026]}