6 ms·
I guess you can check the ASCII value of the char: li:{(*$@x)within "AZ"} li 1 0 li 1 2 3 1 Or can have a list of uppercase chars as names & chec
by SifJar 8y ago
I guess you can check the ASCII value of the char:
li:{(*$@x)within "AZ"}
li 1
0
li 1 2 3
1
Or can have a list of uppercase chars as names & check with 'in':
li2:{(@:y)in x}[`$,:'`c$"A"+!26]
li2 1 2 3
1
li2 1
0
'li2' seems to be considerably faster:
\t:10000 li 1 2 3
13
\t:10000 li2 1 2 3
6
There may well be a better way though
- sannysanoff 8y agothis seems not to be in the spirit of language. Testing if type is array or not is so common, and adding this function (li, li2) to "standard library" would introduce "standard library". Maybe we overlooked some other obvious solution.