title: Converting Mathematica list of values into boolean list
body: <p>First of all, sorry for the confused title.</p>
  
  <p>What I want to do is to convert <code>{1, 4, 9}</code> to:</p>
  
  <pre><code>{True, False, False, True, False, False, False, False, True}
  </code></pre>
  
  <p>That is, only the indexes from the first list will have value <code>True</code>, the rest will be <code>False</code>.</p>
  
  <p>I sense there is some really simple solution, but I am quite new to both Mathematica and functional programming. I could do it iteratively, in a loop, but there has to be something that works with the list as a whole. Right? :)</p>
  
  <p>Thanks for your help.</p>
  
  <hr>
  
  <p><strong>EDIT:</strong> to show that I tried to do something before I asked, here's my progress so far:</p>
  
  <pre><code>first={1,4,9}
  ReplacePart[Table[False, {x, Max[first]}], {1} -&gt; True]
  (* gives {True, False, False, False, False, False, False, False, False} *)
  </code></pre>
  
  <p>Unfortunately, it doesn't work with <code>{1,4,9} -&gt; True</code>, but would work with <code>{1 -&gt; True, 4 -&gt; True, 9 -&gt; True}</code>. But I don't know how to get to that...</p>
  
  <hr>
  
  <p><strong>EDIT 2:</strong> got it.</p>
  
  <pre><code>ReplacePart[Table[False, {x, Max[first]}], Table[x -&gt; True, {x, first}]]
  </code></pre>
  
  <p>I'd still love to see your solutions! This one seems like an ugly hack to me ... :)</p>