Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 3) type operator (@) returns symbols (`i, `j) for ints and longs etc, was returning shorts before. Interesting how do we distinguish arrays/scalars now.

Upper/lower case:

   @1
  `i
   @1 2
  `I
   @`a
  `n
   @`a`b
  `N


I saw that, but how do you make simple check if it is uppercase?


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


this 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: