picks out those elements of list for which the corresponding element of sel matches patt.
- sel can be a nested list of any depth.
- Pick[list,sel,patt] picks out those list[[i1,i2,…]] for which sel[[i1,i2,…]] matches patt.
- Depending on the arrangement of elements matching patt in a nested list sel, Pick may return a ragged array.
- The heads in list and sel do not have to be List.
- Pick works with SparseArray objects.
- Parallelize[Pick[list,sel]] computes Pick[list,sel] in parallel on all subkernels. »
Examplesopen allclose all
Basic Examples (2)
Generalizations & Extensions (3)
Properties & Relations (2)
The comparison in Pick[list,sel,patt] is purely structural, with no regard to heads:
Compute Pick in parallel:
Possible Issues (4)
Atomic expressions are allowed in Pick:
If there is an atomic argument and it is not picked in its entirety, Sequence is returned:
Using Except[c] in the third argument can lead to unexpected results:
Use Except[c,p] to restrict the pattern to elements of the selector argument:
Wolfram Research (2004), Pick, Wolfram Language function, https://reference.wolfram.com/language/ref/Pick.html.
Wolfram Language. 2004. "Pick." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Pick.html.
Wolfram Language. (2004). Pick. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Pick.html