feat(misc): Neural net in 30 lines of K - #501
Conversation
Demonstrates Claude generating, explaining, and self-repairing code in Kona (K3) — an array programming language with near-zero LLM training data. Includes a hand-tested XOR reference implementation that trains and converges on Android/Termux. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Orb Code Review (powered by GLM 5.1 on Orb Cloud) New cookbook: Neural Net Inference in 30 Lines of K. A creative exploration of Claude's ability to generate code in the K array programming language. Observations1. Creative and educational (Positive) 2. The K reference card pattern (Positive) 3. Subprocess execution of generated code (Medium) result = subprocess.run(["k", k_file], capture_output=True, text=True, timeout=30)Running AI-generated code via subprocess has inherent risks. While K is a relatively safe language (no filesystem access by default), the notebook should note this consideration. The 30-second timeout is a good safety measure. 4. F-string syntax issue (Bug) messages=[{{"role": "user", "content": generation_prompt}}]Double braces SummaryFun and educational cookbook that demonstrates both Claude's capabilities and the reference-card prompting technique. The K language angle makes it memorable. Assessment: approve |
Summary
A cookbook demonstrating Claude generating, explaining, and self-repairing neural network code in Kona (K3) — Arthur Whitney's array programming language.
Why this is interesting
K has virtually zero presence in LLM training data compared to Python. The notation is so dense that
W1 _dot\: xireplaces what would be a nested for-loop in most languages. This is a genuine stress test of Claude's ability to reason about unfamiliar, terse array languages — not just parrot Python.Verified on hardware
The reference K code was tested and confirmed working on Kona running on Android/Termux (ARM64). Output:
Fun fact
This PR was written entirely from an Android phone running Termux + Claude Code. The K code was debugged live in a Kona REPL on the same phone. No laptop involved.
🤙 Second PR from the phone. First one was anthropics/courses#142.
🤖 Generated with Claude Code