War on Raze: k hacker trades a flatten for a smarter "where"

April 10, 2026
Focused male programmer working at office desk, coding efficiently.
Photo by cottonbro studio on Pexels

Short primes and a nagging flatten

A tiny k7 snippet that filters primes—x^x*/:x:2_!100—caught a programmer's eye and wouldn't let go. Short, clever, and annoyingly dependent on a language change: rank-sensitive except (^) made the compact form possible. Before that tweak the code needed an explicit raze (/,) to flatten nested results, and as the author put it bluntly, "raze bugs me." Who likes a workaround when you can have a clean operator? Nobody. Not when you can shave off a symbol and make the expression sing.

Deep where to the rescue

The rabbit hole deepens. Instead of producing nested tables and razing them, why not generate the pair products in a flat way from the start? The answer comes from another family of array languages: deep where (think Dyalog APL's ⍸). It has been reported that ngn has an experimental deep-where verb implemented on the shallow-where character (&), letting k users produce the paired indices and their products without a manual flatten. The gist walks through building a keyed matrix for 2..99, applying deep where to copy row/column keys into pairs, multiplying them, and then using rank-sensitive except to remove non-primes—no raze required. Elegant, and eerily readable once you see it.

Small change, big signal

This is the sort of language plumbing story that excites a niche crowd: a tiny operator change, a borrowed idea from APL, and a one-character win over a messy workaround. Is this just academic neatness? Not quite. It shows how ideas travel between array languages and how a single primitive can change idioms—less raze, more expressiveness. Will deep where make the leap from experimental patch to standard k? Who knows. But for anyone who has muttered at an extra comma, this feels like justice served—clean, fast, and oddly satisfying.

Sources: gist.github.com, Hacker News