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

Reply via email to