Restricted

Restricted[form,cond,]

represents a form for Interpreter and related functions restricted according to the conditions cond.

Details

  • Restricted["Number",{min,max}] represents a number restricted to the range min to max inclusive.
  • Restricted["Number",{min,max,step}] represents a number restricted to the range min to max in steps of size step.
  • Restricted["Integer",] etc. works the same as for "Number".
  • Restricted["String",patt] represents a string that must match the string pattern patt.
  • Restricted["String",patt,max] represents a string of maximum length max.
  • Restricted["String",patt,{min,max}] represents a string of length between min and max.
  • Restricted["Quantity","unit"] represents a quantity compatible with "units".
  • Restricted["Quantity","unit",{min,max}] represents a quantity whose magnitude lies between the quantities min and max.
  • Restricted["Quantity",QuantityVariable["pq"]] represents a physical quantity of type pq (such as "Length").
  • Restricted["Date",{min,max}] represents a date restricted to the range min to max.
  • Restricted["Date",{min,max, step}] represents a date restricted to the range min to max in steps of size step, where input is "Day", "Month", or "Year".
  • Restricted["type",region] represents any type with an associated geographic location restricted to be in a particular region specified by an entity (such as a country), an entity class, or a polygon.
  • Restricted["type",EntityClass["type","class"]] represents an object of the specified type chosen from the list of entities in the specified entity class.
  • Restricted[form,{{val1,val2,}}] represents a form whose value is chosen from the list vali.
  • Restricted[DelimitedSequence[],max] represents a delimited sequence of at most max elements.
  • Restricted[DelimitedSequence[],{min,max}] represents a delimited sequence of between min and max elements.

Examples

Basic Examples  (3)

Require an odd number between 1 and 99:

Require a quantity in whole meters between 0 and 100:

Require a city along the Silk Road:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2023_restricted, author="Wolfram Research", title="{Restricted}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/Restricted.html}", note=[Accessed: 18-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_restricted, organization={Wolfram Research}, title={Restricted}, year={2014}, url={https://reference.wolfram.com/language/ref/Restricted.html}, note=[Accessed: 18-March-2024 ]}