title: String Length with Scalars and Vectors in APL
body: <p>I just started learning APL a couple of weeks ago, so this may sound like a newbie question.</p>
  
  <p>Let <code>B</code> be a string, which in APL terms can be either a scalor or a vector. If it's a scalar, <code>⍴B</code> returns null rather than the length of the string as I want.</p>
  
  <pre><code>B←'QR'
  ⍴B ⍝ returns 2
  
  B←'Q'
  ⍴B ⍝ returns null
  </code></pre>
  
  <p>I discovered one way around that:</p>
  
  <pre><code>⍴1↓'X',B ⍝ concatenating X and then removing it returns a value of 1
  </code></pre>
  
  <p>That works, but it seems a little hokey, so I'm wondering if there is a more standard way to find string length.</p>
  
  <p>Is it just me or does this seem a little inconsistent? The tutorial I read said to think of a scalar as a point similar to the way it is in vector algebra. But how is it that concatenating a scalar to a scalar makes a vector, but dropping a scalar from a vector never results in a scalar?</p>
  
  <p>I'm really enjoying APL, so this question isn't meant as criticism. My question is, what's the best way to find string length? And, if anyone can shed a little light on this seeming inconsistency, it would be appreciated.</p>