This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| === docs/HVM.md === | |
| # HVM | |
| HVM is a fast C implementation of the Interaction Calculus. | |
| It is a pure functional runtime like Haskell's GHC, with some peculiarities: | |
| - Variables are affine, meaning they can only occur, at most, once. | |
| - To copy values, linear dups are used, where 2 vars refer to the same value. | |
| - Accessing a dup triggers an incremental, layer-by-layer copy of the value. | |
| - Lambdas can also be cloned incrementally by linear dups. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Write a complete λ-Calculus evaluator in TypeScript. Use {$:"Lam",...} etc. to | |
| //emulate ADTs. Use switch for pattern-matching. Implement wnf, wnf_app, snf, | |
| //show, parse, main, and more. Use HOAS (NO SUBST()). Field names must have | |
| //exactly 3 letters. Test it on 2^2 (church-encoded). Print the result. | |
| type Term = | |
| | { tag: 'Var', idx: number } | |
| | { tag: 'Abs', body: (v: any) => any } | |
| | { tag: 'App', left: any, right: any }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### 256-Diverse-Games-Prompts | |
| Remake Pac-Man: navigate a yellow circle through a dot-filled maze, eat all pellets to clear levels, avoid four ghosts with unique AI (chase/ambush/flank/wander), grab power pellets to eat blue ghosts, fruit bonuses, increasing speed, score counter, three lives, side tunnels wrap around | |
| Remake Space Invaders: rows of aliens march sideways and descend, accelerating as fewer remain, player moves a cannon left/right firing upward, aliens shoot randomly, four destructible shields erode per hit, UFO crosses top for bonus, clear all aliens to advance, three lives, score | |
| Remake Frogger: a frog crosses multi-lane roads dodging cars then hops onto logs, turtles, and gators crossing a river, reach five home bays before time runs out, hazards include submerging turtles and snakes, bonus flies in bays, progressive difficulty, five lives, high score | |
| Remake Q*bert: hop on a pyramid of cubes changing their color on landing to match a target, avoid Coily the snake, Ugg/Wrongway on cube sides, an |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //# Tree sum: allocates a complete binary tree with U32 leaves 0,1,2,... | |
| //# then sums all values in parallel. Tests heap-heavy parallel workloads. | |
| // | |
| //type Tree() { | |
| // leaf{U32} | |
| // node{Tree, Tree} | |
| //} | |
| // | |
| //def build(d: U32, x: U32) -> Tree: | |
| // match d: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import json | |
| import os | |
| import sys | |
| import time | |
| import urllib.error | |
| import urllib.request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ~/.claude/skills/codex/SKILL.md | |
| ``` | |
| --- | |
| name: codex | |
| description: Drives OpenAI's Codex CLI as a specialist executor in a driver/specialist loop. Use when user asks to "talk to codex", "ask codex", "codex review", "have codex look at this", or wants deep analysis/implementation delegated. Also use proactively for code review and architecture validation. | |
| context: fork | |
| allowed-tools: | |
| - Bash(codex *) | |
| - Bash(cat /tmp/claude/codex-*) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // LamBit.ts | |
| // ========= | |
| // A minimal linear functional language with binary pattern matching. | |
| // | |
| // Func ::= | |
| // | Mat ::= "λ" "{" "0" ":" Func ";" "1" ":" Func ";" "}" | |
| // | Lam ::= "λ" Name "." Func | |
| // | Ret ::= Term | |
| // | |
| // Term ::= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const Nat = null; | |
| export const List = null; | |
| export const Char = null; | |
| export const String = null; | |
| export function $steps(n, acc) { | |
| while (true) { | |
| if (((n >>> 0) === (1 >>> 0)) ? 1 : 0) { | |
| return acc; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| λn. | |
| match n: | |
| case #Z: | |
| A | |
| case #S{a}: | |
| B(a) | |
| //λ{#Z:A;#S:λa.B(a)} | |
| λn. | |
| match n: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| The most atomic way to train and inference a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
NewerOlder