title: How does element membership work in Perl 6?
body: <p>Consider this example</p>
  
  <pre><code>my @fib =  (1,1, * + * … * &gt; 200).rotor(2 =&gt; -1); 
  say @fib[0] ∈  @fib; # prints True
  </code></pre>
  
  <p>The first statement creates a <a href="https://docs.perl6.org/type/Seq" rel="nofollow noreferrer">Sequence</a> of 2-element subsequences via the use of the <a href="https://docs.perl6.org/routine/rotor" rel="nofollow noreferrer">rotor</a> function. <code>@fib</code> will contain <code>(1,1)</code>, <code>(1,2)</code> and so on. Quite obviously, the first element of a sequence is part of a sequence. Or is it?</p>
  
  <pre><code>my @fib =  (1,1, * + * … * &gt; 200).rotor(2 =&gt; -1); 
  say @fib[0], @fib[0].^name; # OUTPUT: «(1 1)List␤»
  </code></pre>
  
  <p>So the first element contains a list whose value is (1 1). OK, let's see</p>
  
  <pre><code>my $maybe-element = (1,1); 
  say $maybe-element, $maybe-element.^name; # OUTPUT: «(1 1)List␤»
  say $maybe-element ∈  @fib;               # OUTPUT: «False␤»
  </code></pre>
  
  <p>Wait, what? Let's see...</p>
  
  <pre><code>my $maybe-element = @fib[0]; 
  say $maybe-element ∈ @fib; # OUTPUT: «True␤»
  </code></pre>
  
  <p>Hum. So it's not the container. But</p>
  
  <pre><code>say (1,1).List === (1,1).List; # OUTPUT: «False␤»
  </code></pre>
  
  <p>And</p>
  
  <pre><code>say (1,1).List == (1,1).List; # OUTPUT: «True␤»
  </code></pre>
  
  <p>So I guess <code>∈</code> is using object identity, and not equality. That being the case, how can we check, in sets or sequences of lists, if an independently generated list is included using this operator? Should we use another different strategy?</p>
  
  <p>Maybe a subquestion is why the same literals generate completely different objects, but there's probably a good, and very likely security-related, answer for that.</p>