uCBQN/test/cases/prims.bqn
dzaima 8321364afe update test
currently CBQNs -𝕩 is 0-𝕩 and thus doesn't negate negative zero. ¯1×𝕩 could change to be such too, but whatever
2023-12-28 18:13:06 +02:00

352 lines
29 KiB
BQN
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

%DEF var V•internal.Variation LV•internal.ListVariations CLR•internal.ClearRefs
%DEF tvar %USE var _tvar {F _𝕣 x: (CLR@) {F 𝕩 V x}¨ LV 𝕩; w F _𝕣 x: (CLR@) (LV 𝕨) {(𝕨 V w) F 𝕩 V x} LV 𝕩}
%DEF eqvar %USE tvar _eqvar {r 𝕨 𝔽 _tvar 𝕩 !(r)¨ r r}
%DEF evar %USE tvar _evar {ok{} r𝕨 ok𝔽{𝕊: •CurrentError@} _tvar 𝕩 {okr? !"TEST FAIL: variation didn't error"; ("TEST FAIL: varying error messages" ! 1=)r !r}}
%DEF k _k {𝔽•internal.Keep}
# batch checks
{>013'a'{} (𝕏`)'e' 100, 1010, 101e4, 101e9, 101e20, "AAA", "⍉⍉⍉", "𝕨𝕨𝕨"}¨ +< %% 581010101010'e''e''e'1010101010'e''e''e'1010101010'e''e''e''e''e''e''e''e''e''e''e''e''e''e''e''e''e''e''e',581010101010'e''e''e'1010101010'e''e''e'1010101010'e''e''e''e''e''e''e''e''e''e''e''e''e''e''e''e''e''e''e',581010101010'e''e''e'1010101010'e''e''e'1010101010'e''e''e'101010'e''e''e''e''e''e''e''e''e''e''e''e''e',5810101010103331010101010333101010101033310101010103331010101010333,581010101010333101010101033310101010103331010101010333'e''e''e''e''e''e''e''e'
# total array comparison
%USE k a 0@'a'¯∞1¯1{𝕩0, 𝕩1, {1((¯1¨𝕩))𝕩}(0×´) 𝕩0}¨ {(<)´𝕩<3}¨4 r((-))_k˜ a ! r •Cmp˜a r %% '1'-˜7373"1000202002000002222000002000000222222222222200000200000022220000002000000210222222222222222222222222222222222222222222222222222222222222222222222222122222222222222222222222222222222222222222222222222222222222222222222222001222222222222222222222222222222222222222222222222222222222222222222222000010000200000222200000200000022222222222220000020000002222000000200000020002122022020222222020222022022222222222222202022202202222220220222022020000201002000002222000002000000222222222222200000200000022220000002000000200020210200000222200000200000022222222222220000020000002222000000200000020002222122020222222020222022022222222222222202022202202222220220222022020000000001000000000000000000000000000000000000000000000000000000000000000200020220210000222200000200000022222222222220000020000002222000000200000020002222222120222222020222022022222222222222202022202202222220220222022022000202202201002222200002202000222222222222220000220200022222020002202000200022222222212222222202222220222222222222222220222222022222222202222220220002022022020122222020022022022222222222222202002202202222220220222022020000000002000001000000000000000000000000000000000000000000000000000000000000000000200000210200000200000020020020020020000020000002002000000200000000000000020000022120000020000002202202202202000002000000220200000020000000000000002000002001000000000000200000000200000000000000020000000000000000200020220220000222210000200000022222222222220000020000002222000000200000020002222222220222222120222022022222222222222202022202202222220220222022022000202202202002222201002202000222222222222220000220200022222020002202000200022222222222222222212222220222222222222222220222222022222222202222220220002022022020222222020122022022222222222222202002202202222220220222022020000000002000002002000001000000200200000200200000000000020020000000000000200020220220000222220000210000022222222222222000020000002222202000200000020002222222220222222220222122022222222222222222022202202222222220222022022000202202200002222200002201000222222222222220000220000022222020002202000200020220220200222220200220210022222222222222020022020002222202202220200020002222222222222222222222222122222222222222222222222202222222222222222022000202202202002222202002202201222222222222220200220220022222022022202202000000000200000200000000000000010000000000000000000000000000000000000000000000000020000022020000020000002102002002002000002000000200200000020000000000000002000002222000002000000221220220220200000200000022020000002000000000000000200000200200000000000020010000020000000000000002000000000000000000000000020000022020000020000002202102002202000002000000220200000020000000000000002000002222000002000000222221220222200000200000022220000002000000000000000200000200200000200000020020010020020000000000002002000000000000000000000020000022020000020000002202202102202000002000000220200000020000000000000002000002222000002000000222222221222200000200000022220000002000000000000000200000200000000000000020000000010000000000000000000000000000000000000000020000022020000020000002202002002102000002000000200200000020000000000000002000002222000002000000222220220221200000200000022020000002000000000000000200000200200000000000020020000020010000000000002000000000000000020002022022000022222000020000002222222222222100002000000222200000020000002000222222222022222222022202202222222222222221202220220222222022022202202200020220220200222220200220200022222222222222010022020002222202000220200020002222222222222222222222222022222222222222222122222202222222220222222022000202202202022222202022202202222222222222220201220220222222022022202202000000000200000200200000200000020020020020020000010000002002000000000000020002022022000022222000022000002222222222222200002100000222220200020000002000222222222022222222022222202222222222222222202221220222222222022202202200020220220000222220000220200022222222222222000022010002222202000220200020002022022020022222020022022002222222222222202002202100222220220222020002000222222222222222222222222222222222222222222222222221222222222222222202200020220220200222220200220220222222222222222020022022012222202202220220200000000020000020000000000000002000000002000000000000000100000000000000000000000002000002202000002000000220200200220200000200000021020000002000000000000000200000222200000200000022222022022220000020000002212000000200000000000000020000020020000000000002002000002002000000000000200100000000000002000202202200002222200002000000222222222222220000200000022221000002000000200022222222202222222202220220222222222222222220222022022222212202220220220002022022000022222000020000002222222222222200002000000222220100020000002000202202202002222202002202000222222222222220200220200022222021002202000200022222222222222222222222220222222222222222222222222022222222212222220220002022022020022222020022020002222222222222202002202000222220220122020000000000002000002002000002000000200200200200200000200000020020000001000000200020220220000222220000220000022222222222222000022000002222202000210000020002222222220222222220222222022222222222222222022222202222222220222122022000202202200002222200002200000222222222222220000220000022222020002201000200020220220200222220200220220022222222222222020022022002222202202220210020002222222222222222222222222222222222222222222222222222222222222222222122000202202202002222202002202200222222222222220200220220022222022022202201"
!"∧: Argument cannot have rank 0" % @
!": Argument cannot have rank 0" % @
(=)˜{} %% 11
()˜{} %% 00
{}(=){} %% 00
{}(){} %% 11
# !𝕩 & 𝕨!𝕩
!"Assertion error" % !0
!"Assertion error" % !0
!"foo" % !"foo"
!"foo" % "foo"!0
!"foo" % "foo"!"bar"
!•CurrentError 1+ %% 1,+
!0•CurrentError 1+ %% 1,+
!1 %% 1
"foo"!1 %% 1
# |𝕩
{| (10)𝕩}¨ -271531 %% 0123456789128,012345678932768,01234567892147483648
# arith
(<1)+ 1 %% <2
1 +<1 %% <2
(<1)+<1 %% <2
@-@ %% 0
!"-: Invalid character" % @-1
{r•Repr𝕩 (!´) (r": Unexpected argument types") @ 0𝕏{𝕊: •CurrentError@} @}¨ +, ×, ÷, , , , , |, , , ÷
{r•Repr𝕩 (!´) (r": Unexpected argument types") 0 0𝕏{𝕊: •CurrentError@} @}¨ -, ×, ÷, , , , , |, , , ÷
{r•Repr𝕩 (!´) (r": Unexpected argument types") @ 0𝕏{𝕊: •CurrentError@} 0}¨ ×, ÷, , , , , |, , , ÷
%USE var a4@ (LV a) {r•Repr𝕩 (!´) (r": Unexpected argument types") @ 0𝕏{𝕊: •CurrentError@} 𝕨 V a} +, ×, ÷, , , , , |, , , ÷
%USE var a4@ (LV a) {r•Repr𝕩 (!´) (r": Unexpected argument types") 0 0𝕏{𝕊: •CurrentError@} 𝕨 V a} -, ×, ÷, , , , , |, , , ÷
%USE var a40 (LV a) {r•Repr𝕩 (!´) (r": Unexpected argument types") @ 0𝕏{𝕊: •CurrentError@} 𝕨 V a} ×, ÷, , , , , |, , , ÷
%USE var a4@ (LV a) {r•Repr𝕩 (!´) (r": Unexpected argument types") (𝕨 V a) 0𝕏{𝕊: •CurrentError@} @} +, ×, ÷, , , , , |, , , ÷
%USE var a40 (LV a) {r•Repr𝕩 (!´) (r": Unexpected argument types") (𝕨 V a) 0𝕏{𝕊: •CurrentError@} @} -, ×, ÷, , , , , |, , , ÷
%USE var a4@ (LV a) {r•Repr𝕩 (!´) (r": Unexpected argument types") (𝕨 V a) 0𝕏{𝕊: •CurrentError@} 0} ×, ÷, , , , , |, , , ÷
%USE var a4@ b4@ {r•Repr f𝕩 {(!´) (r": Unexpected argument types") (𝕨 V a) 0F{𝕊: •CurrentError@} 𝕩 V b}LV´ ab} +, ×, ÷, , , , , |, , , ÷
%USE var a40 b4@ {r•Repr f𝕩 {(!´) (r": Unexpected argument types") (𝕨 V a) 0F{𝕊: •CurrentError@} 𝕩 V b}LV´ ab} -, ×, ÷, , , , , |, , , ÷
%USE var a4@ b40 {r•Repr f𝕩 {(!´) (r": Unexpected argument types") (𝕨 V a) 0F{𝕊: •CurrentError@} 𝕩 V b}LV´ ab} ×, ÷, , , , , |, , , ÷
!"-: Unexpected argument types" % 0-@
!"÷: Unexpected argument types" % 0÷@
!"+: Argument must consist of numbers" % +@
@, "abc", 1,2,+, {} {(!´) (": Argument contained non-number"˜•Repr 𝕩) 0𝕏{𝕊: •CurrentError@} 𝕨} -×÷|¬
!"This function can't be called monadically" % @
!"This function can't be called monadically" % @
# 𝕨/𝕩
2301/4312 %% ¨6301201234534534591011
2301/4 %% 6001113
2301/4 %% ¨6001113
!"Expected non-negative integer, got ¯3" % 2¯3/2
!"Expected non-negative integer, got ¯3e20" % 2¯3e20/2
!"/: Lengths of components of 𝕨 must match 𝕩 (3 ≠ 4)" % 123/4567
!"Expected non-negative integer, got ¯1000" % (4/1000¯1000) / 81
!"Expected non-negative integer, got ¯1000" % (4/1000¯1000) / 81
!"Integer out of range: 4e19" % %USE evar 24e19 /_evar 2
!"𝕨/𝕩: Length of compound 𝕨 must be at most rank of 𝕩" % 1/3
!"𝕨/𝕩: Length of compound 𝕨 must be at most rank of 𝕩" % 1/<"ab"
!"𝕨/𝕩: Length of compound 𝕨 must be at most rank of 𝕩" % (<1)/<"ab"
!"𝕨/𝕩: Length of compound 𝕨 must be at most rank of 𝕩" % (<0)/<"ab"
!"𝕨/𝕩: Length of compound 𝕨 must be at most rank of 𝕩" % 10,10 / 1010
!"𝕨/𝕩: Length of compound 𝕨 must be at most rank of 𝕩" % 10,10,<0 / 101010
!"/: Simple 𝕨 must have rank 0 or 1 (2≡=𝕨)" % (214) / 4416
!"𝕨/𝕩: Compound 𝕨 must have rank at most 1" % (21<4) / 4416
!"/: Simple 𝕨 must have rank 0 or 1 (2≡=𝕨)" % (124) / 4
!"𝕨/𝕩: Compound 𝕨 must have rank at most 1" % (12<4) / 4
!"𝕨/𝕩: 𝕨 must consist of natural numbers" % 4, 123.54 / 4416
!"𝕨/𝕩: 𝕨 must consist of natural numbers" % 4, 3.5 / 4416
4, 0, 5 / 445@ %% 6010@
4, 40, 5 / 445@ %% 6010@
102 / ¨ ["ab","cd","ef"] %% ¨ ["ab","ef","ef"]
(<102) / ¨ ["ab","cd","ef"] %% ¨ ["ab","ef","ef"]
(102) / ¨ ["ab","cd","ef"] %% ¨ ["ab","ef","ef"]
# /𝕩
!"Expected non-negative integer, got ¯1000" % / 4/1000¯1000
!"/: Argument must have rank 1 (3‿3 ≡ ≢𝕩)" % /33
!"/: Argument must have rank 1 (⟨⟩ ≡ ≢𝕩)" % /0
!"Expected non-negative integer, got ¯1" % %USE evar /_evar ¯1(100) 20010
!"Sum too big" % %USE evar /_evar 1e2262
!"Integer out of range: 1e20" % %USE evar /_evar 1e20(100) 20010
! (//)81525329010115516558459489491213121328135013671391140714691486155915661576158215921599160916161626163540864093411441224141414941694177
# 𝕨⊏𝕩
•internal.ElType¨ {(1002)𝕨𝕩}˜ 0, 1, 2, 127, 128, 32767, 32768, ¯32767, ¯32768, ¯32769, ¯1+231, 231, @, @+1, @+255, @+256, @+1114111, {}, 12 %% (8-(=˜<5)×8-˜) 0011223223345556788
000 1310 %% 33012
¨ (203451)98070 08070 (23041)10 %% 20345807,0807,2304
!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % ˜(2001)1
!"⊏: Indexing out-of-bounds (24∊𝕨, 4≡≠𝕩)" % 12444
!"⊏: Indexing out-of-bounds (¯24∊𝕨, 4≡≠𝕩)" % 1¯2444
!"𝕨⊏𝕩: 𝕨 must be an array of numbers or list of such arrays" % (1¯26@)@5
!"⊏: Indexing out-of-bounds (¯26∊𝕨, 5≡≠𝕩)" % ¯265
!"Expected integer, got ¯26.5" % ¯26.55
!"⊏: Indexing out-of-bounds (¯26∊𝕨, 5≡≠𝕩)" % 1¯265
!"⊏: Indexing out-of-bounds (26∊𝕨, 5≡≠𝕩)" % 1265
!"Expected integer, got 1.1" % 01.12 10
!"⊏: Indexing out-of-bounds (1∊𝕨, 1≡≠𝕩)" % 001 1310000
!"⊏: Indexing out-of-bounds (2∊𝕨, 2≡≠𝕩)" % (1+9=10)12,3
%USE tvar !¨ {𝕨 (•CurrentError) _tvar 𝕩}´¨ 01, 0 01, "?" 01, 01
a2 ! "e" (10){baaaaaaaaaa 𝕨"e"𝕩}12,34 ! 01 a
%USE eqvar {1¯1 {r𝕨𝕩 ! 𝕩 •internal.ElType r r}_eqvar 𝕩}¨ 2, 4, "hello", "ab", "cd", "ef", 4
# 𝕨⊑𝕩
!"⊑: 𝕨 contained a non-integer" % 0.13
!"⊑: 𝕨 contained a non-integer" % 2803
!"⊑: Leaf arrays in 𝕨 must have rank 1 (element: (1‿2⥊1‿2))" % %USE evar (12) {𝕨𝕩}_evar 55
%USE eqvar 12 _eqvar 55 %% 12
# comparison
w111 x121 {! (•Repr𝕩,": Expected equal shape prefix (1‿1 ≡ ≢𝕨, 1‿2 ≡ ≢𝕩)") w 𝕏(•CurrentError@) x}¨ =<>
w111 x121 wx <¨ {! (•Repr𝕩,": Expected equal shape prefix (1‿1 ≡ ≢𝕨, 1‿2 ≡ ≢𝕩)") w 𝕏(•CurrentError@) x}¨ =<>
w111 x21 {! (•Repr𝕩,": Expected equal shape prefix (1‿1 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)") w 𝕏(•CurrentError@) x}¨ =<>
w111 x21 wx <¨ {! (•Repr𝕩,": Expected equal shape prefix (1‿1 ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)") w 𝕏(•CurrentError@) x}¨ =<>
!"Invalid comparison" % <˜{}
!"Invalid comparison" % ˜{}
!"Invalid comparison" % >˜{}
!"Invalid comparison" % ˜{}
{! 5 (𝕏 𝕏) 10}¨ =<>
{! (10) (𝕏 𝕏) 5}¨ =<>
{! (10) (𝕏 𝕏) 410}¨ =<>
# >𝕩
!">: Result rank too large (200 ≡ =𝕩, 205 ≡ =⊑𝕩)" % > (2001)<(2051)1
!">: Incompatible element shapes (encountered shapes ⟨2⟩ and 4‿5)" % > ¨2, 45
!">: Incompatible element shapes (encountered shapes 2‿3 and ⟨4⟩)" % > ¨23, 4
!">: Incompatible element shapes (encountered shapes 2‿3 and 4‿5)" % > ¨23, 45
!">: Incompatible element shapes (encountered shapes 2‿0 and 4‿5)" % > ¨20, 45
!">: Incompatible element shapes (encountered shapes ⟨0⟩ and 4‿5)" % > ¨0, 45
!">: Incompatible element shapes (encountered shapes ⟨0⟩ and ⟨⟩)" % > ¨0,
!">: Incompatible element shapes (encountered shapes 2‿3 and ⟨⟩)" % > ¨23,
!">: Incompatible element shapes (encountered shapes 4‿5 and 4‿6)" % >234520,461
!"∾: Item trailing shapes must be equal (contained arrays with shapes ⟨2⟩ and ⟨3⟩ and later higher-rank array)" % 11, 111, 1, 221
!"∾: Item trailing shapes must be equal (contained arrays with shapes 1‿4 and ⟨0⟩)" % 14"abcd",
><'a',1 %% 'a'1
>1,2,<3,4,<<5 %% 1,2,3,4,<5
>01<23<"ab" %% 4
{a3 !'e'>'e' a, a, 2, a, a ! 1•internal.Refc a}
{a3 > a, a, 3, a, a ! 1•internal.Refc a}
{a(2001)3 ! 'e'>'e' (2001)a, a, 2, a, a ! 1•internal.Refc a}
%USE var a236 b23"abcdef" !¨ (LV a) {>1211𝕨𝕩V¨ab} LV b
%USE var ab23<<˘"abcd" !¨ (LV a) {>1211𝕨𝕩V¨ab} LV b
%USE var {ab: ! ´(¨) (LV a) {>1211𝕨𝕩V¨ab} LV b}¨ 2<23<<˘"abcd" 236,23"abcdef"
%USE var {ab: ! ´(¨) (LV a) {𝕨𝕩V¨ab} LV b}¨ 2<23<<˘"abcd" 236,23"abcdef"
# <𝕩
! <¨ - (¯2+5)+240
! <¨ @+¯101+220
! < {}
# ⋈𝕩
! ¨ - (¯2+5)+240
! ¨ @+¯101+220
! {}
# ∾𝕩
"ab", 12, "de" %% 'a','b',12,'d','e'
!"∾: Item trailing shapes must be equal (contained arrays with shapes 3‿3 and 3‿4)" % 33,34
!"∾: Item trailing shapes must be equal (contained arrays with shapes ⟨2⟩ and 3‿3)" % 12,33
# 𝕨∾𝕩
!"∾: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % ("abc""def")"a"
!"∾: Lengths not matchable (⟨6⟩ ≡ ≢𝕨, 1‿1 ≡ ≢𝕩)" % (("abc")"def")111
! (2"abcdefgh") ["ab","cd"]["ef","gh"]
! (2"abcdef") ["ab","cd"]"ef"
! (2"abcdef") "ab"["cd","ef"]
! (2"abcdefgh") (a["ab","cd"])["ef","gh"] •internal.Keep a
! (2"abcdef") (a["ab","cd"])"ef" •internal.Keep a
! (2"abcdef") "ab"a["cd","ef"] •internal.Keep a
!"∾: Argument ranks must differ by 1 or less (0≡=𝕨, 2≡=𝕩)" % 133
!"∾: Argument ranks must differ by 1 or less (1≡=𝕨, 3≡=𝕩)" % 12333
!"∾: Argument ranks must differ by 1 or less (3≡=𝕨, 1≡=𝕩)" % 12˜333
!"∾: Lengths not matchable (3‿4 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (34)33
!"∾: Lengths not matchable (2‿2 ≡ ≢𝕨, 2‿3 ≡ ≢𝕩)" % ["ab","cd"]["efg","hjk"]
!"∾: Lengths not matchable (2‿2 ≡ ≢𝕨, ⟨3⟩ ≡ ≢𝕩)" % ["ab","cd"]"efg"
!"∾: Lengths not matchable (⟨3⟩ ≡ ≢𝕨, 2‿2 ≡ ≢𝕩)" % "abz"["cd","ef"]
!"∾: Lengths not matchable (2‿2 ≡ ≢𝕨, 2‿3 ≡ ≢𝕩)" % (a["ab","cd"])["efg","hjk"]
!"∾: Lengths not matchable (2‿2 ≡ ≢𝕨, ⟨3⟩ ≡ ≢𝕩)" % (a["ab","cd"])"efg"
!"∾: Lengths not matchable (⟨3⟩ ≡ ≢𝕨, 2‿2 ≡ ≢𝕩)" % "abz"a["cd","ef"]
# 𝕨≍𝕩
!"≍: 𝕨 and 𝕩 must have equal shapes (3‿4 ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % (34)33
!"≍: 𝕨 and 𝕩 must have equal shapes (⟨3⟩ ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)" % 12312
!"≍: 𝕨 and 𝕩 must have equal shapes (⟨3⟩ ≡ ≢𝕨, ⟨⟩ ≡ ≢𝕩)" % 1231
!"≍: Result rank too large" % ˜(2551)1
# ≍𝕩
!"≍: Result rank too large (255≡=𝕩)" % 256 1
%USE eqvar 1234564 {c𝕊e: _eqvar´¨ 4c, c ({𝕩<e}¨) 0c, 1c, c} 1, 'a', 12
# « & »
!"shift: Lengths not matchable (⟨2⟩ ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % 12»33
!"shift: =𝕨 must be =𝕩 or ¯1+=𝕩 (0≡=𝕨, 3≡=𝕩)" % 1»222
!"shift: =𝕨 must be =𝕩 or ¯1+=𝕩 (2≡=𝕨, 1≡=𝕩)" % (22)»12
!"shift: Lengths not matchable (⟨2⟩ ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % 12«33
!"shift: =𝕨 must be =𝕩 or ¯1+=𝕩 (0≡=𝕨, 3≡=𝕩)" % 1«222
!"shift: =𝕨 must be =𝕩 or ¯1+=𝕩 (2≡=𝕨, 1≡=𝕩)" % (22)«12
!"«: Argument cannot be a scalar" % «0
!"»: Argument cannot be a scalar" % »<0
# ⍉𝕩
%USE var !¨ { 𝕩 V a}¨ LV a234•rand.Range 2
%USE var !¨ { 𝕩 V a}¨ LV a¨ 234•rand.Range 2
%USE var !¨ { 𝕩 V a}¨ LV a@+234•rand.Range 100
# ⌽𝕩
%USE var {{! 𝕩 "Ai8"V𝕩} 𝕩•rand.Range 2}¨ 1000
# ↑𝕩 & ↓𝕩
!"↑: Argument must have rank at least 1" % 0
!"↓: Argument must have rank at least 1" % <0
# ¨
1 {𝕊:12}¨ 1 %% <12
1 {𝕊:12}¨<1 %% <12
(<1){𝕊:12}¨ 1 %% <12
(<1){𝕊:12}¨<1 %% <12
1 12¨ 1 %% <12
1 12¨<1 %% <12
(<1)12¨ 1 %% <12
(<1)12¨<1 %% <12
!"Mapping: Expected equal shape prefix (⟨2⟩ ≡ ≢𝕨, 4‿4 ≡ ≢𝕩)" % 12+¨44
!"Mapping: Expected equal shape prefix (⟨2⟩ ≡ ≢𝕨, ⟨4⟩ ≡ ≢𝕩)" % 12+¨4
¨ {a𝕩 𝕩} 23<"a" %% 6<"a"
¨ {a𝕩 231𝕩} 23<"a" %% 231<"a"
¨ {a𝕩 231𝕩} 6<"a" %% 231<"a"
¨ {a𝕩 23𝕩} 23<"a" %% 23<"a"
¨ 23<"a" %% 23<"a"
# ⊔
!"⊔: ≠𝕨 must be either ≠𝕩 or one bigger (2≡≠𝕨, 3≡≠𝕩)" % 003
# ↕𝕩
!"Expected non-negative integer, got character" % @
!"Expected non-negative integer, got character" % "hi"
!"↕: Argument must be either an integer or integer list (had rank 2)" % 221
!"↕: Result rank too large (300≡≠𝕩)" % 3001
# 𝕨↕𝕩
!"↕: Length of 𝕨 must be at most rank of 𝕩" % 00
!"↕: Length of 𝕨 must be at most rank of 𝕩" % 0031
00331 %% 44000
123 %% 21323
03 %% 400
# ≡𝕩
¨ , 0, "" %% 111
000 %% 1
1,12,1 %% 2
100 0 %% 100
10 %% 1
0 %% 0
# 𝕨⥊𝕩
!"⥊: Result rank too large" % (03002)0
# 𝕨⍷𝕩
%USE eqvar "ab" _eqvar "" %%
%USE eqvar "" _eqvar "ab" %% 111
%USE eqvar 01 _eqvar 0 %%
%USE eqvar (0) _eqvar 10 %% 111
%USE eqvar "ab" _eqvar 05"ab" %% 040
'a'1 05 %% 040
"abc" 51'a' %% 500
(<"ab")<"aa", (<"ab")<"ab" %% <0,<1
{(=𝕨)=𝕩?𝕨𝕩;'e'}˜ 'a','b',<'a','b',"a","b","aa","bb" %% (88<1,<0,<1,<0,1,0,11,00,<0,<1,<0,<1,0,1,00,11,<1,<0,<1,<0,1,0,11,00,<0,<1,<0,<1,0,1,00,11,'e','e','e','e',1,0,11,00,'e','e','e','e',0,1,00,11,'e','e','e','e',,,1,0,'e','e','e','e',,,0,1)
01˜ 'a','b',<'a','b',"a","b","aa","bb",22'a' %% 99000000000000000000000000000000000000111100000111100000111100000111100000111111110
(599909101112"a") 10203004050607080101010100 %% 102030040505608121000
# ⊐𝕩
(¯1×) 01.5 %% 0102
# 𝕨⊒𝕩
12233221185562531512434315234152 %% 088881837882848888588886
# 𝕨⍋𝕩
!"⍋: 𝕨 must be sorted" % a-¨ ¨ 10 a¨10
# 𝕨|𝕩
{x2𝕨|𝕩 ! x •internal.EEqual 𝕨𝕨|𝕩𝕩 ! x •internal.EEqual 𝕨|𝕩𝕩}˜ - π, , 0÷0, 0.5, 0.1(10)(¯4+9)+278153132
(
# AS/SA/AA over types, 2-item array; %SLOW
%USE var EE•internal.EEqual
tests - π, , 0÷0, 0.5, 0.1(10)(¯4+9)+278153132
{w𝕊x:
wlxl2¨wx
wx ! ´(EE¨) wl { w|(𝕩 V xl) (𝕨 V wl)|x (𝕨 V wl)|(𝕩 V xl) }LV xl
CLR@
}˜ tests
)
(
# 1|scalar vs 1|f64arr over float exponents %SLOW
{𝕩! (1| •internal.EEqual 1|¨) - (2𝕩)×11.51000•rand.Range 0}¨ ¯1080+2110
)
# 𝕨÷𝕩
!"÷: Unexpected argument types" % 12, "ab"÷2
50"7.299999247803105e-309" {(100𝕨)÷𝕩}•ParseFloat "0.34361186623573303" %% •ParseFloat "2.1244898576334326e-308"
50"3.8863870613495216e-308" {(100𝕨)÷𝕩}•ParseFloat "0.3815327155289232" %% •ParseFloat "1.0186248526451468e-307"
# ⍟
%USE eqvar a¯5+10 {1+𝕩 10}_eqvar a %% ¨ 5+10
%USE eqvar a¯5+10 {1+𝕩 10}_eqvar a %% ¨ 5+10
%USE eqvar a¯5+10 {1+(𝕩{!𝕩10 𝕗}) 10}_eqvar a %% ¨ 5+10
# ◶
!"◶: 𝕘 must have rank 1 when index is a number" % 1[12,34] 3
!"◶: 𝕘 must have rank 1 when index is a number" % "ab" [12,34] 3
!"⊑: Picking item at wrong rank (index 0‿0 in array of shape ⟨2⟩)" % +- 00 # shouldn't reference ⊑ but whatever
!"⊑: Picking item at wrong rank (index 1‿2 in array of shape ⟨3⟩)" % 1 ++- 01
10 +"ab""cd" ¯9 %% "cd"
1,2,0"ab""cd"1 @ %% "cd"1"ab"
# ˘ & ⎉
(1˜ 02032)50 1˜ 01002 %% 1501203/0202
!"⎉: Result rank too large" % (1˜ 02032)49 1˜ 01002
!"˘: Result rank too large" % ((2551)1)˘ 12
# `
!"`: Shape of 𝕨 must match the cell of 𝕩 (2‿2 ≡ ≢𝕨, 3‿2‿3 ≡ ≢𝕩)" % (221)+`323
!"`: Shape of 𝕨 must match the cell of 𝕩 (2‿2 ≡ ≢𝕨, 3‿3‿2 ≡ ≢𝕩)" % (221)+`332
!"`: Shape of 𝕨 must match the cell of 𝕩 (⟨⟩ ≡ ≢𝕨, 3‿3 ≡ ≢𝕩)" % 2+`33
# ´
!"´: Argument must be a list (3‿3 ≡ ≢𝕩)" % +´33
!"´: 𝕩 must be a list (3‿3 ≡ ≢𝕩)" % 2+´33
# ⌜
!"⌜: Result rank too large (200≡=𝕨, 200≡=𝕩)" % +˜(2001)1