{
 "schema_version": 1,
 "generated": "2026-10-25",
 "id": "chenglou-handwired--understand-if-else-as-matrix-math",
 "repo": "chenglou/handwired",
 "repo_url": "https://github.com/chenglou/handwired",
 "repo_slug": "chenglou-handwired",
 "title": "See how an if-else becomes arithmetic",
 "page_title": "How to see how an if-else becomes arithmetic with Handwired",
 "summary": "Follow the README example that rewrites a ternary with ReLU so both branches compute.",
 "who": "A developer who wants to understand the core trick before reading the code.",
 "problem": "The idea of code as weights is abstract without a worked example.",
 "outcome": "A clear picture of how conditions become differentiable math.",
 "steps": [
  "Read the How It Works section and the const a = 5 example",
  "Work out above4 = Math.max(0, a - 4) - Math.max(0, a - 5) by hand for a few values of a",
  "See how above4 picks between 10 and 12 with both branches computed",
  "Open src/ and look for where these primitives are collected into one matmul"
 ],
 "agent_prompt": "Explain the Handwired How It Works example step by step with a few values of a, then find in src/ where such programs are collected into matmul and reglu.",
 "agents": [
  "any"
 ],
 "difficulty": "Beginner",
 "time": "15 minutes",
 "basis": "readme",
 "caveat": "",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "typescript",
 "requirements": [
  "Bun to run the demos locally",
  "A browser for the live demos; WebGPU is optional"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/chenglou-handwired/understand-if-else-as-matrix-math/",
 "md": "https://dedupedai.com/use-cases/chenglou-handwired/understand-if-else-as-matrix-math/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/chenglou-handwired--understand-if-else-as-matrix-math.json",
 "api_version": "v1"
}
