aboutsummaryrefslogtreecommitdiff
path: root/help/⍋gradeup binsup.md
blob: c633a5d81d443521c0551aa30d45eb0abecd5521 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
*View this file with results and syntax highlighting [here](https://mlochbaum.github.io/BQN/help/⍋gradeup binsup.html).*

# Delta Stile (`⍋`)

`⍋ 𝕩`: Grade Up

Indices of `𝕩` that would sort its major cells in ascending order.

       a ← 3‿2‿1
    ⟨ 3 2 1 ⟩
       ⍋ a
    ⟨ 2 1 0 ⟩
       (⍋a) ⊏ a
    ⟨ 1 2 3 ⟩
       


`𝕨 ⍋ 𝕩`: Bins Up

Binary search for each element of `𝕩` in `𝕨`, and return the index found, if any. 

`𝕨` must be sorted in ascending order.

       3‿4‿5‿7 ⍋ 2
    ┌·   
    · 0  
        ┘
       3‿4‿5‿7 ⍋ 2‿6
    ⟨ 0 3 ⟩