For lexicographical comparison of atoms and vectors
you can use
gt=: >/@/:@,&(<@,)
'c' gt 'b'
1
'c' gt 'c'
0
'ca' gt 'c'
1
3 gt 2
1
3 gt 3 0
0
2 9 gt 3
0
3 1 gt 3
1
--- Richard Donovan <[EMAIL PROTECTED]> wrote:
>
> I want an adverb that will convert 1-byte-characters to their numeric
> equivalent then operate
> the verb on them. For instance I want to be able to easily test 'c'> 'a' or
> '5' < '6' which
> gives domain errors (although 'c' = 'c' does not!)
>
> So I wrote this adverb:
>
> NB. adverb that converts characters
> NB. into their numeric equivalents
> NB. then operates the given verb on them
> NB. e.g. 'z'> CHAR 'a'
> NB. should return 1
>
> CHAR =: 1 :0
> t1=: a.i.x
> t2=: a.i.y
> t1 u t2
> )
>
> but...
>
> 'z'> CHAR 'a'
> |domain error
> | 'z' >CHAR'a'
> t1
> 33
> t2
> 97
> t1{a.
> !
> t2{a.
> a
>
> I am missing something obvious (again!)
> _________________________________________________________________
> Feel like a local wherever you go.
>
http://www.backofmyhand.com----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm