This is documented (see Rank sentence in the doc):

https://code.jsoftware.com/wiki/Vocabulary/slashco#dyadic

The order of priority for ordering-up is:

Type: numeric or empty, symbol, character (byte or unicode), and boxed, are so ordered
    Rank: lower comes before higher
    Values: compared after padding with fills to the same shape
Symbols are compared based on their symbol index, not the character lists they represent.

Cheers,
David

On 3/13/2020 01:19, 'Jon Hough' via Programming wrote:
Consider the wrods:

    words =: 'a';'z';'zza';'abc';'zabc';'abbb'
    sort words
?????????????????????????????????????????????????????????????????????
???a???z???abbb???abc???zabc???zza???
?????????????????????????????????????????????????????????????????????

the sorted words are not correctly (lexicographically) sorted.

If I replace 'z' with 'z ' (space after z character)
  words =: 'a';'z ';'zza';'abc';'zabc';'abbb'
    sort words
????????????????????????????????????????????????????????????????????????
???a???abbb???abc???z ???zabc???zza???
????????????????????????????????????????????????????????????????????????
the strings are correctly sorted.
It seems sort has trouble with single character strings.
Is this a bug, or am I misunderstanding sort with strings?
----------------------------------------------------------------------
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