I think my cmp is like yours. It works by boxing the string argument before comparing the numeric result of grade.
cmpnum =: *@-~
cmpalpha=: cmpnum/@\:@,&<
cmp =: cmpnum :: cmpalpha
'abc' cmp 'abcd'
_1
'abc' cmp&< 'abcd'
_1
('abc';'f') cmp 'abcd';'f'
_1
('abc';'f') cmp"0 'abcd';'f'
_1 1
3 cmp"0] 2 3 8
_1 0 1
3 cmp"0] 2 ;'abc'
_1 _1
3 cmp"0~] 2 ;'abc'
1 1
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
