Given X and Y with values taken from the set 'A', 'B', 'C', 'D'.
I need to compute  the larger of the two values (larger with respect
to their position in ascii or ebcdic).
In other words  X >. Y
However >. doesnt work with characters.
 Thus I use an expression similar to:
 a.{~>. & (a.i.])

In 64 bit J this expression needs around 25M for a character vector of
length 1e6:

   GTE   =: a. {~ >. & (a. i. ])
   char1 =: a. {~ num1 =: [EMAIL PROTECTED]
   char2 =: a. {~ num2 =: [EMAIL PROTECTED]

   7!:5<'num1'
8388608
   7!:5<'char1'
1048576

   7!:2 'char2 GTE char1'
25167872
   7!:2 'num2 >. num1'
8390272

Is there an alternative, or is there a form of the expression that
would use special code?
Perhaps there is an argument to !. such that when applied to >. would
extend its domain? (Something like   >.!.<a.)

 David
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to