[Jprogramming] rosetta code - change case

Boyko Bantchev boykobb at gmail.com
Fri Dec 21 23:18:24 HKT 2007


On Dec 21, 2007 3:22 PM, Jack Andrews <effbiae at gmail.com> wrote:
> ...
>   upper=: (a.,~a.{~65+i.26) {~ (a.,~a.{~97+i.26) i. ]
>   lower=: (a.,~a.{~97+i.26) {~ (a.,~a.{~65+i.26) i. ]
>
> seems a little unwieldy... are there better ways?

One nice feature of these definitions is that you don't need
them both, as they are the inverse of each other -- which is
really to be expected of such operations:

   (upper -: lower inv) a.
1
   (lower -: upper inv) a.
1

So, you could define e.g.

   lower=: upper inv

Boyko


More information about the Programming mailing list