UpTo
UpTo[n]
is a symbolic specification that represents up to n objects or positions. If n objects or positions are available, all are used. If fewer are available, only those available are used.
Examples
open allclose allBasic Examples (7)
Take up to the number of elements available:
Drop up to the number of elements available:
Take up to the number of elements available, dropping what remains, if anything:
Partition into blocks that are up to 3 elements long; the last block is shorter:
Give the 10 most common elements, or as many as are available:
Give the order of the 10 smallest elements, or as many as are available:
Scope (7)
Take up to 20 characters from a string:
Find the 4 largest eigenvalues in a matrix, or as many as there are if fewer:
Create a "ragged" partition where last elements can be shorter:
Obtain the 6 most common elements, or as many as there are if fewer:
Generate a random sample of up to 6 elements, or as many as there are if fewer:
Obtain the first 4 minimal elements, or as many as are available:
Partition an image so that lengths are up to 36 pixels and heights are up to 28 pixels:
Text
Wolfram Research (2015), UpTo, Wolfram Language function, https://reference.wolfram.com/language/ref/UpTo.html.
CMS
Wolfram Language. 2015. "UpTo." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/UpTo.html.
APA
Wolfram Language. (2015). UpTo. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/UpTo.html