uCBQN/test/cases/syntax.bqn
2023-05-21 16:51:42 +03:00

55 lines
3.3 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.

# body usage
a"zero""one" !aa{𝕩?1𝕨;0𝕨}¨01
!"No header matched argument" % { 𝕊ab: a+b ; d𝕊abc: a+b+c} 3
!"No header matched argument" % {d𝕊ab: a+b ; 𝕊abc: a+b+c} 2
{𝕊ab: a+b ; 𝕊abc: a+b+c} 2 %% 1
{𝕊ab: a+b ; 𝕊abc: a+b+c} 3 %% 3
{4=𝕩? "four" ; "idk: "𝕩}4+3 %% "four"
{4=𝕩? "four" ; "idk: "𝕩}3+3 %% "idk: "3,4,5
{𝕩+1 4=𝕩? 1𝕩 ; 2𝕩}3+3 %% 1,456
{𝕩+1 4=𝕩? 1𝕩 ; 2𝕩}4+3 %% 2,456
{𝕩𝕩+1 4=𝕩? 1𝕩 ; 2𝕩}3+3 %% 1,456
{𝕩𝕩+1 4=𝕩? 1𝕩 ; 2𝕩}4+3 %% 2,456
{1?"abc" ; "def"} %% "abc"
{0?"abc" ; "def"} %% "def"
{123456 1{2} 1 1{1+5}} %% 16
# forks with funky tines
{(𝕩 "ab" 9) {fgh𝕨 TF G H T𝕩 (𝕩𝕩)T𝕩} 3}¨ 222 %% 222012,012,12012,012,012,12012,012,012,012,"ab",12012,012,012,"ab","ab","ab","ab","ab","ab",012,"ab",12012,012,012,"ab","ab","ab","ab","ab","ab","ab","ab"
# body inverses
!"No monadic undo header found for this block" % {𝕩} 1
!"No dyadic F⁼ undo header found for this block" % 1 {𝕩} 1
!"No dyadic F˜⁼ undo header found for this block" % 1 {𝕩}˜ 1
!"No monadic undo header found for this 1-modifier block" % +{𝔽𝕩} 1
!"No dyadic F⁼ undo header found for this 1-modifier block" % 1 +{𝔽𝕩} 1
!"No dyadic F˜⁼ undo header found for this 1-modifier block" % 1 +{𝔽𝕩}˜ 1
!"No monadic undo header found for this 2-modifier block" % +{𝔽𝔾𝕩}+ 1
!"No dyadic F⁼ undo header found for this 2-modifier block" % 1 +{𝔽𝔾𝕩}+ 1
!"No dyadic F˜⁼ undo header found for this 2-modifier block" % 1 +{𝔽𝔾𝕩}+˜ 1
# assignment
!"Reading variable before its defined" % {a} a1
!"↩: Reading variable that hasn't been set" % {a10} a2
!"↩: Updating variable that hasn't been set" % {a10} a2
!"↩: Reading variable that hasn't been set" % {a (10)˙} a2
!"Assignment: Mismatched shape for spread assignment" % ab1
!"Assignment: Mismatched shape for spread assignment" % ab123
!"Assignment: Mismatched shape for spread assignment" % a<1
!"Assignment: Mismatched shape for spread assignment" % 1
!"Assignment: Mismatched shape for spread assignment" % 1
%%
# namespaces
a,b•BQN"{x⇐1‿2⋄a⇐3‿4⋄y←5‿6⋄b⇐7‿8}" ab %% 34 78
# immediate modifiers
!"No key found" % X12{a𝕗} bx
X12{a𝕗} ax +´a %% 3
X12{a𝕘-𝕗}34 ax +´a %% 4
a12{a𝕩+𝕗+𝕘}34 1 a %% 57
a12{a𝕩+𝕗} 1 a %% 23
# arguments
{x𝕩𝕩@𝕩x}-10 %% @-10