[Jprogramming] Counting characters

Skip Cave skip at caveconsulting.com
Tue Sep 13 22:33:28 UTC 2016


Why does this work:
   +/"1'abc'=/'abcbdefbbcbaa'
3 5 2                                   NB. 3 'a's, 5 'b's, and 2 'c's

And this works:

    tst2=. 3 : '+/"1''abc''=/y'

    tst2 'abcbdefbbcbaa'

3 5 2

But this doesn't work:
    ts1 =. +/"1'abc'=/]
    ts1  'abcbdefbbcbaa'
|domain error: ts1

| ts1'abcbdefbbcbaa'


Skip Cave
Cave Consulting LLC


More information about the Programming mailing list