title: howto find out if a vector contains only one 1 and other are 0? or how to check if every entry is the same?
body: <p>howto find out if a vector contains only one 1 and other are 0? or how to check if every entry is the same?</p>
  
  <p>e.g. i need to check if a vector contains zeros except only one 1 like:</p>
  
  <pre><code>(0 0 0 0 1 0 0 0 0) -&gt; true
  (0 0 0 0 0 0 0 0 1) -&gt; true
  (0 0 0 0 2 0 0 0 0) -&gt; false
  (0 0 1 0 1 0 0 0 0) -&gt; false
  </code></pre>