Extract

Extract[expr,pos]

extracts the part of expr at the position specified by pos.

Extract[expr,{pos1,pos2,}]

extracts a list of parts of expr.

Extract[expr,pos,h]

extracts parts of expr, wrapping each of them with head h before evaluation.

Extract[pos]

represents an operator form of Extract that can be applied to an expression.

Details

Examples

open allclose all

Basic Examples  (6)

Extract the second part from an expression:

Extract a part nested in an expression:

Extract parts from multiple positions:

Extract the parts given by Position:

Use an extract operator:

Extract a part from an Association:

Extract using different specifications:

Possible Issues  (1)

Extract[expr,{}] returns an empty list of subexpressions because the list of positions is empty:

Extract[expr,{{}}] extracts the subexpression at position {}, which is the whole expression:

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

Text

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

BibTeX

@misc{reference.wolfram_2020_extract, author="Wolfram Research", title="{Extract}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/Extract.html}", note=[Accessed: 28-February-2021 ]}

BibLaTeX

@online{reference.wolfram_2020_extract, organization={Wolfram Research}, title={Extract}, year={2014}, url={https://reference.wolfram.com/language/ref/Extract.html}, note=[Accessed: 28-February-2021 ]}

CMS

Wolfram Language. 1996. "Extract." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/Extract.html.

APA

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