Skip to content
Tech News
← Back to articles

Saying Goodbye to one line of APL

read original get APL Programming Book → more articles
Why This Matters

This article highlights a significant milestone in the use of APL for complex 3D game development, demonstrating how a single line of code can efficiently handle intricate tasks like face visibility detection in voxel rendering. It underscores the power and expressiveness of APL, inspiring developers to explore its capabilities for high-performance applications in the tech industry. For consumers, this showcases the potential for more optimized and innovative gaming experiences driven by advanced programming techniques.

Key Takeaways

Posted on May 10, 2026 by Kyle Croarkin

When was the last time one line of code made you realize how far you’ve come?

For context, I’ve been writing a voxel game in Dyalog APL for nearly 7 months now. I started learning APL 9 months ago to be able to do this. Anything that is able to be done in APL I attempt to do purely in APL in a style befitting for APL. This includes Perlin noise terrain generation, converting internal representations of blocks into geometry to be rendered, frustum culling, collision and a lot more. It is currently able to reach >60 FPS on my MacBook with a render distance of 12, with most of the bottlenecks being silly choices from my part as I learn APL while doing this.

One line of code in this project that I greatly enjoy is the code that checks what faces of a chunk are exposed so that they can be selected and passed to the vertex buffer for the chunk. I like it so much that I even had a section dedicated to it in my talk at DYNA26

↑[0]{edges∨solid>⍵}¨0 1 2∘.{⍵⌽[⍺]solid}¯1 1

Very broad, what it does can be broken up like this.

We have 2 3d boolean arrays solid and edges of size 16 128 16 that represent whether or not a solid block is found in each position. edges only checks if a solid block is found on the edges of the chunk.

0 1 2∘.{⍵⌽[⍺]solid}¯1 1 shifts the solid array in each of the 3 axes 0 1 2 back and forth ¯1 1 . The outer product of it returns a 2d array where each row specifies an axes and the rotation.

solid>⍵}¨ compares each shift with the original array. This being true indicates that the face is visible.

{edges∨ makes it also set all edges to be visible. This is important since shifting wraps around the edges of the array that it shifts towards.

... continue reading