Skip to main content

< — Sort up / Less

Function. Hanzi: 小. Ranks: ∞ monadic, 0 0 dyadic

<Y sorts the major cells of Y ascending, as [⍋Y]⌷Y does. Ties keep their order.

<30 10 20           ⍝ 10 20 30
<"banana"           ⍝ "aaabnn"
<[3 1⋄1 2⋄2 0]  ⍝ [1 2⋄2 0⋄3 1]

X<Y tests X < Y for reals, and for characters by code point. A number is less than any character, as ⍋ orders them. Pervasive; tolerant.

1 2 3<2            ⍝ $t $f $f
"abc"<"abd"        ⍝ $f $f $t
3<'a'              ⍝ $t

See > to sort down, and ⍋ for the indices that sort.

Fast combinations

BPL computes each of these combinations by an algorithm of its own, in any spelling. Trains says which spellings BPL recognises.

Combination Applies to Benefit
k↑<Y, k↑< Y or (k↑)∘< a vector of reals or characters without keys selects the k smallest items, or the -k largest, without ordering the rest
↑<Y, i⌷<Y or i⊃<Y the same vectors selects the item of rank i, such as a median, without ordering the rest
v←30 10 20 50 40 60 70 80 90 0
2↑< v                                ⍝ 0 10
5⌷< v                                ⍝ 50
(•explain "5⌷< v").fast.rule         ⍝ ["partial sort"]