Skip to content

Commit eb45fc7

Browse files
committed
✨ sort compare
1 parent c6f2278 commit eb45fc7

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/primitive-compare.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,14 @@ export const primitiveMap = {
255255
monad: { name: 'Grade Down', defaultRank: 1, apl: '⍒', bqn: '⍒', j: '\\:', kap: '⍒', uiua: '⍖' },
256256
dyad: null
257257
},
258+
'⊴': {
259+
monad: { name: 'Sort Up', defaultRank: 1, apl: '⊂⍤⍋⍛⌷', bqn: '∧', j: '/:~', kap: '∧', uiua: '⍆' },
260+
dyad: null
261+
},
262+
'⊵': {
263+
monad: { name: 'Sort Down', defaultRank: 1, apl: '⊂⍤⍒⍛⌷', bqn: '∨', j: '\\:~', kap: '∨', uiua: '⇌⍆' },
264+
dyad: null
265+
},
258266
'⌷': {
259267
monad: null,
260268
dyad: { name: 'Index', defaultRank: '1,1', apl: '⌷', bqn: null, j: '{', kap: '⌷', uiua: null }

tests/primitive-tests.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ export const tests = [
5555
{ name: 'Last Cell', rank: 1, expected: '5' },
5656
{ name: 'Last Cell', rank: 2, expected: '7 8 9' },
5757

58+
// ─── ⊴ Sort Up ───
59+
{ name: 'Sort Up', rank: 1, expected: '1 2 3 4 5' },
60+
61+
// ─── ⊵ Sort Down ───
62+
{ name: 'Sort Down', rank: 1, expected: '5 4 3 2 1' },
63+
5864
// ─── ~ Not / Without ───
5965
{ name: 'Without', rank: '1,1', input: ['1 2 3 4 5', '2 4'], expected: '1 3 5' },
6066

0 commit comments

Comments
 (0)