2
$\begingroup$

When looking for the non-existing 2, FirstPosition returns the default whether or not I specify levelspec:

FirstPosition[{1, 1}, 2, a, Heads -> False]
FirstPosition[{1, 1}, 2, a, {1}, Heads -> False]

a

a

When looking for the non-existing Except[1], FirstPosition returns the default only when I specify levelspec:

FirstPosition[{1, 1}, Except[1], a, Heads -> False]
FirstPosition[{1, 1}, Except[1], a, {1}, Heads -> False]

{}

a

Is it a bug or am I failing to understand Except?

$\endgroup$
1
  • $\begingroup$ The whole of the expression matches Except[1]. {} represents the whole. $\endgroup$
    – Szabolcs
    Nov 28, 2016 at 7:50

0

Browse other questions tagged or ask your own question.