BQN "Macros" with •Decompose (2023)
saltysylvi.github.io·17w·
Discuss: Hacker News

02/04/2023

Using •Decompose to create functions with access to the syntax tree of their arguments.


I just learned about the BQN system function •Decompose, and it’s really cool. As its name suggests, •Decompose breaks down a compound function, giving access to the parts of the function and specifying how they were combined. In other words, it grants us access to the syntax tree of a tacit function, sort of like a Lisp macro.

This is a powerful ability! It allows us to do dark magic in opposition to BQN’s “no magic” design philosophy.

There are limitations, however. •Decompose only does something useful with tacit functions. It doesn’t delay evaluation of its argument or anything like that. So i…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help