[Jprogramming] Counting characters

robert therriault bobtherriault at mac.com
Tue Sep 13 22:53:16 UTC 2016


Hi Skip,

It looks as if you defined ts1 as a hook, but you really wanted it to be a series of verbs that would work on the monadic argument.

   ts1 =. +/"1'abc'=/]
   ts1  'abcbdefbbcbaa'
|domain error: ts1
|       ts1'abcbdefbbcbaa'
   ts1a =.[: +/"1'abc'=/]
   ts1a  'abcbdefbbcbaa'
3 5 2

Alternatively, if you prefer @: to [:
   ts1b =. (+/"1)@:('abc'=/])
   ts1b  'abcbdefbbcbaa'
3 5 2

Cheers, bob

> On Sep 13, 2016, at 3:33 PM, Skip Cave <skip at caveconsulting.com> wrote:
> 
> ts1  'abcbdefbbcbaa'



More information about the Programming mailing list