[Jprogramming] string comparison
Brian Schott
schott.brian at gmail.com
Mon Oct 31 05:25:37 HKT 2011
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
More information about the Programming
mailing list