|
From: | Juergen Sauermann |
Subject: | Re: [Bug-apl] Question about behavior of ⍋ |
Date: | Tue, 08 Jul 2014 12:39:48 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5 |
Hi,
the reason is roughly this: In GNU APL there is an order between all APL values, not only between numeric vectors or character vectors. The order should also include nested APL values. Once such an order is defined, not only ⍋ but also other operators can be generalized to use it instead of throwing a DOMAIN ERROR. I believe currently two APL values compare according to the following rules (in that order): 1. Rank: higher rank > lower rank (regardless of shape or content) 2. Shape vector: bigger shape > smaller shape (regardless of content) 3. Content: characters (Unicode) < numbers (numeric value) < nested values I understand that the sorting of character vectors looks counter-intuitive on the first view, but if you look at the general case then it would be even more counter-intuitive to break the above order in the special case of two character vectors. And the "normal" ordering of character vectors can easily be achieved by means of ↑¨ or so. Once the character vectors have the same length they compare as expected. /// Jürgen On 07/07/2014 08:25 PM, David Lamkins wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |