Or, stated differently, the collating sequence is that of the unicode
codepoints, and as you have pointed out there cannot be a collating
sequence which satisfies all conflicting requirements.
That said, if you want a different collating sequence you could think
of sorting as ({~ [: ] /:) or ({~ ]@/:) and replace ] with some other
function.
Thanks,
--
Raul
On Thu, Nov 13, 2014 at 12:50 PM, 'Pascal Jasmin' via Programming
<[email protected]> wrote:
> what I meant is there is no automagical colating sequence
>
> u: 197 65
> ÅA
>
> (1 u: 'B') (\: -&{. /:)@,&< 4 u: 197
> 1
> (u: 66) (\: -&{. /:)@,&< u: 197
> 1
> 'B' (\: -&{. /:)@,&< 'A'
> _1
>
> I understand (recently learned) that universal collating sequences don't
> exist as Swedes and Germans sort differently.
>
>
> ----- Original Message -----
> From: Raul Miller <[email protected]>
> To: Programming forum <[email protected]>
> Cc:
> Sent: Thursday, November 13, 2014 12:09 PM
> Subject: Re: [Jprogramming] Need analog strcmp-function verb
>
> I was initially puzzled by what you meant by "/: doesn't really work
> for unicode".
>
> But then I realized, that while things like...
>
> $u: 9824 9829 9830 9827
> 4
> u: 9824 9829 9830 9827
> ♠♥♦♣
> /: u: 9824 9829 9830 9827
> 0 3 1 2
>
> ... do work, it is possible to sort the octets of the utf-8
> representation of unicode and that can result in a non-unicode
> sequence of octets.
>
> /: 8 u: u: 9824 9829 9830 9827
> 1 4 7 10 2 11 5 8 0 3 6 9
> /:~ 8 u: u: 9824 9829 9830 9827
> [garbage]
>
> Then again, you do not need to sort the octets and expect them to be
> meaningful unicode.
>
> /: 7 u: 8 u: u: 9824 9829 9830 9827
> 0 3 1 2
>
> That said, this kind of a distinction matters quite a lot to
> implementers and is likely to escape the awareness of people doing the
> specifications.
>
> Thanks,
>
> --
> Raul
>
>
> On Thu, Nov 13, 2014 at 11:35 AM, 'Pascal Jasmin' via Programming
> <[email protected]> wrote:
>> /: doesn't really work for unicode, unless you convert unicode into an
>> integer mapping and then use that as x for /:
>>
>> /: has the advantage of working with boxed data, or "records"/lists
>>
>> With those limitations we could think of using ,:&(a.&i.)&": to build
>> numeric arrays to compare, but that runs into rank quirks with single
>> "character" left sides, so boxing seems simpler with:
>>
>> '3'([: ,/&> ,&<&(a.&i.)&":) '3a'
>> 51 0
>> 51 97
>>
>>
>> You gain the "benefit" of being able to treat original integers as strings.
>>
>> comparing then with < and > is a little harder due to handling tie breaks,
>> and you are duplicating the real work of /: in doing so?
>>
>> '3'([: * [: -~/ 1 i."1~ [: (</ ,: >/ ) [: ,/&> ,&<&(a.&i.)&":) '3a'
>>
>>
>> ----- Original Message -----
>> From: bill lam <[email protected]>
>> To: Programming forum <[email protected]>
>> Cc:
>> Sent: Thursday, November 13, 2014 8:11 AM
>> Subject: Re: [Jprogramming] Need analog strcmp-function verb
>>
>> Sorting is an expensive operation. Could it be only once?
>>
>> On Thu, Nov 13, 2014 at 8:43 PM, Henry Rich <[email protected]> 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 <[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
>> ----------------------------------------------------------------------
>> 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