strcmp =: (\: -&{. /:)@,&<

Henry Rich

On 11/13/2014 5:35 AM, Jan-Pieter Jacobs wrote:
J has total ordering (meaning anything can be sorted):
http://www.jsoftware.com/jwiki/Essays/The%20TAO%20of%20J

Using the verbs listed there you can define:

strcmp =: _1 0 1 #~ gt , eq , lt
   gt =: 1 0 -: /:@,&<
   eq =: -:!.0
   lt =: 1 0 -: \:@,&<

('a a a ac') strcmp&>&:;: 'ab aa a ab'

1

1

0

_1


2014-11-13 11:16 GMT+01:00 Sergey Kamenev <[email protected]>:

Hello folks!

Need strcmp verb
http://php.net/manual/function.strcmp.php

'a' strcmp 'ab'
1

'a' strcmp 'aa'
1

'a' strcmp 'a'
0

'ac' strcmp 'ab'
_1

May be you have implementation of this verb?

Thank you!
Sergey
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

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

Reply via email to