Grading 2 items is not usually expensive; normally it's special-coded.

Henry Rich

On 11/13/2014 8:11 AM, bill lam wrote:
Sorting is an expensive operation. Could it be only once?

On Thu, Nov 13, 2014 at 8:43 PM, Henry Rich <henryhr...@nc.rr.com> wrote:
    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 <jsof...@inetstar.ru>:

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
----------------------------------------------------------------------
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