# Tips for golfing in BQN

What general tips do you have for golfing in BQN? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to BQN (e.g. "remove comments" is not an answer).

At the moment of writing, the official BQN site is the most comprehensive resource for learning BQN. BQN is the Language of the Month for December 2021; you can find some more information and resources on the LotM page.

• Maybe link to BQNcrate? Also, many tips for golfing in APL and J may be relevant.
Dec 1 '21 at 1:57
• Does "golfing in BQN" mean "reduce the amount of uneaten bacon" or "reduce the weight gained from eating said bacon"? Dec 1 '21 at 1:58
• @tjjfvi I thought it was "playing golf on a bacon field, or dressed with bacon".. I don't know if the language was named on purpose, but I came here for this pun ^^ Dec 1 '21 at 12:37

# Use ⊒˜ instead of ↕∘≠

Suggested by Marshall

⊒(progressive index of) consumes indices given any array, providing a range of the array's size when applied with selfie. You can save a byte by using it in any place instead of ↕∘≠.

Try it!

# BQN's combinators

BQN allows Lisp style functional programming and hence comes with its own set of combinator symbols. Some basic patterns can be simplified using combinators instead of trains:

Lambda Train Combinator
{𝕩 F 𝕩} ⊢ F ⊢ F˜
{F G 𝕩} F G F∘G, F○G
{𝕩 F (G 𝕩)} ⊢ F G F⟜G
{(F 𝕩) G 𝕩} F G ⊢ F⊸G
{𝕩 F 𝕨} ⊢ F ⊣ F˜(See: this APL tip, replace ⍨ with ˜)
{F 𝕨 G 𝕩} F G F∘G
{(G 𝕨) F (G 𝕩)} G F G F○G
{(𝕨 F 𝕩) G (𝕨 H 𝕩)} F G H F⊸G⟜H

You can use the shorter one between the train and the combinator versions wherever necessary, and sometimes in conjunction.

For a more visual explanation of the combinators, see here