-- Leo's gemini proxy

-- Connecting to sunshinegardens.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; lang=en

Big Questions Notation


finally, an APL for your flying saucer


only a summary, really. notes and clarifications for myself. check the link above for actual documentation. this page will probably look terrible if you don't have adequte font support for BQN glyphs. check the end of the document for setup instructions.


reference


bqn.txt


#     #        comment                       ←    \[        define
↩    \'        change                        ⇐    \?        export
→    \]        return                        ⋄    \;        statement or element separator
‿    \⎵        strand                        :     :        block header
;     ;        block body separator          @     @        null character
'"    '"       string literal                ()    ()       expression grouping
⟨⟩   \( \)     list                          {}    {}       block
𝕨𝕎   \w \W     left argument                 𝕩𝕏   \x \X     right argument
𝕤𝕊   \s \S     function self-reference       𝕗𝔽   \f \F     left operand of a modifier
𝕘𝔾   \g \G     right operand of a 2-modifier 𝕣    \R        modifier self-reference
π¯∞  \p \7 \8  used in numeric literals      •    \0        access system value
·    \:        nothing

+     +        conjugate / add               ⥊    \z        deshape / reshape
-     -        negate / subtract             ∾    \,        join / join to
×    \=        sign / multiply               ≍    \.        solo / couple
÷    \-        reciprocal / divide           ↑    \r        prefixes / take
⋆    \+        exponential / power           ↓    \c        sufixes / drop
√    \_        square root / nth root        ↕    \d        range / windows
⌊    \b        floor / minimum               «    \H        nudge / shift before
⌈    \B        ceiling / maximum             »    \L        nudge after / shift after
∧    \t        sort up / and                 ⌽    \q        reverse / rotate
∨    \v        sort down / or                ⍉    \a        transpose / reorder axes
¬    \~        not / span                    /     /        indices / replicate
|     |        absolute value / modulus      ⊏    \i        first cell / select
≤    \<        less than or equal to         ⊑    \I        first / pick
<     <        enclose / less than           ⊐    \o        classify / index of
>     >        merge / greater than          ⊒    \O        occurence count / progressive index of
≥    \>        greater than or equal to      ⍋    \T        grade up / bins up
=     =        rank / equals                 ⍒    \V        grade down / bins down
≠    \/        length / not equals           ∊    \e        mark first / member of
≡    \m        depth / match                 ⍷    \E        deduplicate / find
≢    \M        shape / not match             ⊔    \u        group indices / group
⊣    \{        identity / left               !     !        assert / assert with message
⊢    \}        identity / right

˘    \1        cells                         ⎉    \!        rank
¨    \2        each                          ⚇    \@        depth
⁼    \3        undo                          ⍟    \#        repeat
⌜    \4        table
´    \5        fold
˝    \6        inset
`     `        scan

˙    \"        constant  {𝕩⋄𝕗}               ˜    \`        self / swap  {𝕩𝔽𝕨⊣𝕩}
∘    \j        atop  {𝔽𝕨𝔾𝕩}                  ○    \k        over  {(𝔾𝕨)𝔽𝔾𝕩}
⊸    \h        before / bind  {(𝔽𝕨⊣𝕩)𝔾𝕩}     ⟜    \l        after / bind  {(𝕨⊣𝕩)𝔽𝔾𝕩}
⊘    \%        valences  {𝔽𝕩;𝕨𝔾𝕨}            ◶    \$        choose  {f←(𝕨𝔽𝕩)⊑𝕘 ⋄ 𝕨F𝕩}
⌾    \K        under {𝔾⁼∘𝔽○𝔾} {(𝔾𝕩)↩𝕨𝔽○𝔾𝕩⋄𝕩} ⎊    \^        catch

help.html

help.md


syntax


special glyphs


┌────────────────┬─────────────────────────────────────┐
│   Glyph(s)     │               Meaning               │
├────────────────┼─────────────────────────────────────┤
│ #              │ Comment                             │
│ '"             │ Character or string literal         │
│ @              │ Null character                      │
│ ¯∞π            │ Used in numeric literals            │
│ ()             │ Expression grouping                 │
│ ←              │ Define                              │
│ ⇐              │ Export                              │
│ ↩              │ Change                              │
│ →              │ Return                              │
│ ⋄, or newline  │ Statement or element separator      │
│ ⟨⟩             │ List (rank-1 array)                 │
│ ‿              │ Strand (lightweight list syntax)    │
│ {}             │ Block such as a function definition │
│ :              │ Block header                        │
│ ;              │ Block body separator                │
│ 𝕨𝕎             │ Left argument                       │
│ 𝕩𝕏             │ Right argument                      │
│ 𝕤𝕊             │ Function self-reference             │
│ 𝕗𝔽             │ Left operand of a modifier          │
│ 𝕘𝔾             │ Right operand of a 2-modifier       │
│ 𝕣              │ Modifier self-reference             │
└────────────────┴─────────────────────────────────────┘

primitives


functions


> Functions that have significant differences from APL equivalents or don't appear in APL are marked with an asterisk.


┌────────┬────────────────────┬──────────────────────────┐
│ Glyph  │      Monadic       │          Dyadic          │
├────────┼────────────────────┼──────────────────────────┤
│ +      │ Conjugate          │ Add                      │
│ -      │ Negate             │ Subtract                 │
│ ×      │ Sign               │ Multiply                 │
│ ÷      │ Reciprocal         │ Divide                   │
│ ⋆      │ Exponential        │ Power                    │
│ √      │ Square Root        │ Root                     │
│ ⌊      │ Floor              │ Minimum                  │
│ ⌈      │ Ceiling            │ Maximum                  │
│ ∧      │ Sort Up            │ And*                     │
│ ∨      │ Sort Down          │ Or*                      │
│ ¬      │ Not*               │ Span*                    │
│ |      │ Absolute Value     │ Modulus                  │
│ ≤      │                    │ Less Than or Equal to    │
│ <      │ Enclose            │ Less Than                │
│ >      │ Merge*             │ Greater Than             │
│ ≥      │                    │ Greater Than or Equal to │
│ =      │ Rank*              │ Equals                   │
│ ≠      │ Length             │ Not Equals               │
│ ≡      │ Depth*             │ Match                    │
│ ≢      │ Shape              │ Not Match                │
│ ⊣      │ Identity           │ Left                     │
│ ⊢      │ Identity           │ Right                    │
│ ⥊      │ Deshape            │ Reshape*                 │
│ ∾      │ Join*              │ Join to                  │
│ ≍      │ Solo*              │ Couple*                  │
│ ↑      │ Prefixes*          │ Take                     │
│ ↓      │ Suffixes*          │ Drop                     │
│ ↕      │ Range              │ Windows*                 │
│ »      │ Nudge*             │ Shift Before*            │
│ «      │ Nudge Back*        │ Shift After*             │
│ ⌽      │ Reverse            │ Rotate                   │
│ ⍉      │ Transpose*         │ Reorder axes*            │
│ /      │ Indices            │ Replicate                │
│ ⍋      │ Grade Up           │ Bins Up                  │
│ ⍒      │ Grade Down         │ Bins Down                │
│ ⊏      │ First Cell*        │ Select*                  │
│ ⊑      │ First              │ Pick*                    │
│ ⊐      │ Classify*          │ Index of                 │
│ ⊒      │ Occurrence Count*  │ Progressive Index of*    │
│ ∊      │ Mark Firsts        │ Member of                │
│ ⍷      │ Deduplicate        │ Find                     │
│ ⊔      │ Group Indices*     │ Group*                   │
│ !      │ Assert*            │ Assert with Message*     │
└────────┴────────────────────┴──────────────────────────┘

modifiers


┌────────┬──────────────┬────────────────────────────┬────────────────────────────────────────────────────────┐
│ Glyph  │   Name(s)    │        Definition          │                      Description                       │
├────────┼──────────────┼────────────────────────────┼────────────────────────────────────────────────────────┤
│ ˙      │ Constant     │ {𝕩⋄𝕗}                      │ Return a function that returns the operand             │
│ ˜      │ Self/Swap    │ {𝕩𝔽𝕨⊣𝕩}                    │ Duplicate one argument or exchange two                 │
│ ∘      │ Atop         │ {𝔽𝕨𝔾𝕩}                     │ Apply 𝔾 to both arguments and 𝔽 to the result          │
│ ○      │ Over         │ {(𝔾𝕨)𝔽𝔾𝕩}                  │ Apply 𝔾 to each argument and 𝔽 to the results          │
│ ⊸      │ Before/Bind  │ {(𝔽𝕨⊣𝕩)𝔾𝕩}                 │ 𝔾's left argument comes from 𝔽                         │
│ ⟜      │ After/Bind   │ {(𝕨⊣𝕩)𝔽𝔾𝕩}                 │ 𝔽's right argument comes from 𝔾                        │
│ ⌾      │ Under        │ {𝔾⁼∘𝔽○𝔾} OR {(𝔾𝕩)↩𝕨𝔽○𝔾𝕩⋄𝕩} │ Apply 𝔽 over 𝔾, then undo 𝔾                            │
│ ⊘      │ Valences     │ {𝔽𝕩;𝕨𝔾𝕩}                   │ Apply 𝔽 if there's one argument but 𝔾 if there are two │
│ ◶      │ Choose       │ {f←(𝕨𝔽𝕩)⊑𝕘 ⋄ 𝕨F𝕩}          │ Select one of the functions in list 𝕘 based on 𝔽       │
└────────┴──────────────┴────────────────────────────┴────────────────────────────────────────────────────────┘

┌─────────────┬────────┬─────────────┬────────┐
│ 1-Modifier  │ Name   │ 2-Modifier  │  Name  │
├─────────────┼────────┼─────────────┼────────┤
│ ˘           │ Cells  │ ⎉           │ Rank   │
│ ¨           │ Each   │ ⚇           │ Depth  │
│ ⌜           │ Table  │             │        │
│ ⁼           │ Undo   │ ⍟           │ Repeat │
│ ´           │ Fold   │             │        │
│ ˝           │ Insert │             │        │
│ `           │ Scan   │             │        │
└─────────────┴────────┴─────────────┴────────┘

character arithmetic


a convenient way to write non-printing characters without having to include them in your source code: for example @+10 is the newline character.


┌─────────────────┬────────────────┬───────┬──────────┬─────┐
│ Escape Sequence │ BQN Expression │  hex  │  binary  │ dec │
├─────────────────┼────────────────┼───────┼──────────┼─────┤
│ \n              │ @+10           │ 0x0A  │ 00001010 │  10 │
└─────────────────┴────────────────┴───────┴──────────┴─────┘

resources


Tutorial: BQN expressions

Tutorial: BQN Lists

Tutorial: Combinators


expressions


use parens for the left argument of a function if its compound, but never for the right argument, and never with one-argument functions.


+´ (⌽2⋆↕4) × "1001"-'0'
│    │  │      │     └─┐
│    │  │    "1001" - '0'
│    │ ↕4           │
│    2⋆─┘           │
│   ⌽─┘             │
│   └──────×────────┘
+´         │
 ├─────────┘
─┘

types


┌───────────┬────────────┐
│ Data      │ Operation  │
├───────────┼────────────┤
│ Number    │ Function   │
│ Character │ 1-modifier │
│ Array     │ 2-modifier │
└───────────┴────────────┘

lists are 1-d arrays

anything that's not an array is an `atom`


roles


Spelling          Role        Purpose
lowercase         Subject     argument or operand
Uppercase         Function    function call or operand
_leftUnderscore   1-modifier  1-modifer call
_towUnderscores_  2-modifier  2-modifier call

numeric literals such as 1 and π are `subjects`

primitive functions are `functions` (gasp).

a function's arguments are `subjects`. to call a function it must have a subject on the right, and it may have a subject on the left, which is used as the left argument.

a function call expression is a `subject`.

parentheses have have the same role as whatever's inside it.


keymap / character set


> The standard BQN keymap is shown below. Note that characters ⍎⍕↙↖⍳, included for historical or speculative reasons, are not used by BQN. And don't miss spacebar for ‿ at the bottom!


┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬─────────┐
│~ ¬ │! ⎉ │@ ⚇ │# ⍟ │$ ◶ │% ⊘ │^ ⎊ │& ⍎ │* ⍕ │( ⟨ │) ⟩ │_ √ │+ ⋆ │Backspace│
│` ˜ │1 ˘ │2 ¨ │3 ⁼ │4 ⌜ │5 ´ │6 ˝ │7   │8 ∞ │9 ¯ │0 • │- ÷ │= × │         │
├────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬──────┤
│Tab    │Q ↙ │W 𝕎 │E ⍷ │R 𝕣 │T ⍋ │Y   │U   │I ⊑ │O ⊒ │P ⍳ │{ ⊣ │} ⊢ │|     │
│       │q ⌽ │w 𝕨 │e ∊ │r ↑ │t ∧ │y   │u ⊔ │i ⊏ │o ⊐ │p π │[ ← │] → │\     │
├───────┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴──────┤
│Caps    │A ↖ │S 𝕊 │D   │F 𝔽 │G 𝔾 │H « │J   │K ⌾ │L » │: · │" ˙ │Enter     │
│lock    │a ⍉ │s 𝕤 │d ↕ │f 𝕗 │g 𝕘 │h ⊸ │j ∘ │k ○ │l ⟜ │; ⋄ │' ↩ │          │
├────────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──────────┤
│Shift      │Z ⋈ │X 𝕏 │C   │V ⍒ │B ⌈ │N   │M ≢ │< ≤ │> ≥ │? ⇐ │Shift       │
│           │z ⥊ │x 𝕩 │c ↓ │v ∨ │b ⌊ │n   │m ≡ │, ∾ │. ≍ │/ ≠ │            │
└───────────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────────────┘
                             Space: ‿

linux setup


The file bqn.kxb is for configuring XKB on Linux, or other systems using X11.


sudo cp bqn.xkb /usr/share/X11/xkb/symbols/bqn
setxkbmap -layout us,bqn -option grp:switch

https://mlochbaum.github.io/BQN/editors/index.html


browser setup


BQN language bar


fonts


my preference is BQN365, but there are a few other options.


BQN fonts


-- Response ended

-- Page fetched on Fri May 17 11:42:47 2024