Skip to content

2013-3: What Is In a Word

Write a dfn which returns the number of words in the given character scalar or vector.

For simplicity's sake, you can consider the space character ' ' to be the only word separator.

Examples:

      (your_function) 'Testing one, two, three'
4
      (your_function) '' ⍝ empty vector has no words
0
      (your_function) ' this vector has extra blanks ' ⍝ just counting the blanks won't work
5
your_function ←

Solutions

Video Thumbnail YouTube

Chat transcript Code on GitHub