diff --git a/docs/journals/2026-10-12_heldout_token_benchmark.md b/docs/journals/2026-10-12_heldout_token_benchmark.md new file mode 100644 index 0000000..e7d764e --- /dev/null +++ b/docs/journals/2026-10-12_heldout_token_benchmark.md @@ -0,0 +1,62 @@ +# Held-out token benchmark (2026-10-12) + +## Goal + +Test whether the 0.983x-against-Python result from #135 holds on tasks the +built-ins were not shaped for (Lain's rules). No language changes. + +## Freeze + +The spec commit is **`f510cd0199326e4aacf206e0b08981978808b042`**: +"heldout-v0: freeze 32 held-out task specs (no solutions)". It was made +before any reference was written or anything was measured. + +| File | SHA-256 | +|---|---| +| tasks/README.md | `4441e1e5c4e906a55fe595c382a7d2ef784045e9c1b1230f38887d70bf8318f1` | +| tasks/build_specs.py | `dcea7d494d8b146ae032456b1f8822364d488c3d8596f7d829aecb21a75148f8` | +| tasks/manifest.json | `962fa8198b11ac3ff1066abf35be6dcb87ad8a852574edfc46fee17a0ab9e67e` | + +`TestHeldoutSpecsFrozen` enforces these hashes. + +## Built after the freeze + +- `cmd/heldoutverify`: + - runs each reference in a fresh sandbox; + - HowlFrame uses a governed build, `-run-bc` and scoped `filesystem:read`/`write` grants; + - requires the file set to be exactly the inputs plus the output, the inputs unchanged, and the output matching. +- `count_tokens.py` imports v0's stripping and offline guard unchanged. +- `run.sh`, `gaps.json` and `verification_test.go`. +- 32 references each in Python, JS and Go, and 30 in HowlFrame. The other 2 are recorded gaps. + +## Result + +| | HowlFrame / Python, median per-task ratio | Wins / ties / losses | +|---|---|---| +| cl100k_base | **1.309x** | 0 / 1 / 29 | +| o200k_base | **1.299x** | 0 / 1 / 29 | + +Against JS: 1.087x / 1.016x. Against Go: 0.499x / 0.493x. + +**The v0 result (0.983x) does not generalize.** CSV is worst at 1.84x and reshape best at 1.08x. + +## Gaps and findings + +- **h31/h32:** no directory walking. h32 would also need string ordering. +- **Sugar not expanded in some arguments:** sugar inside `write_file`/`to_lower` + arguments fails to lower, because those parents are missing from the sugar contexts. +- **`or` is not short-circuit.** +- **`map_get` on a missing key returns `""`.** +- **Value semantics:** lists taken out of a map must be written back. + +## Next (not done here, needs its own poll) + +These are the hot spots, but adding them would again shape features on a +corpus. Any language work should be judged on a *new* held-out set. + +- `index_of`/slice; +- counting or default `map_get`; +- `map`/`filter`/`sum`/`min`/`max`/`reverse`; +- dir listing. + +There were no live LLM runs and no H1 decision; #90 is unchanged, and so are HFIR and `-compile-bc`. diff --git a/experiments/token-efficiency-heldout-v0/REPORT.md b/experiments/token-efficiency-heldout-v0/REPORT.md new file mode 100644 index 0000000..c7e34ed --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/REPORT.md @@ -0,0 +1,206 @@ +# Held-out token-efficiency benchmark (heldout-v0): measure only + +**HowlFrame's v0 token advantage does not generalize.** On a fresh, frozen +corpus of 32 tasks: + +- **Python:** HowlFrame uses **more tokens than Python on 29 of the 30 tasks it can + express** and ties on 1, with both tokenizers. The median per-task ratio is + **1.309x** (`cl100k_base`) and **1.299x** (`o200k_base`). That compares with + **0.983x** on the v0 corpus, which the #135 built-ins were shaped for. +- **JavaScript:** roughly at parity, at 1.087x and 1.016x. +- **Go:** HowlFrame still beats standalone Go on every solved task, at about 0.50x. +- **Gaps:** two tasks, both file walking, cannot be expressed in HowlFrame on + main at all. + +This measures source size only: no model success, no generation cost, and no +live LLM/API calls. There is no H1 decision, and #90 stays Partial. No +built-in, syntax, compiler or VM change is part of this PR. + +## Corpus and freeze + +- **Size:** 32 tasks in 7 categories (text, csv, aggregate, parse, validate, + reshape, walk). None reuses the three v0 release workflows. See + [tasks/README.md](tasks/README.md). +- **Freeze:** the specs (`tasks/manifest.json`, `tasks/build_specs.py`, + `tasks/README.md`) were committed in **`f510cd01`** before any reference was + written or anything was measured. Their SHA-256 hashes are recorded in the + journal and enforced by `TestHeldoutSpecsFrozen`. +- **Expected outputs:** these come from a spec-time oracle in `build_specs.py`. It is + part of the freeze and is never counted or verified as a reference. +- **Not frozen:** the verifier pre-creates an empty `out/` directory, and the + sandbox contains only the task inputs. + +## Method + +| Element | Setup | +|---|---| +| Tokenizers | `tiktoken==0.8.0`, `cl100k_base` and `o200k_base`, offline cache only | +| Counting and stripping | Imports v0's `count_tokens.py` (`strip_comments`, offline guard) unchanged | +| Python, JS, Go references | Idiomatic, standard library only, not token-minimized, same style as v0. Go files are standalone `package main` with `//go:build ignore` | +| HowlFrame references | Features on main `24f6a10f` only | + +`cmd/heldoutverify` replays every reference in a fresh sandbox: + +- **HowlFrame** goes through `howlframe build --profile governed`, then `-run-bc` with + only `filesystem:read=/in` and `filesystem:write=/out`. +- **Python/Node** run as host processes. **Go** is compiled from the single file and then run. + +After each run, the verifier requires all of the following: + +- the sandbox's file set is exactly the inputs plus the one output; +- the inputs are unchanged; +- the output matches: exact text after removing trailing newlines, or decoded-JSON equality. + +Results are written to `results/verification.json`, which records the SHA-256 of each source. +The counter refuses unverified or changed sources. `TestHeldoutVerificationCoverage` enforces: + +- every task × language is either a passing entry with a matching hash or a HowlFrame gap in + `gaps.json` that has a reason and no solution file; +- there are no duplicates. + +Reproduce with `experiments/token-efficiency-heldout-v0/run.sh` (`TOKBENCH_PYTHON` selects the interpreter). + +Pass counts: **HowlFrame 30/30 expressible (2 gaps), Python 32/32, JavaScript 32/32, Go 32/32.** + +## Results + +Medians are over the 30 HowlFrame-solved tasks. The all-32 median is shown in parentheses. + +| Encoding | HowlFrame | Python | JavaScript | Go | +| --- | ---: | ---: | ---: | ---: | +| cl100k_base median | 72.5 | 63.0 (62.5) | 69.0 (69.0) | 162.5 (162.5) | +| cl100k_base mean | 85.5 | 60.8 | 71.6 | 162.0 | +| o200k_base median | 72.5 | 63.0 (62.5) | 73.0 (73.0) | 164.5 (164.5) | +| o200k_base mean | 85.6 | 61.1 | 76.3 | 163.6 | + +HowlFrame against each language, over the 30 solved tasks. A ratio above 1 means HowlFrame uses more tokens. + +| Encoding | vs | Median per-task ratio | Ratio of medians | HowlFrame wins / ties / losses | Gaps | +| --- | --- | ---: | ---: | ---: | ---: | +| cl100k_base | Python | **1.309** | 1.151 | **0 / 1 / 29** | 2 | +| cl100k_base | JavaScript | 1.087 | 1.051 | 6 / 1 / 23 | 2 | +| cl100k_base | Go | 0.499 | 0.446 | 30 / 0 / 0 | 2 | +| o200k_base | Python | **1.299** | 1.151 | **0 / 1 / 29** | 2 | +| o200k_base | JavaScript | 1.016 | 0.993 | 13 / 0 / 17 | 2 | +| o200k_base | Go | 0.493 | 0.441 | 30 / 0 / 0 | 2 | + +If the two gaps are counted as losses, the result against Python is 0 / 1 / 31 out of 32. +Comment and blank-line stripping changes only the Go numbers, which go to 0.519/0.513. + +**Compared with v0:** + +| Corpus | HowlFrame / Python, median per-task ratio | HowlFrame wins against Python | +|---|---|---| +| v0 (#135) | 0.983x on both encodings | 44 wins, 16 ties, 0 losses | +| Held-out | 1.309x / 1.299x | 0 wins, 1 tie, 29 losses | + +The v0 result was produced by built-ins tuned on that corpus. It does not +carry over to unseen workflows. + +### By category (`cl100k_base`; `o200k_base` is within 0.1 except where shown) + +| Category | n | HowlFrame solved | HowlFrame mean | Python mean | JavaScript mean | Go mean | Median HF/Py ratio | +| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | +| csv | 5 | 5 | 135.0 | 73.0 | 89.0 | 185.6 | **1.843** (1.817) | +| aggregate | 5 | 5 | 81.8 | 53.6 | 71.8 | 152.4 | 1.476 | +| parse | 5 | 5 | 81.2 | 57.8 | 72.0 | 152.8 | 1.397 | +| text | 5 | 5 | 58.4 | 47.0 | 50.8 | 119.2 | 1.227 (1.200) | +| validate | 5 | 5 | 84.0 | 71.8 | 80.4 | 187.8 | 1.111 | +| reshape | 5 | 5 | 72.4 | 61.8 | 65.6 | 174.2 | 1.079 | +| walk | 2 | **0** | gap | n/a | n/a | n/a | n/a | + +### Per task (raw tokens, cl100k_base/o200k_base) + +| Task | Category | HowlFrame | Python | JS | Go | HF/Py | +|---|---|---:|---:|---:|---:|---:| +| h01 | text | 54/54 | 44/44 | 49/55 | 112/114 | 1.23 | +| h02 | text | 70/70 | 40/40 | 43/47 | 138/139 | 1.75 | +| h03 | text | 66/66 | 62/62 | 61/65 | 125/126 | 1.06 | +| h04 | text | 66/66 | 53/55 | 61/65 | 133/138 | 1.25 | +| h05 | text | 36/36 | 36/36 | 40/45 | 88/89 | 1.00 | +| h06 | csv | 122/122 | 71/72 | 74/79 | 165/166 | 1.72 | +| h07 | csv | 144/144 | 82/84 | 89/96 | 206/211 | 1.76 | +| h08 | csv | 127/127 | 64/64 | 81/87 | 186/187 | 1.98 | +| h09 | csv | 129/129 | 70/71 | 96/100 | 185/186 | 1.84 | +| h10 | csv | 153/153 | 78/78 | 105/110 | 186/187 | 1.96 | +| h11 | aggregate | 137/137 | 71/71 | 96/101 | 224/225 | 1.93 | +| h12 | aggregate | 92/92 | 67/67 | 91/97 | 154/156 | 1.37 | +| h13 | aggregate | 62/62 | 42/42 | 60/64 | 133/134 | 1.48 | +| h14 | aggregate | 56/56 | 50/50 | 53/57 | 124/125 | 1.12 | +| h15 | aggregate | 62/62 | 38/38 | 59/63 | 127/128 | 1.63 | +| h16 | parse | 109/109 | 59/59 | 84/89 | 152/153 | 1.85 | +| h17 | parse | 88/88 | 63/63 | 86/90 | 145/146 | 1.40 | +| h18 | parse | 62/62 | 54/54 | 57/61 | 126/127 | 1.15 | +| h19 | parse | 88/88 | 63/63 | 81/86 | 181/182 | 1.40 | +| h20 | parse | 59/60 | 50/51 | 52/57 | 160/163 | 1.18 | +| h21 | validate | 64/65 | 61/61 | 68/72 | 173/174 | 1.05 | +| h22 | validate | 99/100 | 72/73 | 73/78 | 197/201 | 1.38 | +| h23 | validate | 80/80 | 72/72 | 83/87 | 154/156 | 1.11 | +| h24 | validate | 73/73 | 69/69 | 74/80 | 218/220 | 1.06 | +| h25 | validate | 104/104 | 85/85 | 104/109 | 197/198 | 1.22 | +| h26 | reshape | 63/63 | 59/59 | 64/68 | 175/176 | 1.07 | +| h27 | reshape | 68/68 | 63/63 | 61/65 | 181/182 | 1.08 | +| h28 | reshape | 97/97 | 64/64 | 70/74 | 183/184 | 1.52 | +| h29 | reshape | 72/72 | 65/66 | 65/69 | 177/178 | 1.11 | +| h30 | reshape | 62/62 | 58/58 | 68/72 | 155/156 | 1.07 | +| h31 | walk | gap/gap | 41/41 | 54/58 | 141/142 | gap | +| h32 | walk | gap/gap | 57/57 | 109/114 | 196/198 | gap | + +## Hot spots + +These are `cl100k_base` counts of source fragments. They are not an additive attribution. + +1. **No index or slice primitives (csv: 1.84x).** Finding a column takes + about 19 tokens for the header binding plus a 28-token loop of + `for`/`when`/`set`/`inc`. Python does it in 15 tokens with `header.index("email")`. + Skipping the header needs a second counter and `(when (> i 0) …)`, 14 tokens + against 4 for `lines[1:]`. +2. **Counting into a map (aggregate, parse, csv).** Each count is + `(map_set counts k (+ (if (map_has counts k) (map_get counts k) 0) 1))`, + about 25 tokens, against Python's `Counter(` at 4. A missing `map_get` returns + `""`, not nil, so `nz` cannot provide a default here. +3. **Imperative accumulation instead of map/filter/reduce (every category).** + - Each transform pays `out (list)` + `(for x xs (append out …))` + `(str_join out "\n")`, + about 21 tokens. Python's generator expression inside `"\n".join(…)` costs 12. + - Reversal is a 22-token `while`/`dec` loop against `reversed(lines)` at 4. + - min/max/sum are manual loops. + - There is no `map`, `filter`, `sum`, `min`, `max`, `reverse` or `index_of`. + +## Gaps and findings (recorded, not fixed) + +- **h31 and h32 (walk):** HowlFrame has no directory listing or walking construct, + so neither task can be expressed. h32 would also need string ordering: + `<` rejects strings with `TYPE_ERROR`, and there is no sort. +- **Sugar inside some call arguments:** + - Inside `write_file` or `to_lower` arguments, `str_replace`/`read_text` is not + expanded. The governed build fails with "no lowering for construct". + - Their parents are missing from `isSugarExprContext`. + - Workaround used in h05 and h12: bind the value first. +- **`or` evaluates both operands:** h07's `(or (= i 0) (>= (to_int …) 30))` raised a + `CONVERSION_ERROR` on the header row. Rewritten with `if`. +- **Value semantics:** `append` on a list taken out of a map does not update the + map, so h28 has to write the list back with `map_set`. + +## Threats to validity + +- **One author:** the same author wrote the specs, the oracle and all 122 references. + The specs were frozen first, but that author has seen HowlFrame's + weaknesses, and the task choice may lean towards Python idioms (CSV, + `Counter`, slicing). +- **Fixtures:** small, valid inputs only. CSV has no quoting; text has no Unicode edge cases. +- **Proxy only:** these are tokenizer proxies, not model generation cost or correctness. +- **Isolation:** Python, JS and Go run as host processes, with the same lack of host + isolation as v0. The verifier only checks the sandbox file set afterwards. + HowlFrame runs under scoped VM filesystem grants. +- **Small samples:** each category has n = 5, so category means are noisy. + +## Repository validation status + +All of these were run locally on the box, outside a sandbox, with `GOCACHE=/tmp/hf-token-go-cache`: + +- `go build ./... && go vet ./... && go test -count=1 ./...`: exit 0. +- `go test -count=1 ./experiments/...`: passes. This includes `TestHeldoutVerificationCoverage` and `TestHeldoutSpecsFrozen`. +- `experiments/token-efficiency-heldout-v0/run.sh`: exit 0, with 122 of 122 verified references passing. +- `experiments/token-efficiency-v0/run.sh`: exit 0. v0 is unchanged. + +See the [journal](../../docs/journals/2026-10-12_heldout_token_benchmark.md). diff --git a/experiments/token-efficiency-heldout-v0/cmd/heldoutverify/main.go b/experiments/token-efficiency-heldout-v0/cmd/heldoutverify/main.go new file mode 100644 index 0000000..ce5535c --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/cmd/heldoutverify/main.go @@ -0,0 +1,213 @@ +// Command heldoutverify replays every held-out reference in a fresh sandbox +// and compares its single output with the frozen expected value. +package main + +import ( + "bytes" + "context" + "crypto/sha256" + "encoding/json" + "flag" + "fmt" + "io/fs" + "os" + "os/exec" + "path/filepath" + "reflect" + "sort" + "strings" + "time" +) + +type Task struct { + ID string `json:"id"` + Category string `json:"category"` + Inputs map[string]string `json:"inputs"` + Output string `json:"output"` + Kind string `json:"kind"` + Expected json.RawMessage `json:"expected"` +} + +type Gap struct { + Task string `json:"task"` + Lang string `json:"lang"` + Reason string `json:"reason"` +} + +type Result struct { + Task string `json:"task"` + Lang string `json:"lang"` + Pass bool `json:"pass"` + SHA256 string `json:"sha256"` + Detail string `json:"detail,omitempty"` +} + +var exts = map[string]string{"howl": "howl", "python": "py", "js": "js", "go": "go"} + +func main() { + root := flag.String("root", "experiments/token-efficiency-heldout-v0", "benchmark root") + howl := flag.String("howlframe", "/tmp/howlframe", "HowlFrame binary") + flag.Parse() + var manifest struct{ Tasks []Task } + must(readJSON(filepath.Join(*root, "tasks/manifest.json"), &manifest)) + var gaps []Gap + must(readJSON(filepath.Join(*root, "gaps.json"), &gaps)) + gapped := map[string]bool{} + for _, g := range gaps { + gapped[g.Task+"/"+g.Lang] = true + } + work, err := os.MkdirTemp("", "hf-heldout-verify-") + must(err) + fmt.Println("Replay artifacts:", work) + var results []Result + failed := false + for _, lang := range []string{"howl", "python", "js", "go"} { + passed, total := 0, 0 + for _, t := range manifest.Tasks { + if gapped[t.ID+"/"+lang] { + continue + } + total++ + src, _ := filepath.Abs(filepath.Join(*root, "solutions", lang, t.ID+"."+exts[lang])) + data, readErr := os.ReadFile(src) + r := Result{Task: t.ID, Lang: lang, SHA256: fmt.Sprintf("%x", sha256.Sum256(data))} + if readErr != nil { + r.Detail = readErr.Error() + } else { + r.Detail = verify(filepath.Join(work, lang+"-"+t.ID), src, lang, *howl, t) + r.Pass = r.Detail == "" + } + if r.Pass { + passed++ + } else { + failed = true + } + fmt.Printf("%s %s pass=%v %s\n", lang, t.ID, r.Pass, r.Detail) + results = append(results, r) + } + fmt.Printf("%s: %d/%d passed\n", lang, passed, total) + } + out, _ := json.MarshalIndent(results, "", " ") + must(os.MkdirAll(filepath.Join(*root, "results"), 0o755)) + must(os.WriteFile(filepath.Join(*root, "results/verification.json"), append(out, '\n'), 0o644)) + if failed { + os.Exit(1) + } +} + +func verify(dir, src, lang, howl string, t Task) string { + if err := os.MkdirAll(filepath.Join(dir, "out"), 0o755); err != nil { + return err.Error() + } + for p, content := range t.Inputs { + full := filepath.Join(dir, p) + os.MkdirAll(filepath.Dir(full), 0o755) + if err := os.WriteFile(full, []byte(content), 0o644); err != nil { + return err.Error() + } + } + absDir, _ := filepath.Abs(dir) + var cmd []string + switch lang { + case "howl": + art := filepath.Join(filepath.Dir(absDir), filepath.Base(absDir)+".hfbc") + if o, err := run(absDir, 30*time.Second, howl, "build", "--profile", "governed", src, "-o", art); err != nil { + return "build: " + o + } + cmd = []string{howl, "-run-bc", "-allow-caps", "filesystem:read=" + filepath.Join(absDir, "in") + ",filesystem:write=" + filepath.Join(absDir, "out"), art} + case "python": + cmd = []string{"python3", src} + case "js": + cmd = []string{"node", src} + case "go": + bin := absDir + ".bin" + if o, err := run(filepath.Dir(absDir), 60*time.Second, "go", "build", "-o", bin, src); err != nil { + return "go build: " + o + } + cmd = []string{bin} + } + if o, err := run(absDir, 10*time.Second, cmd[0], cmd[1:]...); err != nil { + return "run: " + o + } + // Exactly the inputs (unchanged) plus the one output may exist. + var files []string + filepath.WalkDir(absDir, func(p string, d fs.DirEntry, err error) error { + if err == nil && !d.IsDir() { + rel, _ := filepath.Rel(absDir, p) + files = append(files, filepath.ToSlash(rel)) + } + return nil + }) + want := []string{t.Output} + for p := range t.Inputs { + want = append(want, p) + } + sort.Strings(files) + sort.Strings(want) + if !reflect.DeepEqual(files, want) { + return fmt.Sprintf("file set %v, want %v", files, want) + } + for p, content := range t.Inputs { + got, _ := os.ReadFile(filepath.Join(absDir, p)) + if string(got) != content { + return "input modified: " + p + } + } + got, err := os.ReadFile(filepath.Join(absDir, t.Output)) + if err != nil { + return err.Error() + } + return compare(got, t) +} + +func compare(got []byte, t Task) string { + if t.Kind == "text" { + var want string + json.Unmarshal(t.Expected, &want) + g := strings.TrimRight(string(got), "\n") + if g != strings.TrimRight(want, "\n") { + return fmt.Sprintf("text mismatch: got %q want %q", g, want) + } + return "" + } + var g, w any + if err := json.Unmarshal(got, &g); err != nil { + return "invalid JSON output: " + err.Error() + } + json.Unmarshal(t.Expected, &w) + if !reflect.DeepEqual(g, w) { + return fmt.Sprintf("json mismatch: got %s want %s", bytes.TrimSpace(got), t.Expected) + } + return "" +} + +func run(dir string, timeout time.Duration, name string, args ...string) (string, error) { + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + c := exec.CommandContext(ctx, name, args...) + c.Dir = dir + out, err := c.CombinedOutput() + if ctx.Err() != nil { + return "timeout", ctx.Err() + } + s := string(out) + if len(s) > 400 { + s = s[:400] + } + return s, err +} + +func readJSON(path string, v any) error { + data, err := os.ReadFile(path) + if err != nil { + return err + } + return json.Unmarshal(data, v) +} + +func must(err error) { + if err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(2) + } +} diff --git a/experiments/token-efficiency-heldout-v0/count_tokens.py b/experiments/token-efficiency-heldout-v0/count_tokens.py new file mode 100644 index 0000000..44bda83 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/count_tokens.py @@ -0,0 +1,82 @@ +"""Count verified held-out sources with the v0 tokenizers and stripping rules.""" +import csv, hashlib, importlib.util, json, statistics +from pathlib import Path + +import tiktoken +import tiktoken.load + +ROOT = Path(__file__).resolve().parent +_spec = importlib.util.spec_from_file_location("v0count", ROOT.parent / "token-efficiency-v0/count_tokens.py") +v0 = importlib.util.module_from_spec(_spec) +_spec.loader.exec_module(v0) # reuse strip_comments and offline guard unchanged +LANGUAGES = v0.LANGUAGES + + +def main(): + if tiktoken.__version__ != "0.8.0": + raise RuntimeError("Install requirements.txt: tiktoken==0.8.0 required") + tiktoken.load.read_file = v0.offline_read + encodings = {n: tiktoken.get_encoding(n) for n in ("cl100k_base", "o200k_base")} + tasks = json.loads((ROOT / "tasks/manifest.json").read_text())["tasks"] + cats = {t["id"]: t["category"] for t in tasks} + gaps = {(g["task"], g["lang"]) for g in json.loads((ROOT / "gaps.json").read_text())} + checks = {(r["task"], r["lang"]): r for r in json.loads((ROOT / "results/verification.json").read_text())} + expected = {(t["id"], l) for t in tasks for l in LANGUAGES} - gaps + if set(checks) != expected: + raise RuntimeError("verification coverage must be every task x language minus gaps.json") + rows = [] + for t in tasks: + for lang, ext in LANGUAGES.items(): + if (t["id"], lang) in gaps: + continue + raw = (ROOT / f"solutions/{lang}/{t['id']}.{ext}").read_bytes() + c = checks[t["id"], lang] + if hashlib.sha256(raw).hexdigest() != c["sha256"] or not c["pass"]: + raise RuntimeError(f"unverified or changed source {t['id']}/{lang}") + src = raw.decode() + stripped = v0.strip_comments(src, lang) + for name, enc in encodings.items(): + rows.append({"task": t["id"], "category": t["category"], "lang": lang, "encoding": name, + "tokens": len(enc.encode(src, disallowed_special=())), + "tokens_nocomments": len(enc.encode(stripped, disallowed_special=())), + "bytes": len(raw), "pass": c["pass"]}) + (ROOT / "results/tokens.json").write_text(json.dumps(rows, indent=2) + "\n") + with (ROOT / "results/tokens.csv").open("w", newline="") as f: + w = csv.DictWriter(f, fieldnames=list(rows[0])) + w.writeheader() + w.writerows(rows) + summary = {} + for enc in encodings: + summary[enc] = {} + for metric in ("tokens", "tokens_nocomments"): + by = {l: {r["task"]: r[metric] for r in rows if r["encoding"] == enc and r["lang"] == l} for l in LANGUAGES} + solved = sorted(by["howl"]) + s = {"languages": {l: {"median_all": statistics.median(v.values()), + "median_howl_solved": statistics.median(v[t] for t in solved), + "mean_howl_solved": statistics.mean(v[t] for t in solved)} for l, v in by.items()}, + "howl_vs": {}, "categories": {}} + for l in ("python", "js", "go"): + ratios = [by["howl"][t] / by[l][t] for t in solved] + s["howl_vs"][l] = { + "median_per_task_ratio": statistics.median(ratios), + "ratio_of_medians": statistics.median(by["howl"].values()) / statistics.median(by[l][t] for t in solved), + "wins": sum(by["howl"][t] < by[l][t] for t in solved), + "ties": sum(by["howl"][t] == by[l][t] for t in solved), + "losses": sum(by["howl"][t] > by[l][t] for t in solved), + "gaps": len(by[l]) - len(solved), + } + for cat in sorted(set(cats.values())): + ids = [t for t in by["python"] if cats[t] == cat] + hs = [t for t in ids if t in by["howl"]] + s["categories"][cat] = { + "n": len(ids), "howl_solved": len(hs), + **{f"mean_{l}": (statistics.mean(by[l][t] for t in hs) if hs else None) for l in LANGUAGES}, + "median_ratio_vs_python": statistics.median(by["howl"][t] / by["python"][t] for t in hs) if hs else None, + } + summary[enc][metric] = s + (ROOT / "results/summary.json").write_text(json.dumps(summary, indent=2) + "\n") + print(json.dumps({e: summary[e]["tokens"]["howl_vs"] for e in summary}, indent=1)) + + +if __name__ == "__main__": + main() diff --git a/experiments/token-efficiency-heldout-v0/gaps.json b/experiments/token-efficiency-heldout-v0/gaps.json new file mode 100644 index 0000000..7eaaeb8 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/gaps.json @@ -0,0 +1,4 @@ +[ + {"task": "h31", "lang": "howl", "reason": "no directory listing or walking construct on main (only read_file/write_file/mkdir on fixed paths)"}, + {"task": "h32", "lang": "howl", "reason": "no directory listing or walking construct on main; also no string ordering comparison for sorting"} +] diff --git a/experiments/token-efficiency-heldout-v0/requirements.txt b/experiments/token-efficiency-heldout-v0/requirements.txt new file mode 100644 index 0000000..135d4f5 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/requirements.txt @@ -0,0 +1 @@ +tiktoken==0.8.0 diff --git a/experiments/token-efficiency-heldout-v0/results/summary.json b/experiments/token-efficiency-heldout-v0/results/summary.json new file mode 100644 index 0000000..546376f --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/results/summary.json @@ -0,0 +1,466 @@ +{ + "cl100k_base": { + "tokens": { + "languages": { + "howl": { + "median_all": 72.5, + "median_howl_solved": 72.5, + "mean_howl_solved": 85.46666666666667 + }, + "python": { + "median_all": 62.5, + "median_howl_solved": 63.0, + "mean_howl_solved": 60.833333333333336 + }, + "js": { + "median_all": 69.0, + "median_howl_solved": 69.0, + "mean_howl_solved": 71.6 + }, + "go": { + "median_all": 162.5, + "median_howl_solved": 162.5, + "mean_howl_solved": 162 + } + }, + "howl_vs": { + "python": { + "median_per_task_ratio": 1.3092086736130666, + "ratio_of_medians": 1.1507936507936507, + "wins": 0, + "ties": 1, + "losses": 29, + "gaps": 2 + }, + "js": { + "median_per_task_ratio": 1.087069525666017, + "ratio_of_medians": 1.0507246376811594, + "wins": 6, + "ties": 1, + "losses": 23, + "gaps": 2 + }, + "go": { + "median_per_task_ratio": 0.4993893362848746, + "ratio_of_medians": 0.4461538461538462, + "wins": 30, + "ties": 0, + "losses": 0, + "gaps": 2 + } + }, + "categories": { + "aggregate": { + "n": 5, + "howl_solved": 5, + "mean_howl": 81.8, + "mean_python": 53.6, + "mean_js": 71.8, + "mean_go": 152.4, + "median_ratio_vs_python": 1.4761904761904763 + }, + "csv": { + "n": 5, + "howl_solved": 5, + "mean_howl": 135, + "mean_python": 73, + "mean_js": 89, + "mean_go": 185.6, + "median_ratio_vs_python": 1.8428571428571427 + }, + "parse": { + "n": 5, + "howl_solved": 5, + "mean_howl": 81.2, + "mean_python": 57.8, + "mean_js": 72, + "mean_go": 152.8, + "median_ratio_vs_python": 1.3968253968253967 + }, + "reshape": { + "n": 5, + "howl_solved": 5, + "mean_howl": 72.4, + "mean_python": 61.8, + "mean_js": 65.6, + "mean_go": 174.2, + "median_ratio_vs_python": 1.0793650793650793 + }, + "text": { + "n": 5, + "howl_solved": 5, + "mean_howl": 58.4, + "mean_python": 47, + "mean_js": 50.8, + "mean_go": 119.2, + "median_ratio_vs_python": 1.2272727272727273 + }, + "validate": { + "n": 5, + "howl_solved": 5, + "mean_howl": 84, + "mean_python": 71.8, + "mean_js": 80.4, + "mean_go": 187.8, + "median_ratio_vs_python": 1.1111111111111112 + }, + "walk": { + "n": 2, + "howl_solved": 0, + "mean_howl": null, + "mean_python": null, + "mean_js": null, + "mean_go": null, + "median_ratio_vs_python": null + } + } + }, + "tokens_nocomments": { + "languages": { + "howl": { + "median_all": 72.5, + "median_howl_solved": 72.5, + "mean_howl_solved": 85.46666666666667 + }, + "python": { + "median_all": 62.5, + "median_howl_solved": 63.0, + "mean_howl_solved": 60.833333333333336 + }, + "js": { + "median_all": 69.0, + "median_howl_solved": 69.0, + "mean_howl_solved": 71.6 + }, + "go": { + "median_all": 156.5, + "median_howl_solved": 156.5, + "mean_howl_solved": 156 + } + }, + "howl_vs": { + "python": { + "median_per_task_ratio": 1.3092086736130666, + "ratio_of_medians": 1.1507936507936507, + "wins": 0, + "ties": 1, + "losses": 29, + "gaps": 2 + }, + "js": { + "median_per_task_ratio": 1.087069525666017, + "ratio_of_medians": 1.0507246376811594, + "wins": 6, + "ties": 1, + "losses": 23, + "gaps": 2 + }, + "go": { + "median_per_task_ratio": 0.5190048233499609, + "ratio_of_medians": 0.46325878594249204, + "wins": 30, + "ties": 0, + "losses": 0, + "gaps": 2 + } + }, + "categories": { + "aggregate": { + "n": 5, + "howl_solved": 5, + "mean_howl": 81.8, + "mean_python": 53.6, + "mean_js": 71.8, + "mean_go": 146.4, + "median_ratio_vs_python": 1.4761904761904763 + }, + "csv": { + "n": 5, + "howl_solved": 5, + "mean_howl": 135, + "mean_python": 73, + "mean_js": 89, + "mean_go": 179.6, + "median_ratio_vs_python": 1.8428571428571427 + }, + "parse": { + "n": 5, + "howl_solved": 5, + "mean_howl": 81.2, + "mean_python": 57.8, + "mean_js": 72, + "mean_go": 146.8, + "median_ratio_vs_python": 1.3968253968253967 + }, + "reshape": { + "n": 5, + "howl_solved": 5, + "mean_howl": 72.4, + "mean_python": 61.8, + "mean_js": 65.6, + "mean_go": 168.2, + "median_ratio_vs_python": 1.0793650793650793 + }, + "text": { + "n": 5, + "howl_solved": 5, + "mean_howl": 58.4, + "mean_python": 47, + "mean_js": 50.8, + "mean_go": 113.2, + "median_ratio_vs_python": 1.2272727272727273 + }, + "validate": { + "n": 5, + "howl_solved": 5, + "mean_howl": 84, + "mean_python": 71.8, + "mean_js": 80.4, + "mean_go": 181.8, + "median_ratio_vs_python": 1.1111111111111112 + }, + "walk": { + "n": 2, + "howl_solved": 0, + "mean_howl": null, + "mean_python": null, + "mean_js": null, + "mean_go": null, + "median_ratio_vs_python": null + } + } + } + }, + "o200k_base": { + "tokens": { + "languages": { + "howl": { + "median_all": 72.5, + "median_howl_solved": 72.5, + "mean_howl_solved": 85.56666666666666 + }, + "python": { + "median_all": 62.5, + "median_howl_solved": 63.0, + "mean_howl_solved": 61.13333333333333 + }, + "js": { + "median_all": 73.0, + "median_howl_solved": 73.0, + "mean_howl_solved": 76.26666666666667 + }, + "go": { + "median_all": 164.5, + "median_howl_solved": 164.5, + "mean_howl_solved": 163.56666666666666 + } + }, + "howl_vs": { + "python": { + "median_per_task_ratio": 1.2985678704856787, + "ratio_of_medians": 1.1507936507936507, + "wins": 0, + "ties": 1, + "losses": 29, + "gaps": 2 + }, + "js": { + "median_per_task_ratio": 1.015889029003783, + "ratio_of_medians": 0.9931506849315068, + "wins": 13, + "ties": 0, + "losses": 17, + "gaps": 2 + }, + "go": { + "median_per_task_ratio": 0.492850707094449, + "ratio_of_medians": 0.44072948328267475, + "wins": 30, + "ties": 0, + "losses": 0, + "gaps": 2 + } + }, + "categories": { + "aggregate": { + "n": 5, + "howl_solved": 5, + "mean_howl": 81.8, + "mean_python": 53.6, + "mean_js": 76.4, + "mean_go": 153.6, + "median_ratio_vs_python": 1.4761904761904763 + }, + "csv": { + "n": 5, + "howl_solved": 5, + "mean_howl": 135, + "mean_python": 73.8, + "mean_js": 94.4, + "mean_go": 187.4, + "median_ratio_vs_python": 1.8169014084507042 + }, + "parse": { + "n": 5, + "howl_solved": 5, + "mean_howl": 81.4, + "mean_python": 58, + "mean_js": 76.6, + "mean_go": 154.2, + "median_ratio_vs_python": 1.3968253968253967 + }, + "reshape": { + "n": 5, + "howl_solved": 5, + "mean_howl": 72.4, + "mean_python": 62, + "mean_js": 69.6, + "mean_go": 175.2, + "median_ratio_vs_python": 1.0793650793650793 + }, + "text": { + "n": 5, + "howl_solved": 5, + "mean_howl": 58.4, + "mean_python": 47.4, + "mean_js": 55.4, + "mean_go": 121.2, + "median_ratio_vs_python": 1.2 + }, + "validate": { + "n": 5, + "howl_solved": 5, + "mean_howl": 84.4, + "mean_python": 72, + "mean_js": 85.2, + "mean_go": 189.8, + "median_ratio_vs_python": 1.1111111111111112 + }, + "walk": { + "n": 2, + "howl_solved": 0, + "mean_howl": null, + "mean_python": null, + "mean_js": null, + "mean_go": null, + "median_ratio_vs_python": null + } + } + }, + "tokens_nocomments": { + "languages": { + "howl": { + "median_all": 72.5, + "median_howl_solved": 72.5, + "mean_howl_solved": 85.56666666666666 + }, + "python": { + "median_all": 62.5, + "median_howl_solved": 63.0, + "mean_howl_solved": 61.13333333333333 + }, + "js": { + "median_all": 73.0, + "median_howl_solved": 73.0, + "mean_howl_solved": 76.26666666666667 + }, + "go": { + "median_all": 158.5, + "median_howl_solved": 158.5, + "mean_howl_solved": 157.56666666666666 + } + }, + "howl_vs": { + "python": { + "median_per_task_ratio": 1.2985678704856787, + "ratio_of_medians": 1.1507936507936507, + "wins": 0, + "ties": 1, + "losses": 29, + "gaps": 2 + }, + "js": { + "median_per_task_ratio": 1.015889029003783, + "ratio_of_medians": 0.9931506849315068, + "wins": 13, + "ties": 0, + "losses": 17, + "gaps": 2 + }, + "go": { + "median_per_task_ratio": 0.5126086035176944, + "ratio_of_medians": 0.45741324921135645, + "wins": 30, + "ties": 0, + "losses": 0, + "gaps": 2 + } + }, + "categories": { + "aggregate": { + "n": 5, + "howl_solved": 5, + "mean_howl": 81.8, + "mean_python": 53.6, + "mean_js": 76.4, + "mean_go": 147.6, + "median_ratio_vs_python": 1.4761904761904763 + }, + "csv": { + "n": 5, + "howl_solved": 5, + "mean_howl": 135, + "mean_python": 73.8, + "mean_js": 94.4, + "mean_go": 181.4, + "median_ratio_vs_python": 1.8169014084507042 + }, + "parse": { + "n": 5, + "howl_solved": 5, + "mean_howl": 81.4, + "mean_python": 58, + "mean_js": 76.6, + "mean_go": 148.2, + "median_ratio_vs_python": 1.3968253968253967 + }, + "reshape": { + "n": 5, + "howl_solved": 5, + "mean_howl": 72.4, + "mean_python": 62, + "mean_js": 69.6, + "mean_go": 169.2, + "median_ratio_vs_python": 1.0793650793650793 + }, + "text": { + "n": 5, + "howl_solved": 5, + "mean_howl": 58.4, + "mean_python": 47.4, + "mean_js": 55.4, + "mean_go": 115.2, + "median_ratio_vs_python": 1.2 + }, + "validate": { + "n": 5, + "howl_solved": 5, + "mean_howl": 84.4, + "mean_python": 72, + "mean_js": 85.2, + "mean_go": 183.8, + "median_ratio_vs_python": 1.1111111111111112 + }, + "walk": { + "n": 2, + "howl_solved": 0, + "mean_howl": null, + "mean_python": null, + "mean_js": null, + "mean_go": null, + "median_ratio_vs_python": null + } + } + } + } +} diff --git a/experiments/token-efficiency-heldout-v0/results/tokens.csv b/experiments/token-efficiency-heldout-v0/results/tokens.csv new file mode 100644 index 0000000..93f057c --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/results/tokens.csv @@ -0,0 +1,253 @@ +task,category,lang,encoding,tokens,tokens_nocomments,bytes,pass +h01,text,howl,cl100k_base,54,54,168,True +h01,text,howl,o200k_base,54,54,168,True +h01,text,python,cl100k_base,44,44,162,True +h01,text,python,o200k_base,44,44,162,True +h01,text,js,cl100k_base,49,49,188,True +h01,text,js,o200k_base,55,55,188,True +h01,text,go,cl100k_base,112,106,383,True +h01,text,go,o200k_base,114,108,383,True +h02,text,howl,cl100k_base,70,70,208,True +h02,text,howl,o200k_base,70,70,208,True +h02,text,python,cl100k_base,40,40,147,True +h02,text,python,o200k_base,40,40,147,True +h02,text,js,cl100k_base,43,43,164,True +h02,text,js,o200k_base,47,47,164,True +h02,text,go,cl100k_base,138,132,415,True +h02,text,go,o200k_base,139,133,415,True +h03,text,howl,cl100k_base,66,66,187,True +h03,text,howl,o200k_base,66,66,187,True +h03,text,python,cl100k_base,62,62,209,True +h03,text,python,o200k_base,62,62,209,True +h03,text,js,cl100k_base,61,61,219,True +h03,text,js,o200k_base,65,65,219,True +h03,text,go,cl100k_base,125,119,401,True +h03,text,go,o200k_base,126,120,401,True +h04,text,howl,cl100k_base,66,66,199,True +h04,text,howl,o200k_base,66,66,199,True +h04,text,python,cl100k_base,53,53,192,True +h04,text,python,o200k_base,55,55,192,True +h04,text,js,cl100k_base,61,61,230,True +h04,text,js,o200k_base,65,65,230,True +h04,text,go,cl100k_base,133,127,459,True +h04,text,go,o200k_base,138,132,459,True +h05,text,howl,cl100k_base,36,36,116,True +h05,text,howl,o200k_base,36,36,116,True +h05,text,python,cl100k_base,36,36,134,True +h05,text,python,o200k_base,36,36,134,True +h05,text,js,cl100k_base,40,40,154,True +h05,text,js,o200k_base,45,45,154,True +h05,text,go,cl100k_base,88,82,292,True +h05,text,go,o200k_base,89,83,292,True +h06,csv,howl,cl100k_base,122,122,349,True +h06,csv,howl,o200k_base,122,122,349,True +h06,csv,python,cl100k_base,71,71,247,True +h06,csv,python,o200k_base,72,72,247,True +h06,csv,js,cl100k_base,74,74,270,True +h06,csv,js,o200k_base,79,79,270,True +h06,csv,go,cl100k_base,165,159,534,True +h06,csv,go,o200k_base,166,160,534,True +h07,csv,howl,cl100k_base,144,144,404,True +h07,csv,howl,o200k_base,144,144,404,True +h07,csv,python,cl100k_base,82,82,272,True +h07,csv,python,o200k_base,84,84,272,True +h07,csv,js,cl100k_base,89,89,302,True +h07,csv,js,o200k_base,96,96,302,True +h07,csv,go,cl100k_base,206,200,634,True +h07,csv,go,o200k_base,211,205,634,True +h08,csv,howl,cl100k_base,127,127,367,True +h08,csv,howl,o200k_base,127,127,367,True +h08,csv,python,cl100k_base,64,64,227,True +h08,csv,python,o200k_base,64,64,227,True +h08,csv,js,cl100k_base,81,81,289,True +h08,csv,js,o200k_base,87,87,289,True +h08,csv,go,cl100k_base,186,180,597,True +h08,csv,go,o200k_base,187,181,597,True +h09,csv,howl,cl100k_base,129,129,395,True +h09,csv,howl,o200k_base,129,129,395,True +h09,csv,python,cl100k_base,70,70,253,True +h09,csv,python,o200k_base,71,71,253,True +h09,csv,js,cl100k_base,96,96,357,True +h09,csv,js,o200k_base,100,100,357,True +h09,csv,go,cl100k_base,185,179,638,True +h09,csv,go,o200k_base,186,180,638,True +h10,csv,howl,cl100k_base,153,153,447,True +h10,csv,howl,o200k_base,153,153,447,True +h10,csv,python,cl100k_base,78,78,293,True +h10,csv,python,o200k_base,78,78,293,True +h10,csv,js,cl100k_base,105,105,354,True +h10,csv,js,o200k_base,110,110,354,True +h10,csv,go,cl100k_base,186,180,604,True +h10,csv,go,o200k_base,187,181,604,True +h11,aggregate,howl,cl100k_base,137,137,375,True +h11,aggregate,howl,o200k_base,137,137,375,True +h11,aggregate,python,cl100k_base,71,71,264,True +h11,aggregate,python,o200k_base,71,71,264,True +h11,aggregate,js,cl100k_base,96,96,330,True +h11,aggregate,js,o200k_base,101,101,330,True +h11,aggregate,go,cl100k_base,224,218,717,True +h11,aggregate,go,o200k_base,225,219,717,True +h12,aggregate,howl,cl100k_base,92,92,283,True +h12,aggregate,howl,o200k_base,92,92,283,True +h12,aggregate,python,cl100k_base,67,67,270,True +h12,aggregate,python,o200k_base,67,67,270,True +h12,aggregate,js,cl100k_base,91,91,320,True +h12,aggregate,js,o200k_base,97,97,320,True +h12,aggregate,go,cl100k_base,154,148,530,True +h12,aggregate,go,o200k_base,156,150,530,True +h13,aggregate,howl,cl100k_base,62,62,206,True +h13,aggregate,howl,o200k_base,62,62,206,True +h13,aggregate,python,cl100k_base,42,42,163,True +h13,aggregate,python,o200k_base,42,42,163,True +h13,aggregate,js,cl100k_base,60,60,224,True +h13,aggregate,js,o200k_base,64,64,224,True +h13,aggregate,go,cl100k_base,133,127,440,True +h13,aggregate,go,o200k_base,134,128,440,True +h14,aggregate,howl,cl100k_base,56,56,168,True +h14,aggregate,howl,o200k_base,56,56,168,True +h14,aggregate,python,cl100k_base,50,50,177,True +h14,aggregate,python,o200k_base,50,50,177,True +h14,aggregate,js,cl100k_base,53,53,211,True +h14,aggregate,js,o200k_base,57,57,211,True +h14,aggregate,go,cl100k_base,124,118,416,True +h14,aggregate,go,o200k_base,125,119,416,True +h15,aggregate,howl,cl100k_base,62,62,193,True +h15,aggregate,howl,o200k_base,62,62,193,True +h15,aggregate,python,cl100k_base,38,38,140,True +h15,aggregate,python,o200k_base,38,38,140,True +h15,aggregate,js,cl100k_base,59,59,234,True +h15,aggregate,js,o200k_base,63,63,234,True +h15,aggregate,go,cl100k_base,127,121,409,True +h15,aggregate,go,o200k_base,128,122,409,True +h16,parse,howl,cl100k_base,109,109,336,True +h16,parse,howl,o200k_base,109,109,336,True +h16,parse,python,cl100k_base,59,59,215,True +h16,parse,python,o200k_base,59,59,215,True +h16,parse,js,cl100k_base,84,84,299,True +h16,parse,js,o200k_base,89,89,299,True +h16,parse,go,cl100k_base,152,146,524,True +h16,parse,go,o200k_base,153,147,524,True +h17,parse,howl,cl100k_base,88,88,285,True +h17,parse,howl,o200k_base,88,88,285,True +h17,parse,python,cl100k_base,63,63,251,True +h17,parse,python,o200k_base,63,63,251,True +h17,parse,js,cl100k_base,86,86,301,True +h17,parse,js,o200k_base,90,90,301,True +h17,parse,go,cl100k_base,145,139,498,True +h17,parse,go,o200k_base,146,140,498,True +h18,parse,howl,cl100k_base,62,62,188,True +h18,parse,howl,o200k_base,62,62,188,True +h18,parse,python,cl100k_base,54,54,194,True +h18,parse,python,o200k_base,54,54,194,True +h18,parse,js,cl100k_base,57,57,219,True +h18,parse,js,o200k_base,61,61,219,True +h18,parse,go,cl100k_base,126,120,433,True +h18,parse,go,o200k_base,127,121,433,True +h19,parse,howl,cl100k_base,88,88,259,True +h19,parse,howl,o200k_base,88,88,259,True +h19,parse,python,cl100k_base,63,63,223,True +h19,parse,python,o200k_base,63,63,223,True +h19,parse,js,cl100k_base,81,81,279,True +h19,parse,js,o200k_base,86,86,279,True +h19,parse,go,cl100k_base,181,175,579,True +h19,parse,go,o200k_base,182,176,579,True +h20,parse,howl,cl100k_base,59,59,193,True +h20,parse,howl,o200k_base,60,60,193,True +h20,parse,python,cl100k_base,50,50,195,True +h20,parse,python,o200k_base,51,51,195,True +h20,parse,js,cl100k_base,52,52,203,True +h20,parse,js,o200k_base,57,57,203,True +h20,parse,go,cl100k_base,160,154,533,True +h20,parse,go,o200k_base,163,157,533,True +h21,validate,howl,cl100k_base,64,64,211,True +h21,validate,howl,o200k_base,65,65,211,True +h21,validate,python,cl100k_base,61,61,229,True +h21,validate,python,o200k_base,61,61,229,True +h21,validate,js,cl100k_base,68,68,256,True +h21,validate,js,o200k_base,72,72,256,True +h21,validate,go,cl100k_base,173,167,574,True +h21,validate,go,o200k_base,174,168,574,True +h22,validate,howl,cl100k_base,99,99,288,True +h22,validate,howl,o200k_base,100,100,288,True +h22,validate,python,cl100k_base,72,72,241,True +h22,validate,python,o200k_base,73,73,241,True +h22,validate,js,cl100k_base,73,73,254,True +h22,validate,js,o200k_base,78,78,254,True +h22,validate,go,cl100k_base,197,191,637,True +h22,validate,go,o200k_base,201,195,637,True +h23,validate,howl,cl100k_base,80,80,261,True +h23,validate,howl,o200k_base,80,80,261,True +h23,validate,python,cl100k_base,72,72,272,True +h23,validate,python,o200k_base,72,72,272,True +h23,validate,js,cl100k_base,83,83,296,True +h23,validate,js,o200k_base,87,87,296,True +h23,validate,go,cl100k_base,154,148,493,True +h23,validate,go,o200k_base,156,150,493,True +h24,validate,howl,cl100k_base,73,73,265,True +h24,validate,howl,o200k_base,73,73,265,True +h24,validate,python,cl100k_base,69,69,278,True +h24,validate,python,o200k_base,69,69,278,True +h24,validate,js,cl100k_base,74,74,303,True +h24,validate,js,o200k_base,80,80,303,True +h24,validate,go,cl100k_base,218,212,750,True +h24,validate,go,o200k_base,220,214,750,True +h25,validate,howl,cl100k_base,104,104,306,True +h25,validate,howl,o200k_base,104,104,306,True +h25,validate,python,cl100k_base,85,85,289,True +h25,validate,python,o200k_base,85,85,289,True +h25,validate,js,cl100k_base,104,104,332,True +h25,validate,js,o200k_base,109,109,332,True +h25,validate,go,cl100k_base,197,191,614,True +h25,validate,go,o200k_base,198,192,614,True +h26,reshape,howl,cl100k_base,63,63,205,True +h26,reshape,howl,o200k_base,63,63,205,True +h26,reshape,python,cl100k_base,59,59,216,True +h26,reshape,python,o200k_base,59,59,216,True +h26,reshape,js,cl100k_base,64,64,246,True +h26,reshape,js,o200k_base,68,68,246,True +h26,reshape,go,cl100k_base,175,169,579,True +h26,reshape,go,o200k_base,176,170,579,True +h27,reshape,howl,cl100k_base,68,68,241,True +h27,reshape,howl,o200k_base,68,68,241,True +h27,reshape,python,cl100k_base,63,63,237,True +h27,reshape,python,o200k_base,63,63,237,True +h27,reshape,js,cl100k_base,61,61,242,True +h27,reshape,js,o200k_base,65,65,242,True +h27,reshape,go,cl100k_base,181,175,627,True +h27,reshape,go,o200k_base,182,176,627,True +h28,reshape,howl,cl100k_base,97,97,331,True +h28,reshape,howl,o200k_base,97,97,331,True +h28,reshape,python,cl100k_base,64,64,252,True +h28,reshape,python,o200k_base,64,64,252,True +h28,reshape,js,cl100k_base,70,70,263,True +h28,reshape,js,o200k_base,74,74,263,True +h28,reshape,go,cl100k_base,183,177,618,True +h28,reshape,go,o200k_base,184,178,618,True +h29,reshape,howl,cl100k_base,72,72,234,True +h29,reshape,howl,o200k_base,72,72,234,True +h29,reshape,python,cl100k_base,65,65,231,True +h29,reshape,python,o200k_base,66,66,231,True +h29,reshape,js,cl100k_base,65,65,241,True +h29,reshape,js,o200k_base,69,69,241,True +h29,reshape,go,cl100k_base,177,171,580,True +h29,reshape,go,o200k_base,178,172,580,True +h30,reshape,howl,cl100k_base,62,62,197,True +h30,reshape,howl,o200k_base,62,62,197,True +h30,reshape,python,cl100k_base,58,58,222,True +h30,reshape,python,o200k_base,58,58,222,True +h30,reshape,js,cl100k_base,68,68,270,True +h30,reshape,js,o200k_base,72,72,270,True +h30,reshape,go,cl100k_base,155,149,536,True +h30,reshape,go,o200k_base,156,150,536,True +h31,walk,python,cl100k_base,41,41,146,True +h31,walk,python,o200k_base,41,41,146,True +h31,walk,js,cl100k_base,54,54,226,True +h31,walk,js,o200k_base,58,58,226,True +h31,walk,go,cl100k_base,141,135,444,True +h31,walk,go,o200k_base,142,136,444,True +h32,walk,python,cl100k_base,57,57,199,True +h32,walk,python,o200k_base,57,57,199,True +h32,walk,js,cl100k_base,109,109,429,True +h32,walk,js,o200k_base,114,114,429,True +h32,walk,go,cl100k_base,196,190,645,True +h32,walk,go,o200k_base,198,192,645,True diff --git a/experiments/token-efficiency-heldout-v0/results/tokens.json b/experiments/token-efficiency-heldout-v0/results/tokens.json new file mode 100644 index 0000000..d6ffd02 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/results/tokens.json @@ -0,0 +1,2522 @@ +[ + { + "task": "h01", + "category": "text", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 54, + "tokens_nocomments": 54, + "bytes": 168, + "pass": true + }, + { + "task": "h01", + "category": "text", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 54, + "tokens_nocomments": 54, + "bytes": 168, + "pass": true + }, + { + "task": "h01", + "category": "text", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 44, + "tokens_nocomments": 44, + "bytes": 162, + "pass": true + }, + { + "task": "h01", + "category": "text", + "lang": "python", + "encoding": "o200k_base", + "tokens": 44, + "tokens_nocomments": 44, + "bytes": 162, + "pass": true + }, + { + "task": "h01", + "category": "text", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 49, + "tokens_nocomments": 49, + "bytes": 188, + "pass": true + }, + { + "task": "h01", + "category": "text", + "lang": "js", + "encoding": "o200k_base", + "tokens": 55, + "tokens_nocomments": 55, + "bytes": 188, + "pass": true + }, + { + "task": "h01", + "category": "text", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 112, + "tokens_nocomments": 106, + "bytes": 383, + "pass": true + }, + { + "task": "h01", + "category": "text", + "lang": "go", + "encoding": "o200k_base", + "tokens": 114, + "tokens_nocomments": 108, + "bytes": 383, + "pass": true + }, + { + "task": "h02", + "category": "text", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 70, + "tokens_nocomments": 70, + "bytes": 208, + "pass": true + }, + { + "task": "h02", + "category": "text", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 70, + "tokens_nocomments": 70, + "bytes": 208, + "pass": true + }, + { + "task": "h02", + "category": "text", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 40, + "tokens_nocomments": 40, + "bytes": 147, + "pass": true + }, + { + "task": "h02", + "category": "text", + "lang": "python", + "encoding": "o200k_base", + "tokens": 40, + "tokens_nocomments": 40, + "bytes": 147, + "pass": true + }, + { + "task": "h02", + "category": "text", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 43, + "tokens_nocomments": 43, + "bytes": 164, + "pass": true + }, + { + "task": "h02", + "category": "text", + "lang": "js", + "encoding": "o200k_base", + "tokens": 47, + "tokens_nocomments": 47, + "bytes": 164, + "pass": true + }, + { + "task": "h02", + "category": "text", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 138, + "tokens_nocomments": 132, + "bytes": 415, + "pass": true + }, + { + "task": "h02", + "category": "text", + "lang": "go", + "encoding": "o200k_base", + "tokens": 139, + "tokens_nocomments": 133, + "bytes": 415, + "pass": true + }, + { + "task": "h03", + "category": "text", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 66, + "tokens_nocomments": 66, + "bytes": 187, + "pass": true + }, + { + "task": "h03", + "category": "text", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 66, + "tokens_nocomments": 66, + "bytes": 187, + "pass": true + }, + { + "task": "h03", + "category": "text", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 62, + "tokens_nocomments": 62, + "bytes": 209, + "pass": true + }, + { + "task": "h03", + "category": "text", + "lang": "python", + "encoding": "o200k_base", + "tokens": 62, + "tokens_nocomments": 62, + "bytes": 209, + "pass": true + }, + { + "task": "h03", + "category": "text", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 61, + "tokens_nocomments": 61, + "bytes": 219, + "pass": true + }, + { + "task": "h03", + "category": "text", + "lang": "js", + "encoding": "o200k_base", + "tokens": 65, + "tokens_nocomments": 65, + "bytes": 219, + "pass": true + }, + { + "task": "h03", + "category": "text", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 125, + "tokens_nocomments": 119, + "bytes": 401, + "pass": true + }, + { + "task": "h03", + "category": "text", + "lang": "go", + "encoding": "o200k_base", + "tokens": 126, + "tokens_nocomments": 120, + "bytes": 401, + "pass": true + }, + { + "task": "h04", + "category": "text", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 66, + "tokens_nocomments": 66, + "bytes": 199, + "pass": true + }, + { + "task": "h04", + "category": "text", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 66, + "tokens_nocomments": 66, + "bytes": 199, + "pass": true + }, + { + "task": "h04", + "category": "text", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 53, + "tokens_nocomments": 53, + "bytes": 192, + "pass": true + }, + { + "task": "h04", + "category": "text", + "lang": "python", + "encoding": "o200k_base", + "tokens": 55, + "tokens_nocomments": 55, + "bytes": 192, + "pass": true + }, + { + "task": "h04", + "category": "text", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 61, + "tokens_nocomments": 61, + "bytes": 230, + "pass": true + }, + { + "task": "h04", + "category": "text", + "lang": "js", + "encoding": "o200k_base", + "tokens": 65, + "tokens_nocomments": 65, + "bytes": 230, + "pass": true + }, + { + "task": "h04", + "category": "text", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 133, + "tokens_nocomments": 127, + "bytes": 459, + "pass": true + }, + { + "task": "h04", + "category": "text", + "lang": "go", + "encoding": "o200k_base", + "tokens": 138, + "tokens_nocomments": 132, + "bytes": 459, + "pass": true + }, + { + "task": "h05", + "category": "text", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 36, + "tokens_nocomments": 36, + "bytes": 116, + "pass": true + }, + { + "task": "h05", + "category": "text", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 36, + "tokens_nocomments": 36, + "bytes": 116, + "pass": true + }, + { + "task": "h05", + "category": "text", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 36, + "tokens_nocomments": 36, + "bytes": 134, + "pass": true + }, + { + "task": "h05", + "category": "text", + "lang": "python", + "encoding": "o200k_base", + "tokens": 36, + "tokens_nocomments": 36, + "bytes": 134, + "pass": true + }, + { + "task": "h05", + "category": "text", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 40, + "tokens_nocomments": 40, + "bytes": 154, + "pass": true + }, + { + "task": "h05", + "category": "text", + "lang": "js", + "encoding": "o200k_base", + "tokens": 45, + "tokens_nocomments": 45, + "bytes": 154, + "pass": true + }, + { + "task": "h05", + "category": "text", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 88, + "tokens_nocomments": 82, + "bytes": 292, + "pass": true + }, + { + "task": "h05", + "category": "text", + "lang": "go", + "encoding": "o200k_base", + "tokens": 89, + "tokens_nocomments": 83, + "bytes": 292, + "pass": true + }, + { + "task": "h06", + "category": "csv", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 122, + "tokens_nocomments": 122, + "bytes": 349, + "pass": true + }, + { + "task": "h06", + "category": "csv", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 122, + "tokens_nocomments": 122, + "bytes": 349, + "pass": true + }, + { + "task": "h06", + "category": "csv", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 71, + "tokens_nocomments": 71, + "bytes": 247, + "pass": true + }, + { + "task": "h06", + "category": "csv", + "lang": "python", + "encoding": "o200k_base", + "tokens": 72, + "tokens_nocomments": 72, + "bytes": 247, + "pass": true + }, + { + "task": "h06", + "category": "csv", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 74, + "tokens_nocomments": 74, + "bytes": 270, + "pass": true + }, + { + "task": "h06", + "category": "csv", + "lang": "js", + "encoding": "o200k_base", + "tokens": 79, + "tokens_nocomments": 79, + "bytes": 270, + "pass": true + }, + { + "task": "h06", + "category": "csv", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 165, + "tokens_nocomments": 159, + "bytes": 534, + "pass": true + }, + { + "task": "h06", + "category": "csv", + "lang": "go", + "encoding": "o200k_base", + "tokens": 166, + "tokens_nocomments": 160, + "bytes": 534, + "pass": true + }, + { + "task": "h07", + "category": "csv", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 144, + "tokens_nocomments": 144, + "bytes": 404, + "pass": true + }, + { + "task": "h07", + "category": "csv", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 144, + "tokens_nocomments": 144, + "bytes": 404, + "pass": true + }, + { + "task": "h07", + "category": "csv", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 82, + "tokens_nocomments": 82, + "bytes": 272, + "pass": true + }, + { + "task": "h07", + "category": "csv", + "lang": "python", + "encoding": "o200k_base", + "tokens": 84, + "tokens_nocomments": 84, + "bytes": 272, + "pass": true + }, + { + "task": "h07", + "category": "csv", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 89, + "tokens_nocomments": 89, + "bytes": 302, + "pass": true + }, + { + "task": "h07", + "category": "csv", + "lang": "js", + "encoding": "o200k_base", + "tokens": 96, + "tokens_nocomments": 96, + "bytes": 302, + "pass": true + }, + { + "task": "h07", + "category": "csv", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 206, + "tokens_nocomments": 200, + "bytes": 634, + "pass": true + }, + { + "task": "h07", + "category": "csv", + "lang": "go", + "encoding": "o200k_base", + "tokens": 211, + "tokens_nocomments": 205, + "bytes": 634, + "pass": true + }, + { + "task": "h08", + "category": "csv", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 127, + "tokens_nocomments": 127, + "bytes": 367, + "pass": true + }, + { + "task": "h08", + "category": "csv", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 127, + "tokens_nocomments": 127, + "bytes": 367, + "pass": true + }, + { + "task": "h08", + "category": "csv", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 64, + "tokens_nocomments": 64, + "bytes": 227, + "pass": true + }, + { + "task": "h08", + "category": "csv", + "lang": "python", + "encoding": "o200k_base", + "tokens": 64, + "tokens_nocomments": 64, + "bytes": 227, + "pass": true + }, + { + "task": "h08", + "category": "csv", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 81, + "tokens_nocomments": 81, + "bytes": 289, + "pass": true + }, + { + "task": "h08", + "category": "csv", + "lang": "js", + "encoding": "o200k_base", + "tokens": 87, + "tokens_nocomments": 87, + "bytes": 289, + "pass": true + }, + { + "task": "h08", + "category": "csv", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 186, + "tokens_nocomments": 180, + "bytes": 597, + "pass": true + }, + { + "task": "h08", + "category": "csv", + "lang": "go", + "encoding": "o200k_base", + "tokens": 187, + "tokens_nocomments": 181, + "bytes": 597, + "pass": true + }, + { + "task": "h09", + "category": "csv", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 129, + "tokens_nocomments": 129, + "bytes": 395, + "pass": true + }, + { + "task": "h09", + "category": "csv", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 129, + "tokens_nocomments": 129, + "bytes": 395, + "pass": true + }, + { + "task": "h09", + "category": "csv", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 70, + "tokens_nocomments": 70, + "bytes": 253, + "pass": true + }, + { + "task": "h09", + "category": "csv", + "lang": "python", + "encoding": "o200k_base", + "tokens": 71, + "tokens_nocomments": 71, + "bytes": 253, + "pass": true + }, + { + "task": "h09", + "category": "csv", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 96, + "tokens_nocomments": 96, + "bytes": 357, + "pass": true + }, + { + "task": "h09", + "category": "csv", + "lang": "js", + "encoding": "o200k_base", + "tokens": 100, + "tokens_nocomments": 100, + "bytes": 357, + "pass": true + }, + { + "task": "h09", + "category": "csv", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 185, + "tokens_nocomments": 179, + "bytes": 638, + "pass": true + }, + { + "task": "h09", + "category": "csv", + "lang": "go", + "encoding": "o200k_base", + "tokens": 186, + "tokens_nocomments": 180, + "bytes": 638, + "pass": true + }, + { + "task": "h10", + "category": "csv", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 153, + "tokens_nocomments": 153, + "bytes": 447, + "pass": true + }, + { + "task": "h10", + "category": "csv", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 153, + "tokens_nocomments": 153, + "bytes": 447, + "pass": true + }, + { + "task": "h10", + "category": "csv", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 78, + "tokens_nocomments": 78, + "bytes": 293, + "pass": true + }, + { + "task": "h10", + "category": "csv", + "lang": "python", + "encoding": "o200k_base", + "tokens": 78, + "tokens_nocomments": 78, + "bytes": 293, + "pass": true + }, + { + "task": "h10", + "category": "csv", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 105, + "tokens_nocomments": 105, + "bytes": 354, + "pass": true + }, + { + "task": "h10", + "category": "csv", + "lang": "js", + "encoding": "o200k_base", + "tokens": 110, + "tokens_nocomments": 110, + "bytes": 354, + "pass": true + }, + { + "task": "h10", + "category": "csv", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 186, + "tokens_nocomments": 180, + "bytes": 604, + "pass": true + }, + { + "task": "h10", + "category": "csv", + "lang": "go", + "encoding": "o200k_base", + "tokens": 187, + "tokens_nocomments": 181, + "bytes": 604, + "pass": true + }, + { + "task": "h11", + "category": "aggregate", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 137, + "tokens_nocomments": 137, + "bytes": 375, + "pass": true + }, + { + "task": "h11", + "category": "aggregate", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 137, + "tokens_nocomments": 137, + "bytes": 375, + "pass": true + }, + { + "task": "h11", + "category": "aggregate", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 71, + "tokens_nocomments": 71, + "bytes": 264, + "pass": true + }, + { + "task": "h11", + "category": "aggregate", + "lang": "python", + "encoding": "o200k_base", + "tokens": 71, + "tokens_nocomments": 71, + "bytes": 264, + "pass": true + }, + { + "task": "h11", + "category": "aggregate", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 96, + "tokens_nocomments": 96, + "bytes": 330, + "pass": true + }, + { + "task": "h11", + "category": "aggregate", + "lang": "js", + "encoding": "o200k_base", + "tokens": 101, + "tokens_nocomments": 101, + "bytes": 330, + "pass": true + }, + { + "task": "h11", + "category": "aggregate", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 224, + "tokens_nocomments": 218, + "bytes": 717, + "pass": true + }, + { + "task": "h11", + "category": "aggregate", + "lang": "go", + "encoding": "o200k_base", + "tokens": 225, + "tokens_nocomments": 219, + "bytes": 717, + "pass": true + }, + { + "task": "h12", + "category": "aggregate", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 92, + "tokens_nocomments": 92, + "bytes": 283, + "pass": true + }, + { + "task": "h12", + "category": "aggregate", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 92, + "tokens_nocomments": 92, + "bytes": 283, + "pass": true + }, + { + "task": "h12", + "category": "aggregate", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 67, + "tokens_nocomments": 67, + "bytes": 270, + "pass": true + }, + { + "task": "h12", + "category": "aggregate", + "lang": "python", + "encoding": "o200k_base", + "tokens": 67, + "tokens_nocomments": 67, + "bytes": 270, + "pass": true + }, + { + "task": "h12", + "category": "aggregate", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 91, + "tokens_nocomments": 91, + "bytes": 320, + "pass": true + }, + { + "task": "h12", + "category": "aggregate", + "lang": "js", + "encoding": "o200k_base", + "tokens": 97, + "tokens_nocomments": 97, + "bytes": 320, + "pass": true + }, + { + "task": "h12", + "category": "aggregate", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 154, + "tokens_nocomments": 148, + "bytes": 530, + "pass": true + }, + { + "task": "h12", + "category": "aggregate", + "lang": "go", + "encoding": "o200k_base", + "tokens": 156, + "tokens_nocomments": 150, + "bytes": 530, + "pass": true + }, + { + "task": "h13", + "category": "aggregate", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 62, + "tokens_nocomments": 62, + "bytes": 206, + "pass": true + }, + { + "task": "h13", + "category": "aggregate", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 62, + "tokens_nocomments": 62, + "bytes": 206, + "pass": true + }, + { + "task": "h13", + "category": "aggregate", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 42, + "tokens_nocomments": 42, + "bytes": 163, + "pass": true + }, + { + "task": "h13", + "category": "aggregate", + "lang": "python", + "encoding": "o200k_base", + "tokens": 42, + "tokens_nocomments": 42, + "bytes": 163, + "pass": true + }, + { + "task": "h13", + "category": "aggregate", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 60, + "tokens_nocomments": 60, + "bytes": 224, + "pass": true + }, + { + "task": "h13", + "category": "aggregate", + "lang": "js", + "encoding": "o200k_base", + "tokens": 64, + "tokens_nocomments": 64, + "bytes": 224, + "pass": true + }, + { + "task": "h13", + "category": "aggregate", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 133, + "tokens_nocomments": 127, + "bytes": 440, + "pass": true + }, + { + "task": "h13", + "category": "aggregate", + "lang": "go", + "encoding": "o200k_base", + "tokens": 134, + "tokens_nocomments": 128, + "bytes": 440, + "pass": true + }, + { + "task": "h14", + "category": "aggregate", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 56, + "tokens_nocomments": 56, + "bytes": 168, + "pass": true + }, + { + "task": "h14", + "category": "aggregate", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 56, + "tokens_nocomments": 56, + "bytes": 168, + "pass": true + }, + { + "task": "h14", + "category": "aggregate", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 50, + "tokens_nocomments": 50, + "bytes": 177, + "pass": true + }, + { + "task": "h14", + "category": "aggregate", + "lang": "python", + "encoding": "o200k_base", + "tokens": 50, + "tokens_nocomments": 50, + "bytes": 177, + "pass": true + }, + { + "task": "h14", + "category": "aggregate", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 53, + "tokens_nocomments": 53, + "bytes": 211, + "pass": true + }, + { + "task": "h14", + "category": "aggregate", + "lang": "js", + "encoding": "o200k_base", + "tokens": 57, + "tokens_nocomments": 57, + "bytes": 211, + "pass": true + }, + { + "task": "h14", + "category": "aggregate", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 124, + "tokens_nocomments": 118, + "bytes": 416, + "pass": true + }, + { + "task": "h14", + "category": "aggregate", + "lang": "go", + "encoding": "o200k_base", + "tokens": 125, + "tokens_nocomments": 119, + "bytes": 416, + "pass": true + }, + { + "task": "h15", + "category": "aggregate", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 62, + "tokens_nocomments": 62, + "bytes": 193, + "pass": true + }, + { + "task": "h15", + "category": "aggregate", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 62, + "tokens_nocomments": 62, + "bytes": 193, + "pass": true + }, + { + "task": "h15", + "category": "aggregate", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 38, + "tokens_nocomments": 38, + "bytes": 140, + "pass": true + }, + { + "task": "h15", + "category": "aggregate", + "lang": "python", + "encoding": "o200k_base", + "tokens": 38, + "tokens_nocomments": 38, + "bytes": 140, + "pass": true + }, + { + "task": "h15", + "category": "aggregate", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 59, + "tokens_nocomments": 59, + "bytes": 234, + "pass": true + }, + { + "task": "h15", + "category": "aggregate", + "lang": "js", + "encoding": "o200k_base", + "tokens": 63, + "tokens_nocomments": 63, + "bytes": 234, + "pass": true + }, + { + "task": "h15", + "category": "aggregate", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 127, + "tokens_nocomments": 121, + "bytes": 409, + "pass": true + }, + { + "task": "h15", + "category": "aggregate", + "lang": "go", + "encoding": "o200k_base", + "tokens": 128, + "tokens_nocomments": 122, + "bytes": 409, + "pass": true + }, + { + "task": "h16", + "category": "parse", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 109, + "tokens_nocomments": 109, + "bytes": 336, + "pass": true + }, + { + "task": "h16", + "category": "parse", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 109, + "tokens_nocomments": 109, + "bytes": 336, + "pass": true + }, + { + "task": "h16", + "category": "parse", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 59, + "tokens_nocomments": 59, + "bytes": 215, + "pass": true + }, + { + "task": "h16", + "category": "parse", + "lang": "python", + "encoding": "o200k_base", + "tokens": 59, + "tokens_nocomments": 59, + "bytes": 215, + "pass": true + }, + { + "task": "h16", + "category": "parse", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 84, + "tokens_nocomments": 84, + "bytes": 299, + "pass": true + }, + { + "task": "h16", + "category": "parse", + "lang": "js", + "encoding": "o200k_base", + "tokens": 89, + "tokens_nocomments": 89, + "bytes": 299, + "pass": true + }, + { + "task": "h16", + "category": "parse", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 152, + "tokens_nocomments": 146, + "bytes": 524, + "pass": true + }, + { + "task": "h16", + "category": "parse", + "lang": "go", + "encoding": "o200k_base", + "tokens": 153, + "tokens_nocomments": 147, + "bytes": 524, + "pass": true + }, + { + "task": "h17", + "category": "parse", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 88, + "tokens_nocomments": 88, + "bytes": 285, + "pass": true + }, + { + "task": "h17", + "category": "parse", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 88, + "tokens_nocomments": 88, + "bytes": 285, + "pass": true + }, + { + "task": "h17", + "category": "parse", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 63, + "tokens_nocomments": 63, + "bytes": 251, + "pass": true + }, + { + "task": "h17", + "category": "parse", + "lang": "python", + "encoding": "o200k_base", + "tokens": 63, + "tokens_nocomments": 63, + "bytes": 251, + "pass": true + }, + { + "task": "h17", + "category": "parse", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 86, + "tokens_nocomments": 86, + "bytes": 301, + "pass": true + }, + { + "task": "h17", + "category": "parse", + "lang": "js", + "encoding": "o200k_base", + "tokens": 90, + "tokens_nocomments": 90, + "bytes": 301, + "pass": true + }, + { + "task": "h17", + "category": "parse", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 145, + "tokens_nocomments": 139, + "bytes": 498, + "pass": true + }, + { + "task": "h17", + "category": "parse", + "lang": "go", + "encoding": "o200k_base", + "tokens": 146, + "tokens_nocomments": 140, + "bytes": 498, + "pass": true + }, + { + "task": "h18", + "category": "parse", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 62, + "tokens_nocomments": 62, + "bytes": 188, + "pass": true + }, + { + "task": "h18", + "category": "parse", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 62, + "tokens_nocomments": 62, + "bytes": 188, + "pass": true + }, + { + "task": "h18", + "category": "parse", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 54, + "tokens_nocomments": 54, + "bytes": 194, + "pass": true + }, + { + "task": "h18", + "category": "parse", + "lang": "python", + "encoding": "o200k_base", + "tokens": 54, + "tokens_nocomments": 54, + "bytes": 194, + "pass": true + }, + { + "task": "h18", + "category": "parse", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 57, + "tokens_nocomments": 57, + "bytes": 219, + "pass": true + }, + { + "task": "h18", + "category": "parse", + "lang": "js", + "encoding": "o200k_base", + "tokens": 61, + "tokens_nocomments": 61, + "bytes": 219, + "pass": true + }, + { + "task": "h18", + "category": "parse", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 126, + "tokens_nocomments": 120, + "bytes": 433, + "pass": true + }, + { + "task": "h18", + "category": "parse", + "lang": "go", + "encoding": "o200k_base", + "tokens": 127, + "tokens_nocomments": 121, + "bytes": 433, + "pass": true + }, + { + "task": "h19", + "category": "parse", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 88, + "tokens_nocomments": 88, + "bytes": 259, + "pass": true + }, + { + "task": "h19", + "category": "parse", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 88, + "tokens_nocomments": 88, + "bytes": 259, + "pass": true + }, + { + "task": "h19", + "category": "parse", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 63, + "tokens_nocomments": 63, + "bytes": 223, + "pass": true + }, + { + "task": "h19", + "category": "parse", + "lang": "python", + "encoding": "o200k_base", + "tokens": 63, + "tokens_nocomments": 63, + "bytes": 223, + "pass": true + }, + { + "task": "h19", + "category": "parse", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 81, + "tokens_nocomments": 81, + "bytes": 279, + "pass": true + }, + { + "task": "h19", + "category": "parse", + "lang": "js", + "encoding": "o200k_base", + "tokens": 86, + "tokens_nocomments": 86, + "bytes": 279, + "pass": true + }, + { + "task": "h19", + "category": "parse", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 181, + "tokens_nocomments": 175, + "bytes": 579, + "pass": true + }, + { + "task": "h19", + "category": "parse", + "lang": "go", + "encoding": "o200k_base", + "tokens": 182, + "tokens_nocomments": 176, + "bytes": 579, + "pass": true + }, + { + "task": "h20", + "category": "parse", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 59, + "tokens_nocomments": 59, + "bytes": 193, + "pass": true + }, + { + "task": "h20", + "category": "parse", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 60, + "tokens_nocomments": 60, + "bytes": 193, + "pass": true + }, + { + "task": "h20", + "category": "parse", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 50, + "tokens_nocomments": 50, + "bytes": 195, + "pass": true + }, + { + "task": "h20", + "category": "parse", + "lang": "python", + "encoding": "o200k_base", + "tokens": 51, + "tokens_nocomments": 51, + "bytes": 195, + "pass": true + }, + { + "task": "h20", + "category": "parse", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 52, + "tokens_nocomments": 52, + "bytes": 203, + "pass": true + }, + { + "task": "h20", + "category": "parse", + "lang": "js", + "encoding": "o200k_base", + "tokens": 57, + "tokens_nocomments": 57, + "bytes": 203, + "pass": true + }, + { + "task": "h20", + "category": "parse", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 160, + "tokens_nocomments": 154, + "bytes": 533, + "pass": true + }, + { + "task": "h20", + "category": "parse", + "lang": "go", + "encoding": "o200k_base", + "tokens": 163, + "tokens_nocomments": 157, + "bytes": 533, + "pass": true + }, + { + "task": "h21", + "category": "validate", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 64, + "tokens_nocomments": 64, + "bytes": 211, + "pass": true + }, + { + "task": "h21", + "category": "validate", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 65, + "tokens_nocomments": 65, + "bytes": 211, + "pass": true + }, + { + "task": "h21", + "category": "validate", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 61, + "tokens_nocomments": 61, + "bytes": 229, + "pass": true + }, + { + "task": "h21", + "category": "validate", + "lang": "python", + "encoding": "o200k_base", + "tokens": 61, + "tokens_nocomments": 61, + "bytes": 229, + "pass": true + }, + { + "task": "h21", + "category": "validate", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 68, + "tokens_nocomments": 68, + "bytes": 256, + "pass": true + }, + { + "task": "h21", + "category": "validate", + "lang": "js", + "encoding": "o200k_base", + "tokens": 72, + "tokens_nocomments": 72, + "bytes": 256, + "pass": true + }, + { + "task": "h21", + "category": "validate", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 173, + "tokens_nocomments": 167, + "bytes": 574, + "pass": true + }, + { + "task": "h21", + "category": "validate", + "lang": "go", + "encoding": "o200k_base", + "tokens": 174, + "tokens_nocomments": 168, + "bytes": 574, + "pass": true + }, + { + "task": "h22", + "category": "validate", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 99, + "tokens_nocomments": 99, + "bytes": 288, + "pass": true + }, + { + "task": "h22", + "category": "validate", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 100, + "tokens_nocomments": 100, + "bytes": 288, + "pass": true + }, + { + "task": "h22", + "category": "validate", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 72, + "tokens_nocomments": 72, + "bytes": 241, + "pass": true + }, + { + "task": "h22", + "category": "validate", + "lang": "python", + "encoding": "o200k_base", + "tokens": 73, + "tokens_nocomments": 73, + "bytes": 241, + "pass": true + }, + { + "task": "h22", + "category": "validate", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 73, + "tokens_nocomments": 73, + "bytes": 254, + "pass": true + }, + { + "task": "h22", + "category": "validate", + "lang": "js", + "encoding": "o200k_base", + "tokens": 78, + "tokens_nocomments": 78, + "bytes": 254, + "pass": true + }, + { + "task": "h22", + "category": "validate", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 197, + "tokens_nocomments": 191, + "bytes": 637, + "pass": true + }, + { + "task": "h22", + "category": "validate", + "lang": "go", + "encoding": "o200k_base", + "tokens": 201, + "tokens_nocomments": 195, + "bytes": 637, + "pass": true + }, + { + "task": "h23", + "category": "validate", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 80, + "tokens_nocomments": 80, + "bytes": 261, + "pass": true + }, + { + "task": "h23", + "category": "validate", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 80, + "tokens_nocomments": 80, + "bytes": 261, + "pass": true + }, + { + "task": "h23", + "category": "validate", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 72, + "tokens_nocomments": 72, + "bytes": 272, + "pass": true + }, + { + "task": "h23", + "category": "validate", + "lang": "python", + "encoding": "o200k_base", + "tokens": 72, + "tokens_nocomments": 72, + "bytes": 272, + "pass": true + }, + { + "task": "h23", + "category": "validate", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 83, + "tokens_nocomments": 83, + "bytes": 296, + "pass": true + }, + { + "task": "h23", + "category": "validate", + "lang": "js", + "encoding": "o200k_base", + "tokens": 87, + "tokens_nocomments": 87, + "bytes": 296, + "pass": true + }, + { + "task": "h23", + "category": "validate", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 154, + "tokens_nocomments": 148, + "bytes": 493, + "pass": true + }, + { + "task": "h23", + "category": "validate", + "lang": "go", + "encoding": "o200k_base", + "tokens": 156, + "tokens_nocomments": 150, + "bytes": 493, + "pass": true + }, + { + "task": "h24", + "category": "validate", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 73, + "tokens_nocomments": 73, + "bytes": 265, + "pass": true + }, + { + "task": "h24", + "category": "validate", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 73, + "tokens_nocomments": 73, + "bytes": 265, + "pass": true + }, + { + "task": "h24", + "category": "validate", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 69, + "tokens_nocomments": 69, + "bytes": 278, + "pass": true + }, + { + "task": "h24", + "category": "validate", + "lang": "python", + "encoding": "o200k_base", + "tokens": 69, + "tokens_nocomments": 69, + "bytes": 278, + "pass": true + }, + { + "task": "h24", + "category": "validate", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 74, + "tokens_nocomments": 74, + "bytes": 303, + "pass": true + }, + { + "task": "h24", + "category": "validate", + "lang": "js", + "encoding": "o200k_base", + "tokens": 80, + "tokens_nocomments": 80, + "bytes": 303, + "pass": true + }, + { + "task": "h24", + "category": "validate", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 218, + "tokens_nocomments": 212, + "bytes": 750, + "pass": true + }, + { + "task": "h24", + "category": "validate", + "lang": "go", + "encoding": "o200k_base", + "tokens": 220, + "tokens_nocomments": 214, + "bytes": 750, + "pass": true + }, + { + "task": "h25", + "category": "validate", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 104, + "tokens_nocomments": 104, + "bytes": 306, + "pass": true + }, + { + "task": "h25", + "category": "validate", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 104, + "tokens_nocomments": 104, + "bytes": 306, + "pass": true + }, + { + "task": "h25", + "category": "validate", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 85, + "tokens_nocomments": 85, + "bytes": 289, + "pass": true + }, + { + "task": "h25", + "category": "validate", + "lang": "python", + "encoding": "o200k_base", + "tokens": 85, + "tokens_nocomments": 85, + "bytes": 289, + "pass": true + }, + { + "task": "h25", + "category": "validate", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 104, + "tokens_nocomments": 104, + "bytes": 332, + "pass": true + }, + { + "task": "h25", + "category": "validate", + "lang": "js", + "encoding": "o200k_base", + "tokens": 109, + "tokens_nocomments": 109, + "bytes": 332, + "pass": true + }, + { + "task": "h25", + "category": "validate", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 197, + "tokens_nocomments": 191, + "bytes": 614, + "pass": true + }, + { + "task": "h25", + "category": "validate", + "lang": "go", + "encoding": "o200k_base", + "tokens": 198, + "tokens_nocomments": 192, + "bytes": 614, + "pass": true + }, + { + "task": "h26", + "category": "reshape", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 63, + "tokens_nocomments": 63, + "bytes": 205, + "pass": true + }, + { + "task": "h26", + "category": "reshape", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 63, + "tokens_nocomments": 63, + "bytes": 205, + "pass": true + }, + { + "task": "h26", + "category": "reshape", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 59, + "tokens_nocomments": 59, + "bytes": 216, + "pass": true + }, + { + "task": "h26", + "category": "reshape", + "lang": "python", + "encoding": "o200k_base", + "tokens": 59, + "tokens_nocomments": 59, + "bytes": 216, + "pass": true + }, + { + "task": "h26", + "category": "reshape", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 64, + "tokens_nocomments": 64, + "bytes": 246, + "pass": true + }, + { + "task": "h26", + "category": "reshape", + "lang": "js", + "encoding": "o200k_base", + "tokens": 68, + "tokens_nocomments": 68, + "bytes": 246, + "pass": true + }, + { + "task": "h26", + "category": "reshape", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 175, + "tokens_nocomments": 169, + "bytes": 579, + "pass": true + }, + { + "task": "h26", + "category": "reshape", + "lang": "go", + "encoding": "o200k_base", + "tokens": 176, + "tokens_nocomments": 170, + "bytes": 579, + "pass": true + }, + { + "task": "h27", + "category": "reshape", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 68, + "tokens_nocomments": 68, + "bytes": 241, + "pass": true + }, + { + "task": "h27", + "category": "reshape", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 68, + "tokens_nocomments": 68, + "bytes": 241, + "pass": true + }, + { + "task": "h27", + "category": "reshape", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 63, + "tokens_nocomments": 63, + "bytes": 237, + "pass": true + }, + { + "task": "h27", + "category": "reshape", + "lang": "python", + "encoding": "o200k_base", + "tokens": 63, + "tokens_nocomments": 63, + "bytes": 237, + "pass": true + }, + { + "task": "h27", + "category": "reshape", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 61, + "tokens_nocomments": 61, + "bytes": 242, + "pass": true + }, + { + "task": "h27", + "category": "reshape", + "lang": "js", + "encoding": "o200k_base", + "tokens": 65, + "tokens_nocomments": 65, + "bytes": 242, + "pass": true + }, + { + "task": "h27", + "category": "reshape", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 181, + "tokens_nocomments": 175, + "bytes": 627, + "pass": true + }, + { + "task": "h27", + "category": "reshape", + "lang": "go", + "encoding": "o200k_base", + "tokens": 182, + "tokens_nocomments": 176, + "bytes": 627, + "pass": true + }, + { + "task": "h28", + "category": "reshape", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 97, + "tokens_nocomments": 97, + "bytes": 331, + "pass": true + }, + { + "task": "h28", + "category": "reshape", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 97, + "tokens_nocomments": 97, + "bytes": 331, + "pass": true + }, + { + "task": "h28", + "category": "reshape", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 64, + "tokens_nocomments": 64, + "bytes": 252, + "pass": true + }, + { + "task": "h28", + "category": "reshape", + "lang": "python", + "encoding": "o200k_base", + "tokens": 64, + "tokens_nocomments": 64, + "bytes": 252, + "pass": true + }, + { + "task": "h28", + "category": "reshape", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 70, + "tokens_nocomments": 70, + "bytes": 263, + "pass": true + }, + { + "task": "h28", + "category": "reshape", + "lang": "js", + "encoding": "o200k_base", + "tokens": 74, + "tokens_nocomments": 74, + "bytes": 263, + "pass": true + }, + { + "task": "h28", + "category": "reshape", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 183, + "tokens_nocomments": 177, + "bytes": 618, + "pass": true + }, + { + "task": "h28", + "category": "reshape", + "lang": "go", + "encoding": "o200k_base", + "tokens": 184, + "tokens_nocomments": 178, + "bytes": 618, + "pass": true + }, + { + "task": "h29", + "category": "reshape", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 72, + "tokens_nocomments": 72, + "bytes": 234, + "pass": true + }, + { + "task": "h29", + "category": "reshape", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 72, + "tokens_nocomments": 72, + "bytes": 234, + "pass": true + }, + { + "task": "h29", + "category": "reshape", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 65, + "tokens_nocomments": 65, + "bytes": 231, + "pass": true + }, + { + "task": "h29", + "category": "reshape", + "lang": "python", + "encoding": "o200k_base", + "tokens": 66, + "tokens_nocomments": 66, + "bytes": 231, + "pass": true + }, + { + "task": "h29", + "category": "reshape", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 65, + "tokens_nocomments": 65, + "bytes": 241, + "pass": true + }, + { + "task": "h29", + "category": "reshape", + "lang": "js", + "encoding": "o200k_base", + "tokens": 69, + "tokens_nocomments": 69, + "bytes": 241, + "pass": true + }, + { + "task": "h29", + "category": "reshape", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 177, + "tokens_nocomments": 171, + "bytes": 580, + "pass": true + }, + { + "task": "h29", + "category": "reshape", + "lang": "go", + "encoding": "o200k_base", + "tokens": 178, + "tokens_nocomments": 172, + "bytes": 580, + "pass": true + }, + { + "task": "h30", + "category": "reshape", + "lang": "howl", + "encoding": "cl100k_base", + "tokens": 62, + "tokens_nocomments": 62, + "bytes": 197, + "pass": true + }, + { + "task": "h30", + "category": "reshape", + "lang": "howl", + "encoding": "o200k_base", + "tokens": 62, + "tokens_nocomments": 62, + "bytes": 197, + "pass": true + }, + { + "task": "h30", + "category": "reshape", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 58, + "tokens_nocomments": 58, + "bytes": 222, + "pass": true + }, + { + "task": "h30", + "category": "reshape", + "lang": "python", + "encoding": "o200k_base", + "tokens": 58, + "tokens_nocomments": 58, + "bytes": 222, + "pass": true + }, + { + "task": "h30", + "category": "reshape", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 68, + "tokens_nocomments": 68, + "bytes": 270, + "pass": true + }, + { + "task": "h30", + "category": "reshape", + "lang": "js", + "encoding": "o200k_base", + "tokens": 72, + "tokens_nocomments": 72, + "bytes": 270, + "pass": true + }, + { + "task": "h30", + "category": "reshape", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 155, + "tokens_nocomments": 149, + "bytes": 536, + "pass": true + }, + { + "task": "h30", + "category": "reshape", + "lang": "go", + "encoding": "o200k_base", + "tokens": 156, + "tokens_nocomments": 150, + "bytes": 536, + "pass": true + }, + { + "task": "h31", + "category": "walk", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 41, + "tokens_nocomments": 41, + "bytes": 146, + "pass": true + }, + { + "task": "h31", + "category": "walk", + "lang": "python", + "encoding": "o200k_base", + "tokens": 41, + "tokens_nocomments": 41, + "bytes": 146, + "pass": true + }, + { + "task": "h31", + "category": "walk", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 54, + "tokens_nocomments": 54, + "bytes": 226, + "pass": true + }, + { + "task": "h31", + "category": "walk", + "lang": "js", + "encoding": "o200k_base", + "tokens": 58, + "tokens_nocomments": 58, + "bytes": 226, + "pass": true + }, + { + "task": "h31", + "category": "walk", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 141, + "tokens_nocomments": 135, + "bytes": 444, + "pass": true + }, + { + "task": "h31", + "category": "walk", + "lang": "go", + "encoding": "o200k_base", + "tokens": 142, + "tokens_nocomments": 136, + "bytes": 444, + "pass": true + }, + { + "task": "h32", + "category": "walk", + "lang": "python", + "encoding": "cl100k_base", + "tokens": 57, + "tokens_nocomments": 57, + "bytes": 199, + "pass": true + }, + { + "task": "h32", + "category": "walk", + "lang": "python", + "encoding": "o200k_base", + "tokens": 57, + "tokens_nocomments": 57, + "bytes": 199, + "pass": true + }, + { + "task": "h32", + "category": "walk", + "lang": "js", + "encoding": "cl100k_base", + "tokens": 109, + "tokens_nocomments": 109, + "bytes": 429, + "pass": true + }, + { + "task": "h32", + "category": "walk", + "lang": "js", + "encoding": "o200k_base", + "tokens": 114, + "tokens_nocomments": 114, + "bytes": 429, + "pass": true + }, + { + "task": "h32", + "category": "walk", + "lang": "go", + "encoding": "cl100k_base", + "tokens": 196, + "tokens_nocomments": 190, + "bytes": 645, + "pass": true + }, + { + "task": "h32", + "category": "walk", + "lang": "go", + "encoding": "o200k_base", + "tokens": 198, + "tokens_nocomments": 192, + "bytes": 645, + "pass": true + } +] diff --git a/experiments/token-efficiency-heldout-v0/results/verification.json b/experiments/token-efficiency-heldout-v0/results/verification.json new file mode 100644 index 0000000..37eab5b --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/results/verification.json @@ -0,0 +1,758 @@ +[ + { + "task": "h01", + "lang": "howl", + "pass": true, + "sha256": "b4de690a94feafe6fee53dace2c98c1b54e3df174f28831cb079979be816b59e" + }, + { + "task": "h02", + "lang": "howl", + "pass": true, + "sha256": "6cdaac65ab7e5cf8fe48bd36f7566f824ec9cf809d05d5d840e308d70bf9ae2e" + }, + { + "task": "h03", + "lang": "howl", + "pass": true, + "sha256": "28fe212b9313bf0a87ac292098626b862d3746ce8f37e1e6183848703b6cd9c7" + }, + { + "task": "h04", + "lang": "howl", + "pass": true, + "sha256": "a86c6fb7c64a9127f2f002db65af8dcf737c9b269192e73c4d7b0cd9e5fdad05" + }, + { + "task": "h05", + "lang": "howl", + "pass": true, + "sha256": "286b716b9155ba003e7dd618ad42436e16f387ba8ff0a5e2b6ec4048756402a7" + }, + { + "task": "h06", + "lang": "howl", + "pass": true, + "sha256": "1850ea29d9337bf1912d6b9105ec09ba8afd39ffc37b62db0d0bc7852cf276ea" + }, + { + "task": "h07", + "lang": "howl", + "pass": true, + "sha256": "c371b635596e230839e25e9aac14bd6b0db14844564e5b772985c022117c29bb" + }, + { + "task": "h08", + "lang": "howl", + "pass": true, + "sha256": "91330ac95a1cf8745bd2040042d449a0bdf77b3b76b96cd3e1e377dc5863d054" + }, + { + "task": "h09", + "lang": "howl", + "pass": true, + "sha256": "b1749f7053e6511d0ebaa8d2dc050acaa3d4f48e31cbbe2f953d88822b79ff54" + }, + { + "task": "h10", + "lang": "howl", + "pass": true, + "sha256": "62be5b650b51ddebefeaefef2181e2898dd97d90b3ec8186c6f1756102f95ad7" + }, + { + "task": "h11", + "lang": "howl", + "pass": true, + "sha256": "266248df5f57d46c001045d0c1b90ed51f649b0a2c442a7ebc9cb35eef28fd48" + }, + { + "task": "h12", + "lang": "howl", + "pass": true, + "sha256": "e06880a540f1b2f853b00cc0d366b22ccd30ab22b79a3c5b90aaca4acb369792" + }, + { + "task": "h13", + "lang": "howl", + "pass": true, + "sha256": "939b6aeaeef5e96f0dc07a7524507f95e88b54ce497aeb004251c6c88f7ef1fa" + }, + { + "task": "h14", + "lang": "howl", + "pass": true, + "sha256": "851d0ed640e674c73a1c244ea9fe109db706532c928764013013e3c3ea30d7f7" + }, + { + "task": "h15", + "lang": "howl", + "pass": true, + "sha256": "73c5cbbe59036fb1217d545bc76665bf5f58daaa1c0a472c9c96a38447acc777" + }, + { + "task": "h16", + "lang": "howl", + "pass": true, + "sha256": "1f22506e18b96edf2a2b8eb99094dccff1940d1f6fc8f9786de9e17f2729c580" + }, + { + "task": "h17", + "lang": "howl", + "pass": true, + "sha256": "1b2c6bbde05473dd1dc539468be7ae3d15a43d6d0b8971813634c29be717c146" + }, + { + "task": "h18", + "lang": "howl", + "pass": true, + "sha256": "e92bf7ed57ed7b1dbf864122c4d5f9fba4892313e24ff65a1fbfbfe728ec1c40" + }, + { + "task": "h19", + "lang": "howl", + "pass": true, + "sha256": "b7bd999315e5a09f94b89bd3e24218b21978295ffae16935a9e1072c41b65340" + }, + { + "task": "h20", + "lang": "howl", + "pass": true, + "sha256": "0fc488b6133d71fafc955ff1f6e1f34b4dc18a8fd2859a5882a436d65e3833f6" + }, + { + "task": "h21", + "lang": "howl", + "pass": true, + "sha256": "131d369bd2ec71182aed19a80ef6bcba25018dcd498ca6428fbc7b23049d5061" + }, + { + "task": "h22", + "lang": "howl", + "pass": true, + "sha256": "348bf96094d72de914a2347556a87423d1cb69f54fb16a40273e2305976db81f" + }, + { + "task": "h23", + "lang": "howl", + "pass": true, + "sha256": "f998d8189a63721548335c6ab412c7c84caf3cf3e32d01a75cb7d1fa778209b3" + }, + { + "task": "h24", + "lang": "howl", + "pass": true, + "sha256": "9b9195ed368ae5d0045d015fbf5d8a7ac70a7fff3a994c008c791e53a3758152" + }, + { + "task": "h25", + "lang": "howl", + "pass": true, + "sha256": "0d81dc7acde6316c6b8886c54c38aab91568ac5c185d7a275a1c9b6fb1156836" + }, + { + "task": "h26", + "lang": "howl", + "pass": true, + "sha256": "bd0deb275b6afeffd3f16ee96fcc69b2ab25d2554ac4b44857cb2d5c93de088d" + }, + { + "task": "h27", + "lang": "howl", + "pass": true, + "sha256": "593af43a1306b0aaf5aa8fe356497dcc1f76a5247a33d28f158d6a08de829f45" + }, + { + "task": "h28", + "lang": "howl", + "pass": true, + "sha256": "6603f4e0e88857a619f902df4f7a731329dbf4b64074abcf56d997fe429c9b43" + }, + { + "task": "h29", + "lang": "howl", + "pass": true, + "sha256": "0953d2707c42c3e00ff597c1e2c23bea4abcd882e14a733e68b29f26f3bdcd02" + }, + { + "task": "h30", + "lang": "howl", + "pass": true, + "sha256": "ae952468b04822b901d73767f9e240e4e374c588b1925782a66772b602b099ea" + }, + { + "task": "h01", + "lang": "python", + "pass": true, + "sha256": "4f2f858c937c95c8ebd433083a9cfcf091b9ef0775569389009a4b96741e91d2" + }, + { + "task": "h02", + "lang": "python", + "pass": true, + "sha256": "f42b028456fa49a3f14a4d19e93df065e7e8fad964ec88a2f63b673b60a2f37f" + }, + { + "task": "h03", + "lang": "python", + "pass": true, + "sha256": "9a5ca0de7370dff2af6e0e1083874f90e025c438a1968fd4325c8326e2797eb2" + }, + { + "task": "h04", + "lang": "python", + "pass": true, + "sha256": "d0b7ab420461c352c77bdfde9fccf49898407dcdd096751486087ae7ddc97dd6" + }, + { + "task": "h05", + "lang": "python", + "pass": true, + "sha256": "baeefb32824ce6be6f02a8b239bb1b6c76f772ca41eb595f54bc8bfe02d237e7" + }, + { + "task": "h06", + "lang": "python", + "pass": true, + "sha256": "40f4dd86ba39f55af7f327de0717ca96768df36d30a22f4c4692c48a102afe87" + }, + { + "task": "h07", + "lang": "python", + "pass": true, + "sha256": "6420a906c13d0b49409dff5edef52f73d854d5a3ece2a2565cd38d180ed49ca1" + }, + { + "task": "h08", + "lang": "python", + "pass": true, + "sha256": "e988e38d6531a0282542dc2346c2bb02ddca1609f563b8678c105bc5b768acb6" + }, + { + "task": "h09", + "lang": "python", + "pass": true, + "sha256": "487c78a6fb57e477cf0ddb9e9f4b183dce9d2fa5886c87dbb77a86f9b07418de" + }, + { + "task": "h10", + "lang": "python", + "pass": true, + "sha256": "027928342905eac12c6f8a4b4a0779a4b69c33c7bf41fa2dba464866390b6452" + }, + { + "task": "h11", + "lang": "python", + "pass": true, + "sha256": "6378cb337a1a4a4b30a0379c13c6f41b798831d001b49eae9fe05a218b765f28" + }, + { + "task": "h12", + "lang": "python", + "pass": true, + "sha256": "ef873c7fbfae70e8f0de98ef08d4d4835c592c4258b498be60e55ed50b3e8c65" + }, + { + "task": "h13", + "lang": "python", + "pass": true, + "sha256": "94197926ffa52cfa5ce3ef6f43301910a58d59b43a83b9c70d74897c85c47496" + }, + { + "task": "h14", + "lang": "python", + "pass": true, + "sha256": "5a0d4c6cd40d504f4e6bac87d03998b3db8e8ed387682bdbfdce1ec76d398eba" + }, + { + "task": "h15", + "lang": "python", + "pass": true, + "sha256": "d71970c859e45d298284f87c4b207bbbf9c243924987ea9af3fe30690ee3bd0e" + }, + { + "task": "h16", + "lang": "python", + "pass": true, + "sha256": "5370a3a8b05fc6a6d949274fced699d9b20267be3dbaae03ed586c86608e2ac0" + }, + { + "task": "h17", + "lang": "python", + "pass": true, + "sha256": "3a5ce38bd09da174b880bf692dd6b61af5cf2bc76461bff4e93ac06bf06a6b5e" + }, + { + "task": "h18", + "lang": "python", + "pass": true, + "sha256": "1044de98234037baf6d54c9717c7e3a1c94f3f26b6c7a01bb53f07ff039495da" + }, + { + "task": "h19", + "lang": "python", + "pass": true, + "sha256": "1679efba38f6c6ed238305b37e6f9061826a135f27970e615524aa576e511fac" + }, + { + "task": "h20", + "lang": "python", + "pass": true, + "sha256": "1efeb040fe4242ad846f56367417124f561b97e10b3d65d4683d27dafb0e7afb" + }, + { + "task": "h21", + "lang": "python", + "pass": true, + "sha256": "6f940610e5558d7855dd32e2c1db2e486db98476ad9c88fc43530e1f5164a74f" + }, + { + "task": "h22", + "lang": "python", + "pass": true, + "sha256": "73be9f869de3b4adc3f9152eedec3d1ab13b6f2a092384910c453a18ff4e4ed6" + }, + { + "task": "h23", + "lang": "python", + "pass": true, + "sha256": "026134d6ff7fe1af88e9293fcd9a7b242733e3cf0c8929ab7f64f017349c828c" + }, + { + "task": "h24", + "lang": "python", + "pass": true, + "sha256": "106dee982a5cc21599aaf9456c9ad4caf8192d3d1e7c751a1d8342a5d6d78e75" + }, + { + "task": "h25", + "lang": "python", + "pass": true, + "sha256": "bc0316ef6d7737d41a8e90fc51b00fb51dfdb941020f07a60c0853c6578637b6" + }, + { + "task": "h26", + "lang": "python", + "pass": true, + "sha256": "d6474388680a2f12e9320272c3e22512389254c58f3935be61639f1c63e6367c" + }, + { + "task": "h27", + "lang": "python", + "pass": true, + "sha256": "ab574fe3795318a1221f3062ca65509dedb4dc5a6cb29b1e8acbef0dfd05ca3e" + }, + { + "task": "h28", + "lang": "python", + "pass": true, + "sha256": "0fc05f767a70162adb89046931a37fcf4d99f8aa14ac36c7373d7619b91515ae" + }, + { + "task": "h29", + "lang": "python", + "pass": true, + "sha256": "7fcfa8b0919f92ad56543f3c8df695415393a471e8ec6bc87ba81db3ac8e3d46" + }, + { + "task": "h30", + "lang": "python", + "pass": true, + "sha256": "26f4b7bdfbbb243358f379802551f8617035565d6d73ffd3572ab5b8229c6287" + }, + { + "task": "h31", + "lang": "python", + "pass": true, + "sha256": "28295d265e2b3ebb2e1772ce8a71557fecb2093e203ed81e57f25a8e6a2bce80" + }, + { + "task": "h32", + "lang": "python", + "pass": true, + "sha256": "35bcc7cd514a8e9e76fff30c286c640dc0bd7ca8c48b6a4c912f0c1a10cb8893" + }, + { + "task": "h01", + "lang": "js", + "pass": true, + "sha256": "ed85768b3c7331f4ab8fce7afb6f23cea40ad4861e08bf606d857d49fdca671a" + }, + { + "task": "h02", + "lang": "js", + "pass": true, + "sha256": "22d776b0fc78c3b1338e03cc45f36d1e0297507bac0161da7c55c6df6abce1eb" + }, + { + "task": "h03", + "lang": "js", + "pass": true, + "sha256": "d487a4c5368009eaac2aba60f03cd5345230ce230aa57372ad4d5bff877557b9" + }, + { + "task": "h04", + "lang": "js", + "pass": true, + "sha256": "2ccae5bb12be92bea499ea1385342e72c3acebdfefc4f369336e63ffa973107e" + }, + { + "task": "h05", + "lang": "js", + "pass": true, + "sha256": "ec7f32f93db53aa2022a2e3ef417a7ffbcb5656f23f01d3956369b6a8e89ae48" + }, + { + "task": "h06", + "lang": "js", + "pass": true, + "sha256": "9566570463f16372eeb6d72f913ee0471245f5da4fe7bb939dabb88604ff0657" + }, + { + "task": "h07", + "lang": "js", + "pass": true, + "sha256": "55cf2b6074540a05c9888f438537e7adaff140e4c75c7b023d147b8a586030d4" + }, + { + "task": "h08", + "lang": "js", + "pass": true, + "sha256": "982457bac94c08f58c06e3e2572137b8cd53245845782d1dbf3ba0720a64ef9d" + }, + { + "task": "h09", + "lang": "js", + "pass": true, + "sha256": "68ba81a2020a4daa2a2f1c96edd732f7a68c2071a988aaa37880debe8f5c4010" + }, + { + "task": "h10", + "lang": "js", + "pass": true, + "sha256": "82fd8d9c135b3154eea0815a4cf80a860ed2106745cd9e8e07a13fad79ab102c" + }, + { + "task": "h11", + "lang": "js", + "pass": true, + "sha256": "b24eaca279d260c1f7d22de3f111c99b900df0a9050ae46eec3b03abf173f4eb" + }, + { + "task": "h12", + "lang": "js", + "pass": true, + "sha256": "a799801ada1a36244eb78e6519a938e877c026bc4f84db2f25cf719a1b79a65e" + }, + { + "task": "h13", + "lang": "js", + "pass": true, + "sha256": "a4dad63f39559e88aadf0c3163c359964fb0f430f8e88bd7d380771a04feafa7" + }, + { + "task": "h14", + "lang": "js", + "pass": true, + "sha256": "3d45243fad89a36d37d3cd70404af039f57fe03c34c491493345b7a8475b7fb3" + }, + { + "task": "h15", + "lang": "js", + "pass": true, + "sha256": "aa24e2f02ea5ee570a0b6701656778693f67cdb7cba37bd6faaebc0c0f4f34bb" + }, + { + "task": "h16", + "lang": "js", + "pass": true, + "sha256": "2f068c42a0e9feb554127ed33e3b14330f5120d67f06a03833f8af8fc5991acc" + }, + { + "task": "h17", + "lang": "js", + "pass": true, + "sha256": "2063e580378002d9ab92000fb3ee9e1ebc5d406161658274562c54be4d726db4" + }, + { + "task": "h18", + "lang": "js", + "pass": true, + "sha256": "3741104ec8552fd070f99756f350e4cc39010c41076f51be1b6ba3190c65f8c7" + }, + { + "task": "h19", + "lang": "js", + "pass": true, + "sha256": "c4215c3f9e48c09891d791d1bb6245adf902e0194d49083b42698d96ab4ce5e6" + }, + { + "task": "h20", + "lang": "js", + "pass": true, + "sha256": "f04179414e8ae40577158eaa6dbba58ebc852a92ff235b216a0ad7b9c5e437a7" + }, + { + "task": "h21", + "lang": "js", + "pass": true, + "sha256": "7c78238feb28d25a7d27b11968c7f68634ff9886478a57f532b773f37f39cc4c" + }, + { + "task": "h22", + "lang": "js", + "pass": true, + "sha256": "cb8ef0964bc2cd8c376f9f748a360733c45e7b8cd36f162e9826d19201ba59ba" + }, + { + "task": "h23", + "lang": "js", + "pass": true, + "sha256": "7d7dcc055dc0a50b0ecd0e49d79e22a326f6f192850d851be845ae8103d129b6" + }, + { + "task": "h24", + "lang": "js", + "pass": true, + "sha256": "494650fed76da0200392c91eb4db61632251692a4b8c69d944f316d1ea8a8d0e" + }, + { + "task": "h25", + "lang": "js", + "pass": true, + "sha256": "09a8a50c268f48724bdcd9e1a84d7fae58e295d39fdd913c4703fdca0f6359b7" + }, + { + "task": "h26", + "lang": "js", + "pass": true, + "sha256": "fd053154d4eb4a67f7adf22665dd3c88593319d732209bde0290e3a5c108c2b6" + }, + { + "task": "h27", + "lang": "js", + "pass": true, + "sha256": "496b5247495ddbe082033e450313d1f32a44058177113ac833296242c0220af5" + }, + { + "task": "h28", + "lang": "js", + "pass": true, + "sha256": "cd9ca67668100a0ed0d507a52ebb1cb6ec96af29a2e53e06d03e9c58237cf8c6" + }, + { + "task": "h29", + "lang": "js", + "pass": true, + "sha256": "d3a8d32a5f139157b17f725ea3d77b6542d354604ac4edc70337dd4852bb2573" + }, + { + "task": "h30", + "lang": "js", + "pass": true, + "sha256": "7d14dc6c7fd758ed87699c167bdf8815a74fb54a453ce37c6198ce4325a948bf" + }, + { + "task": "h31", + "lang": "js", + "pass": true, + "sha256": "907d594579552cb74fd8eebc92bfac84b2461ba06830788decc7b637c48c702e" + }, + { + "task": "h32", + "lang": "js", + "pass": true, + "sha256": "4ee11e20975ef48d58fba9be3156d2725e18cd467c1411d9a664d1f0c35f1735" + }, + { + "task": "h01", + "lang": "go", + "pass": true, + "sha256": "3ef78ec6cef665d45009bf955ec355cb3202cf107745ca0b4089ac5d3ae85a35" + }, + { + "task": "h02", + "lang": "go", + "pass": true, + "sha256": "de4b2dcf329b6873970280d091822761df02f9757ca5e656a1c5af07b7613d4a" + }, + { + "task": "h03", + "lang": "go", + "pass": true, + "sha256": "56dac09eea18669edeac5ed673a9c97189d02e1d44ddbf6bf4aa45d1386cb25f" + }, + { + "task": "h04", + "lang": "go", + "pass": true, + "sha256": "5d787a897183bbff89b9e62415d748c8834bde41e940b80abb2c71143b34d8c5" + }, + { + "task": "h05", + "lang": "go", + "pass": true, + "sha256": "c40b4bae5c7846e23e4526c264487c3a0847d8de3b272eedd1141ec193183e8f" + }, + { + "task": "h06", + "lang": "go", + "pass": true, + "sha256": "573319e1ed7c078e22392117f8ee4cf13f5f959882d159c6c351da67c2ed6529" + }, + { + "task": "h07", + "lang": "go", + "pass": true, + "sha256": "7548872e4ff08c74998fcbc0de1d0194456c12dcb8334bb993471c9fbe94dc28" + }, + { + "task": "h08", + "lang": "go", + "pass": true, + "sha256": "6db3310e9cd829dd0c824b29fb1e67024f9fa834ca1b158d2c60f2135fb90f8e" + }, + { + "task": "h09", + "lang": "go", + "pass": true, + "sha256": "256421d5a08b40a9609f59aac6215998bdfa32fd9cbf2dea062c3558930fd6ff" + }, + { + "task": "h10", + "lang": "go", + "pass": true, + "sha256": "948358441c4bd3033688c8caf8f468d01a69753acbd968203623168681e38873" + }, + { + "task": "h11", + "lang": "go", + "pass": true, + "sha256": "fa80a151719f8d5b7dea700e3ae065fe38c072c8ce5ce3ba6fe3222a1ea18b38" + }, + { + "task": "h12", + "lang": "go", + "pass": true, + "sha256": "1a536cfc670938fc9dc870b4cb855df3b3c196b5c7c48b406b4758c96688e9d4" + }, + { + "task": "h13", + "lang": "go", + "pass": true, + "sha256": "90d71aeeb40ef71422b1b2f6d8b4ea3d5b21ff33d119c613dfc231e194cfcdb8" + }, + { + "task": "h14", + "lang": "go", + "pass": true, + "sha256": "bd2dd389e05bb5a7278b0088727fbd5e90c215d793966d2f9319dc4d8db8653e" + }, + { + "task": "h15", + "lang": "go", + "pass": true, + "sha256": "933aee58ff41565613c1c1d4a74c753e043357262f7e3436acc75c9d7ef1133c" + }, + { + "task": "h16", + "lang": "go", + "pass": true, + "sha256": "f37cc554c73690f0f9a6c6f79de58d10436f144df5ac0165c7aede9633fb01fd" + }, + { + "task": "h17", + "lang": "go", + "pass": true, + "sha256": "e66efabe47bc98d5ec5ce46d6abf346466bafe228d4055062dbd447767946bf1" + }, + { + "task": "h18", + "lang": "go", + "pass": true, + "sha256": "a4c5a7a84de4bf7e9923182adf24ae925d8f505b3d5baf70f94ba24f1c3721bd" + }, + { + "task": "h19", + "lang": "go", + "pass": true, + "sha256": "6166969bdcf4c96adacbeb2d5e4bcc77ef10a04fc14eb6fe297a87eef554b7a0" + }, + { + "task": "h20", + "lang": "go", + "pass": true, + "sha256": "f3a1dc8644d457e4c7b45802ac5b338470dbb6348af82e93de32972704fb2cf1" + }, + { + "task": "h21", + "lang": "go", + "pass": true, + "sha256": "7dff3d4638679eba64bc0aa826f6df060d6194f89fb27d429d5b5a1a1a5d2e96" + }, + { + "task": "h22", + "lang": "go", + "pass": true, + "sha256": "d51d2d23710e5e8fec4a7b449b7738c5bfec1f417170818dff1f6c79c9372c19" + }, + { + "task": "h23", + "lang": "go", + "pass": true, + "sha256": "6a88e87572e528b7fb46e1a218fe4ec2d1e6ee7b2eeb38eb97c71cd1bc3bf8b5" + }, + { + "task": "h24", + "lang": "go", + "pass": true, + "sha256": "e702f6f81daa29c4c772a9fa76834b157592125dbffc3cc62638d601b5e632da" + }, + { + "task": "h25", + "lang": "go", + "pass": true, + "sha256": "2f0aa4987aa2df5d396dc931426d391da36fe1c701bffd7029da3084d405495f" + }, + { + "task": "h26", + "lang": "go", + "pass": true, + "sha256": "fd3a41116a6bbb5cd31e137f0b612f5d811a6dee2596d2c0375f9684fb2bc684" + }, + { + "task": "h27", + "lang": "go", + "pass": true, + "sha256": "32a052df2580f0d90e86083f0a535d5420abcb4e90595ed666b3af83367b09fe" + }, + { + "task": "h28", + "lang": "go", + "pass": true, + "sha256": "0f9ac96ff9361763d8b0d6c971678f702aa790277e70f27d3bb9966dabf1ddd7" + }, + { + "task": "h29", + "lang": "go", + "pass": true, + "sha256": "96f195da264dacc8aa963ad40a0a45ba65b4ca47d5897fb20e93bc6350f8be5c" + }, + { + "task": "h30", + "lang": "go", + "pass": true, + "sha256": "8265c91a860879e20070185a9699043c265087d383eecc3da8e430dfde81cb2c" + }, + { + "task": "h31", + "lang": "go", + "pass": true, + "sha256": "7453c3a0680e5b367e5ab7dc101119f35ae482c14bd517bc62083c4c6b23dc4a" + }, + { + "task": "h32", + "lang": "go", + "pass": true, + "sha256": "025371b372077b1408245fac4c5caeb60c3767c5d15bd2659abfe49e56ef0ada" + } +] diff --git a/experiments/token-efficiency-heldout-v0/run.sh b/experiments/token-efficiency-heldout-v0/run.sh new file mode 100755 index 0000000..679779e --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/run.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")/../.." +export GOCACHE="${GOCACHE:-/tmp/hf-token-go-cache}" +go build -o /tmp/howlframe . +go build -o /tmp/heldoutverify ./experiments/token-efficiency-heldout-v0/cmd/heldoutverify +status=0 +/tmp/heldoutverify -howlframe /tmp/howlframe || status=$? +if [ "$status" -eq 0 ]; then + "${TOKBENCH_PYTHON:-python3}" experiments/token-efficiency-heldout-v0/count_tokens.py +fi +exit "$status" diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h01.go b/experiments/token-efficiency-heldout-v0/solutions/go/h01.go new file mode 100644 index 0000000..37f61b5 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h01.go @@ -0,0 +1,22 @@ +//go:build ignore + +package main + +import ( + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/text.txt") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + for i, line := range lines { + lines[i] = strings.ToUpper(line) + } + if err := os.WriteFile("out/result.txt", []byte(strings.Join(lines, "\n")+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h02.go b/experiments/token-efficiency-heldout-v0/solutions/go/h02.go new file mode 100644 index 0000000..7b1951f --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h02.go @@ -0,0 +1,22 @@ +//go:build ignore + +package main + +import ( + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/text.txt") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + for i, j := 0, len(lines)-1; i < j; i, j = i+1, j-1 { + lines[i], lines[j] = lines[j], lines[i] + } + if err := os.WriteFile("out/result.txt", []byte(strings.Join(lines, "\n")+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h03.go b/experiments/token-efficiency-heldout-v0/solutions/go/h03.go new file mode 100644 index 0000000..26c47f8 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h03.go @@ -0,0 +1,23 @@ +//go:build ignore + +package main + +import ( + "fmt" + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/text.txt") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + for i, line := range lines { + lines[i] = fmt.Sprintf("%d: %s", i+1, line) + } + if err := os.WriteFile("out/result.txt", []byte(strings.Join(lines, "\n")+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h04.go b/experiments/token-efficiency-heldout-v0/solutions/go/h04.go new file mode 100644 index 0000000..d6c6bc4 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h04.go @@ -0,0 +1,25 @@ +//go:build ignore + +package main + +import ( + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/text.txt") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + var kept []string + for _, line := range lines { + if trimmed := strings.TrimSpace(line); trimmed != "" { + kept = append(kept, trimmed) + } + } + if err := os.WriteFile("out/result.txt", []byte(strings.Join(kept, "\n")+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h05.go b/experiments/token-efficiency-heldout-v0/solutions/go/h05.go new file mode 100644 index 0000000..ec663cc --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h05.go @@ -0,0 +1,18 @@ +//go:build ignore + +package main + +import ( + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/text.txt") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.txt", []byte(strings.ReplaceAll(string(data), "foo", "bar")+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h06.go b/experiments/token-efficiency-heldout-v0/solutions/go/h06.go new file mode 100644 index 0000000..dc0fece --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h06.go @@ -0,0 +1,29 @@ +//go:build ignore + +package main + +import ( + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/data.csv") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + col := -1 + for i, name := range strings.Split(lines[0], ",") { + if name == "email" { + col = i + } + } + var emails []string + for _, row := range lines[1:] { + emails = append(emails, strings.Split(row, ",")[col]) + } + if err := os.WriteFile("out/result.txt", []byte(strings.Join(emails, "\n")+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h07.go b/experiments/token-efficiency-heldout-v0/solutions/go/h07.go new file mode 100644 index 0000000..10c0c46 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h07.go @@ -0,0 +1,36 @@ +//go:build ignore + +package main + +import ( + "os" + "strconv" + "strings" +) + +func main() { + data, err := os.ReadFile("in/data.csv") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + col := -1 + for i, name := range strings.Split(lines[0], ",") { + if name == "age" { + col = i + } + } + kept := []string{lines[0]} + for _, row := range lines[1:] { + age, err := strconv.Atoi(strings.Split(row, ",")[col]) + if err != nil { + panic(err) + } + if age >= 30 { + kept = append(kept, row) + } + } + if err := os.WriteFile("out/result.csv", []byte(strings.Join(kept, "\n")+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h08.go b/experiments/token-efficiency-heldout-v0/solutions/go/h08.go new file mode 100644 index 0000000..e44dc46 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h08.go @@ -0,0 +1,35 @@ +//go:build ignore + +package main + +import ( + "fmt" + "os" + "strconv" + "strings" +) + +func main() { + data, err := os.ReadFile("in/data.csv") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + col := -1 + for i, name := range strings.Split(lines[0], ",") { + if name == "amount" { + col = i + } + } + total := 0 + for _, row := range lines[1:] { + amount, err := strconv.Atoi(strings.Split(row, ",")[col]) + if err != nil { + panic(err) + } + total += amount + } + if err := os.WriteFile("out/result.txt", []byte(fmt.Sprintf("%d\n", total)), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h09.go b/experiments/token-efficiency-heldout-v0/solutions/go/h09.go new file mode 100644 index 0000000..5699462 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h09.go @@ -0,0 +1,33 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/data.csv") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + header := strings.Split(lines[0], ",") + rows := []map[string]string{} + for _, line := range lines[1:] { + row := map[string]string{} + for i, value := range strings.Split(line, ",") { + row[header[i]] = value + } + rows = append(rows, row) + } + out, err := json.MarshalIndent(rows, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h10.go b/experiments/token-efficiency-heldout-v0/solutions/go/h10.go new file mode 100644 index 0000000..5cdd129 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h10.go @@ -0,0 +1,34 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/data.csv") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + col := -1 + for i, name := range strings.Split(lines[0], ",") { + if name == "dept" { + col = i + } + } + counts := map[string]int{} + for _, row := range lines[1:] { + counts[strings.Split(row, ",")[col]]++ + } + out, err := json.MarshalIndent(counts, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h11.go b/experiments/token-efficiency-heldout-v0/solutions/go/h11.go new file mode 100644 index 0000000..4c36689 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h11.go @@ -0,0 +1,40 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" + "strconv" + "strings" +) + +func main() { + data, err := os.ReadFile("in/numbers.txt") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + var minimum, maximum, sum int + for i, line := range lines { + n, err := strconv.Atoi(line) + if err != nil { + panic(err) + } + if i == 0 || n < minimum { + minimum = n + } + if i == 0 || n > maximum { + maximum = n + } + sum += n + } + result := map[string]int{"min": minimum, "max": maximum, "sum": sum} + out, err := json.MarshalIndent(result, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h12.go b/experiments/token-efficiency-heldout-v0/solutions/go/h12.go new file mode 100644 index 0000000..af6b27b --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h12.go @@ -0,0 +1,29 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/words.txt") + if err != nil { + panic(err) + } + counts := map[string]int{} + for _, line := range strings.Split(strings.ToLower(string(data)), "\n") { + for _, word := range strings.Split(line, " ") { + counts[word]++ + } + } + out, err := json.MarshalIndent(counts, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h13.go b/experiments/token-efficiency-heldout-v0/solutions/go/h13.go new file mode 100644 index 0000000..4dc2d94 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h13.go @@ -0,0 +1,27 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "fmt" + "os" +) + +func main() { + data, err := os.ReadFile("in/scores.json") + if err != nil { + panic(err) + } + var scores []int + if err := json.Unmarshal(data, &scores); err != nil { + panic(err) + } + total := 0 + for _, s := range scores { + total += s + } + if err := os.WriteFile("out/result.txt", []byte(fmt.Sprintf("%d\n", total/len(scores))), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h14.go b/experiments/token-efficiency-heldout-v0/solutions/go/h14.go new file mode 100644 index 0000000..0723f41 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h14.go @@ -0,0 +1,26 @@ +//go:build ignore + +package main + +import ( + "fmt" + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/app.log") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + count := 0 + for _, line := range lines { + if strings.Contains(line, "ERROR") { + count++ + } + } + if err := os.WriteFile("out/result.txt", []byte(fmt.Sprintf("%d\n", count)), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h15.go b/experiments/token-efficiency-heldout-v0/solutions/go/h15.go new file mode 100644 index 0000000..da71680 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h15.go @@ -0,0 +1,25 @@ +//go:build ignore + +package main + +import ( + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/text.txt") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + longest := lines[0] + for _, line := range lines[1:] { + if len(line) > len(longest) { + longest = line + } + } + if err := os.WriteFile("out/result.txt", []byte(longest+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h16.go b/experiments/token-efficiency-heldout-v0/solutions/go/h16.go new file mode 100644 index 0000000..01f854e --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h16.go @@ -0,0 +1,29 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/config.kv") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + config := map[string]string{} + for _, line := range lines { + key, value, _ := strings.Cut(line, "=") + config[key] = value + } + out, err := json.MarshalIndent(config, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h17.go b/experiments/token-efficiency-heldout-v0/solutions/go/h17.go new file mode 100644 index 0000000..8001ac2 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h17.go @@ -0,0 +1,28 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/events.log") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + counts := map[string]int{} + for _, line := range lines { + counts[strings.Split(line, "|")[0]]++ + } + out, err := json.MarshalIndent(counts, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h18.go b/experiments/token-efficiency-heldout-v0/solutions/go/h18.go new file mode 100644 index 0000000..6ea9d2c --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h18.go @@ -0,0 +1,23 @@ +//go:build ignore + +package main + +import ( + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/emails.txt") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + var domains []string + for _, email := range lines { + domains = append(domains, strings.Split(email, "@")[1]) + } + if err := os.WriteFile("out/result.txt", []byte(strings.Join(domains, "\n")+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h19.go b/experiments/token-efficiency-heldout-v0/solutions/go/h19.go new file mode 100644 index 0000000..aac5924 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h19.go @@ -0,0 +1,34 @@ +//go:build ignore + +package main + +import ( + "fmt" + "os" + "strconv" + "strings" +) + +func main() { + data, err := os.ReadFile("in/times.txt") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + total := 0 + for _, line := range lines { + h, m, _ := strings.Cut(line, ":") + hours, err := strconv.Atoi(h) + if err != nil { + panic(err) + } + minutes, err := strconv.Atoi(m) + if err != nil { + panic(err) + } + total += hours*60 + minutes + } + if err := os.WriteFile("out/result.txt", []byte(fmt.Sprintf("%d\n", total)), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h20.go b/experiments/token-efficiency-heldout-v0/solutions/go/h20.go new file mode 100644 index 0000000..c928070 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h20.go @@ -0,0 +1,31 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/tags.txt") + if err != nil { + panic(err) + } + seen := map[string]bool{} + unique := []string{} + for _, tag := range strings.Split(string(data), ";") { + if !seen[tag] { + seen[tag] = true + unique = append(unique, tag) + } + } + out, err := json.MarshalIndent(unique, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h21.go b/experiments/token-efficiency-heldout-v0/solutions/go/h21.go new file mode 100644 index 0000000..474e203 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h21.go @@ -0,0 +1,32 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" +) + +func main() { + data, err := os.ReadFile("in/users.json") + if err != nil { + panic(err) + } + var users []map[string]any + if err := json.Unmarshal(data, &users); err != nil { + panic(err) + } + missing := []any{} + for _, user := range users { + if _, ok := user["email"]; !ok { + missing = append(missing, user["id"]) + } + } + out, err := json.MarshalIndent(missing, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h22.go b/experiments/token-efficiency-heldout-v0/solutions/go/h22.go new file mode 100644 index 0000000..6c1078f --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h22.go @@ -0,0 +1,35 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "fmt" + "os" + "strings" +) + +func main() { + data, err := os.ReadFile("in/people.json") + if err != nil { + panic(err) + } + var people []struct { + ID string `json:"id"` + Age int `json:"age"` + } + if err := json.Unmarshal(data, &people); err != nil { + panic(err) + } + var lines []string + for _, p := range people { + status := "invalid" + if p.Age >= 0 && p.Age <= 150 { + status = "valid" + } + lines = append(lines, fmt.Sprintf("%s %s", p.ID, status)) + } + if err := os.WriteFile("out/result.txt", []byte(strings.Join(lines, "\n")+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h23.go b/experiments/token-efficiency-heldout-v0/solutions/go/h23.go new file mode 100644 index 0000000..174d71a --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h23.go @@ -0,0 +1,31 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" +) + +func main() { + data, err := os.ReadFile("in/ids.json") + if err != nil { + panic(err) + } + var ids []string + if err := json.Unmarshal(data, &ids); err != nil { + panic(err) + } + result := "ok" + seen := map[string]bool{} + for _, id := range ids { + if seen[id] { + result = "duplicate:" + id + break + } + seen[id] = true + } + if err := os.WriteFile("out/result.txt", []byte(result+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h24.go b/experiments/token-efficiency-heldout-v0/solutions/go/h24.go new file mode 100644 index 0000000..7a29f3a --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h24.go @@ -0,0 +1,40 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" +) + +func main() { + data, err := os.ReadFile("in/schema.json") + if err != nil { + panic(err) + } + var schema []string + if err := json.Unmarshal(data, &schema); err != nil { + panic(err) + } + configData, err := os.ReadFile("in/config.json") + if err != nil { + panic(err) + } + var config map[string]any + if err := json.Unmarshal(configData, &config); err != nil { + panic(err) + } + missing := []string{} + for _, key := range schema { + if _, ok := config[key]; !ok { + missing = append(missing, key) + } + } + out, err := json.MarshalIndent(missing, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h25.go b/experiments/token-efficiency-heldout-v0/solutions/go/h25.go new file mode 100644 index 0000000..ac0461d --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h25.go @@ -0,0 +1,36 @@ +//go:build ignore + +package main + +import ( + "fmt" + "os" + "strconv" + "strings" +) + +func main() { + data, err := os.ReadFile("in/seq.txt") + if err != nil { + panic(err) + } + lines := strings.Split(string(data), "\n") + values := make([]int, len(lines)) + for i, line := range lines { + n, err := strconv.Atoi(line) + if err != nil { + panic(err) + } + values[i] = n + } + result := "sorted" + for i := 1; i < len(values); i++ { + if values[i] < values[i-1] { + result = fmt.Sprintf("unsorted at %d", i+1) + break + } + } + if err := os.WriteFile("out/result.txt", []byte(result+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h26.go b/experiments/token-efficiency-heldout-v0/solutions/go/h26.go new file mode 100644 index 0000000..f2fe8a6 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h26.go @@ -0,0 +1,33 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" +) + +func main() { + data, err := os.ReadFile("in/items.json") + if err != nil { + panic(err) + } + var items []struct { + ID string `json:"id"` + Name string `json:"name"` + } + if err := json.Unmarshal(data, &items); err != nil { + panic(err) + } + byID := map[string]string{} + for _, item := range items { + byID[item.ID] = item.Name + } + out, err := json.MarshalIndent(byID, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h27.go b/experiments/token-efficiency-heldout-v0/solutions/go/h27.go new file mode 100644 index 0000000..4b9d1af --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h27.go @@ -0,0 +1,32 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" +) + +func main() { + data, err := os.ReadFile("in/profile.json") + if err != nil { + panic(err) + } + var profile struct { + User struct { + Name string `json:"name"` + Tags []string `json:"tags"` + } `json:"user"` + } + if err := json.Unmarshal(data, &profile); err != nil { + panic(err) + } + result := map[string]any{"name": profile.User.Name, "tag_count": len(profile.User.Tags)} + out, err := json.MarshalIndent(result, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h28.go b/experiments/token-efficiency-heldout-v0/solutions/go/h28.go new file mode 100644 index 0000000..cf82923 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h28.go @@ -0,0 +1,33 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" +) + +func main() { + data, err := os.ReadFile("in/members.json") + if err != nil { + panic(err) + } + var members []struct { + Team string `json:"team"` + Member string `json:"member"` + } + if err := json.Unmarshal(data, &members); err != nil { + panic(err) + } + teams := map[string][]string{} + for _, m := range members { + teams[m.Team] = append(teams[m.Team], m.Member) + } + out, err := json.MarshalIndent(teams, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h29.go b/experiments/token-efficiency-heldout-v0/solutions/go/h29.go new file mode 100644 index 0000000..3962b2a --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h29.go @@ -0,0 +1,30 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" +) + +func main() { + data, err := os.ReadFile("in/records.json") + if err != nil { + panic(err) + } + var records []map[string]any + if err := json.Unmarshal(data, &records); err != nil { + panic(err) + } + slim := []map[string]any{} + for _, r := range records { + slim = append(slim, map[string]any{"id": r["id"], "status": r["status"]}) + } + out, err := json.MarshalIndent(slim, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h30.go b/experiments/token-efficiency-heldout-v0/solutions/go/h30.go new file mode 100644 index 0000000..ada590e --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h30.go @@ -0,0 +1,30 @@ +//go:build ignore + +package main + +import ( + "encoding/json" + "os" +) + +func main() { + data, err := os.ReadFile("in/codes.json") + if err != nil { + panic(err) + } + var codes map[string]string + if err := json.Unmarshal(data, &codes); err != nil { + panic(err) + } + inverted := map[string]string{} + for key, value := range codes { + inverted[value] = key + } + out, err := json.MarshalIndent(inverted, "", " ") + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.json", append(out, '\n'), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h31.go b/experiments/token-efficiency-heldout-v0/solutions/go/h31.go new file mode 100644 index 0000000..8a3ebd2 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h31.go @@ -0,0 +1,29 @@ +//go:build ignore + +package main + +import ( + "fmt" + "io/fs" + "os" + "path/filepath" +) + +func main() { + count := 0 + err := filepath.WalkDir("in/docs", func(path string, d fs.DirEntry, err error) error { + if err != nil { + return err + } + if d.Type().IsRegular() { + count++ + } + return nil + }) + if err != nil { + panic(err) + } + if err := os.WriteFile("out/result.txt", []byte(fmt.Sprintf("%d\n", count)), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/go/h32.go b/experiments/token-efficiency-heldout-v0/solutions/go/h32.go new file mode 100644 index 0000000..092e676 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/go/h32.go @@ -0,0 +1,35 @@ +//go:build ignore + +package main + +import ( + "io/fs" + "os" + "path/filepath" + "sort" + "strings" +) + +func main() { + var paths []string + err := filepath.WalkDir("in/docs", func(path string, d fs.DirEntry, err error) error { + if err != nil { + return err + } + if d.Type().IsRegular() && strings.HasSuffix(path, ".txt") { + rel, err := filepath.Rel("in/docs", path) + if err != nil { + return err + } + paths = append(paths, filepath.ToSlash(rel)) + } + return nil + }) + if err != nil { + panic(err) + } + sort.Strings(paths) + if err := os.WriteFile("out/result.txt", []byte(strings.Join(paths, "\n")+"\n"), 0o644); err != nil { + panic(err) + } +} diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h01.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h01.howl new file mode 100644 index 0000000..c86b148 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h01.howl @@ -0,0 +1,5 @@ +(do + (let (lines (lines (read_file "in/text.txt")) out (list)) + (do + (for l lines (append out (to_upper l))) + (write_file "out/result.txt" (str_join out "\n"))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h02.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h02.howl new file mode 100644 index 0000000..02058f9 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h02.howl @@ -0,0 +1,5 @@ +(do + (let (lines (lines (read_file "in/text.txt")) out (list) i (list_len lines)) + (do + (while (> i 0) (do (dec i) (append out (list_get lines i)))) + (write_file "out/result.txt" (str_join out "\n"))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h03.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h03.howl new file mode 100644 index 0000000..e3a4449 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h03.howl @@ -0,0 +1,5 @@ +(do + (let (lines (lines (read_file "in/text.txt")) out (list) n 0) + (do + (for l lines (do (inc n) (append out (str n ": " l)))) + (write_file "out/result.txt" (str_join out "\n"))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h04.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h04.howl new file mode 100644 index 0000000..a88dfd1 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h04.howl @@ -0,0 +1,5 @@ +(do + (let (lines (lines (read_file "in/text.txt")) out (list)) + (do + (for l lines (let (t (str_trim l)) (unless (blank t) (append out t)))) + (write_file "out/result.txt" (str_join out "\n"))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h05.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h05.howl new file mode 100644 index 0000000..c3a9d50 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h05.howl @@ -0,0 +1,3 @@ +(do + (let (text (read_text "in/text.txt") out (str_replace text "foo" "bar")) + (write_file "out/result.txt" out))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h06.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h06.howl new file mode 100644 index 0000000..ebefe0e --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h06.howl @@ -0,0 +1,7 @@ +(do + (let (lines (lines (read_file "in/data.csv")) header (str_split (list_get lines 0) ",") col 0 i 0 out (list)) + (do + (for h header (do (when (= h "email") (set col i)) (inc i))) + (set i 0) + (for row lines (do (when (> i 0) (append out (list_get (str_split row ",") col))) (inc i))) + (write_file "out/result.txt" (str_join out "\n"))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h07.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h07.howl new file mode 100644 index 0000000..a74e44b --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h07.howl @@ -0,0 +1,10 @@ +(do + (let (lines (lines (read_file "in/data.csv")) header (str_split (list_get lines 0) ",") col 0 i 0 out (list)) + (do + (for h header (do (when (= h "age") (set col i)) (inc i))) + (set i 0) + (for row lines + (do + (if (= i 0) (append out row) (when (>= (to_int (list_get (str_split row ",") col)) 30) (append out row))) + (inc i))) + (write_file "out/result.csv" (str_join out "\n"))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h08.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h08.howl new file mode 100644 index 0000000..b7a41bd --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h08.howl @@ -0,0 +1,8 @@ +(do + (let (lines (lines (read_file "in/data.csv")) header (str_split (list_get lines 0) ",") col 0 i 0 total 0) + (do + (for h header (do (when (= h "amount") (set col i)) (inc i))) + (set i 0) + (for row lines + (do (when (> i 0) (set total (+ total (to_int (list_get (str_split row ",") col))))) (inc i))) + (write_file "out/result.txt" (to_string total))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h09.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h09.howl new file mode 100644 index 0000000..6bef366 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h09.howl @@ -0,0 +1,12 @@ +(do + (let (lines (lines (read_file "in/data.csv")) header (str_split (list_get lines 0) ",") rows (list) i 0) + (do + (for row lines + (do + (when (> i 0) + (let (vals (str_split row ",") rec (dict) j 0) + (do + (for h header (do (map_set rec h (list_get vals j)) (inc j))) + (append rows rec)))) + (inc i))) + (write_file "out/result.json" (encode_json rows))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h10.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h10.howl new file mode 100644 index 0000000..a991378 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h10.howl @@ -0,0 +1,12 @@ +(do + (let (lines (lines (read_file "in/data.csv")) header (str_split (list_get lines 0) ",") col 0 i 0 counts (dict)) + (do + (for h header (do (when (= h "dept") (set col i)) (inc i))) + (set i 0) + (for row lines + (do + (when (> i 0) + (let (d (list_get (str_split row ",") col)) + (map_set counts d (+ (if (map_has counts d) (map_get counts d) 0) 1)))) + (inc i))) + (write_file "out/result.json" (encode_json counts))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h11.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h11.howl new file mode 100644 index 0000000..351b37c --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h11.howl @@ -0,0 +1,11 @@ +(do + (let (lines (lines (read_file "in/numbers.txt")) lo 0 hi 0 sum 0 first 1) + (do + (for l lines + (let (n (to_int l)) + (do + (when (or (= first 1) (< n lo)) (set lo n)) + (when (or (= first 1) (> n hi)) (set hi n)) + (set sum (+ sum n)) + (set first 0)))) + (write_file "out/result.json" (encode_json (dict ("min" lo) ("max" hi) ("sum" sum))))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h12.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h12.howl new file mode 100644 index 0000000..4aaad1f --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h12.howl @@ -0,0 +1,7 @@ +(do + (let (text (read_text "in/words.txt") lines (str_split (to_lower text) "\n") counts (dict)) + (do + (for l lines + (for w (str_split l " ") + (map_set counts w (+ (if (map_has counts w) (map_get counts w) 0) 1)))) + (write_file "out/result.json" (encode_json counts))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h13.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h13.howl new file mode 100644 index 0000000..29f42f3 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h13.howl @@ -0,0 +1,5 @@ +(do + (let (scores (parse_json Any (read_text "in/scores.json")) total 0) + (do + (for s scores (set total (+ total s))) + (write_file "out/result.txt" (to_string (to_int (/ total (list_len scores)))))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h14.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h14.howl new file mode 100644 index 0000000..322ff92 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h14.howl @@ -0,0 +1,5 @@ +(do + (let (lines (lines (read_file "in/app.log")) n 0) + (do + (for l lines (when (str_contains l "ERROR") (inc n))) + (write_file "out/result.txt" (to_string n))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h15.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h15.howl new file mode 100644 index 0000000..0fedb86 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h15.howl @@ -0,0 +1,5 @@ +(do + (let (lines (lines (read_file "in/text.txt")) best (list_get lines 0)) + (do + (for l lines (when (> (list_len l) (list_len best)) (set best l))) + (write_file "out/result.txt" best)))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h16.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h16.howl new file mode 100644 index 0000000..e35a13c --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h16.howl @@ -0,0 +1,9 @@ +(do + (let (lines (lines (read_file "in/config.kv")) config (dict)) + (do + (for l lines + (let (parts (str_split l "=") rest (list) i 0) + (do + (for p parts (do (when (> i 0) (append rest p)) (inc i))) + (map_set config (list_get parts 0) (str_join rest "="))))) + (write_file "out/result.json" (encode_json config))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h17.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h17.howl new file mode 100644 index 0000000..317656f --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h17.howl @@ -0,0 +1,7 @@ +(do + (let (lines (lines (read_file "in/events.log")) counts (dict)) + (do + (for l lines + (let (level (list_get (str_split l "|") 0)) + (map_set counts level (+ (if (map_has counts level) (map_get counts level) 0) 1)))) + (write_file "out/result.json" (encode_json counts))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h18.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h18.howl new file mode 100644 index 0000000..dd5f18b --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h18.howl @@ -0,0 +1,5 @@ +(do + (let (lines (lines (read_file "in/emails.txt")) out (list)) + (do + (for e lines (append out (list_get (str_split e "@") 1))) + (write_file "out/result.txt" (str_join out "\n"))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h19.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h19.howl new file mode 100644 index 0000000..c5c46d2 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h19.howl @@ -0,0 +1,7 @@ +(do + (let (lines (lines (read_file "in/times.txt")) total 0) + (do + (for t lines + (let (hm (str_split t ":")) + (set total (+ total (+ (* (to_int (list_get hm 0)) 60) (to_int (list_get hm 1))))))) + (write_file "out/result.txt" (to_string total))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h20.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h20.howl new file mode 100644 index 0000000..f978be5 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h20.howl @@ -0,0 +1,5 @@ +(do + (let (tags (str_split (read_text "in/tags.txt") ";") out (list)) + (do + (for t tags (unless (list_contains out t) (append out t))) + (write_file "out/result.json" (encode_json out))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h21.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h21.howl new file mode 100644 index 0000000..07a8323 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h21.howl @@ -0,0 +1,5 @@ +(do + (let (users (parse_json Any (read_text "in/users.json")) out (list)) + (do + (for u users (unless (map_has u "email") (append out (map_get u "id")))) + (write_file "out/result.json" (encode_json out))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h22.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h22.howl new file mode 100644 index 0000000..6899f2d --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h22.howl @@ -0,0 +1,7 @@ +(do + (let (people (parse_json Any (read_text "in/people.json")) out (list)) + (do + (for p people + (let (age (map_get p "age")) + (append out (str (map_get p "id") " " (if (and (>= age 0) (<= age 150)) "valid" "invalid"))))) + (write_file "out/result.txt" (str_join out "\n"))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h23.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h23.howl new file mode 100644 index 0000000..2d99c9a --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h23.howl @@ -0,0 +1,7 @@ +(do + (let (ids (parse_json Any (read_text "in/ids.json")) seen (list) result "ok") + (do + (for id ids + (when (= result "ok") + (if (list_contains seen id) (set result (str "duplicate:" id)) (append seen id)))) + (write_file "out/result.txt" result)))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h24.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h24.howl new file mode 100644 index 0000000..51f4e2f --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h24.howl @@ -0,0 +1,7 @@ +(do + (let (schema (parse_json Any (read_text "in/schema.json")) + config (parse_json Any (read_text "in/config.json")) + out (list)) + (do + (for k schema (unless (map_has config k) (append out k))) + (write_file "out/result.json" (encode_json out))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h25.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h25.howl new file mode 100644 index 0000000..7a3923b --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h25.howl @@ -0,0 +1,10 @@ +(do + (let (lines (lines (read_file "in/seq.txt")) prev 0 i 0 result "sorted") + (do + (for l lines + (let (n (to_int l)) + (do + (inc i) + (when (and (> i 1) (< n prev) (= result "sorted")) (set result (str "unsorted at " i))) + (set prev n)))) + (write_file "out/result.txt" result)))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h26.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h26.howl new file mode 100644 index 0000000..a465aaf --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h26.howl @@ -0,0 +1,5 @@ +(do + (let (items (parse_json Any (read_text "in/items.json")) out (dict)) + (do + (for it items (map_set out (map_get it "id") (map_get it "name"))) + (write_file "out/result.json" (encode_json out))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h27.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h27.howl new file mode 100644 index 0000000..feb7b34 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h27.howl @@ -0,0 +1,3 @@ +(do + (let (profile (parse_json Any (read_text "in/profile.json")) user (map_get profile "user") tags (map_get user "tags")) + (write_file "out/result.json" (encode_json (dict ("name" (map_get user "name")) ("tag_count" (list_len tags))))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h28.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h28.howl new file mode 100644 index 0000000..7eb9c25 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h28.howl @@ -0,0 +1,7 @@ +(do + (let (members (parse_json Any (read_text "in/members.json")) teams (dict)) + (do + (for m members + (let (team (map_get m "team") group (if (map_has teams team) (map_get teams team) (list))) + (do (append group (map_get m "member")) (map_set teams team group)))) + (write_file "out/result.json" (encode_json teams))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h29.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h29.howl new file mode 100644 index 0000000..6f2324f --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h29.howl @@ -0,0 +1,5 @@ +(do + (let (records (parse_json Any (read_text "in/records.json")) out (list)) + (do + (for r records (append out (dict ("id" (map_get r "id")) ("status" (map_get r "status"))))) + (write_file "out/result.json" (encode_json out))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/howl/h30.howl b/experiments/token-efficiency-heldout-v0/solutions/howl/h30.howl new file mode 100644 index 0000000..c5ce6eb --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/howl/h30.howl @@ -0,0 +1,5 @@ +(do + (let (codes (parse_json Any (read_text "in/codes.json")) out (dict)) + (do + (for k (map_keys codes) (map_set out (map_get codes k) k)) + (write_file "out/result.json" (encode_json out))))) diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h01.js b/experiments/token-efficiency-heldout-v0/solutions/js/h01.js new file mode 100644 index 0000000..1a3d67f --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h01.js @@ -0,0 +1,4 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/text.txt", "utf8").split("\n"); +fs.writeFileSync("out/result.txt", lines.map((line) => line.toUpperCase()).join("\n") + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h02.js b/experiments/token-efficiency-heldout-v0/solutions/js/h02.js new file mode 100644 index 0000000..5cf469b --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h02.js @@ -0,0 +1,4 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/text.txt", "utf8").split("\n"); +fs.writeFileSync("out/result.txt", lines.reverse().join("\n") + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h03.js b/experiments/token-efficiency-heldout-v0/solutions/js/h03.js new file mode 100644 index 0000000..4149858 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h03.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/text.txt", "utf8").split("\n"); +const numbered = lines.map((line, i) => `${i + 1}: ${line}`); +fs.writeFileSync("out/result.txt", numbered.join("\n") + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h04.js b/experiments/token-efficiency-heldout-v0/solutions/js/h04.js new file mode 100644 index 0000000..7863b8b --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h04.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/text.txt", "utf8").split("\n"); +const kept = lines.map((line) => line.trim()).filter((line) => line !== ""); +fs.writeFileSync("out/result.txt", kept.join("\n") + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h05.js b/experiments/token-efficiency-heldout-v0/solutions/js/h05.js new file mode 100644 index 0000000..75970e8 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h05.js @@ -0,0 +1,4 @@ +const fs = require("fs"); + +const text = fs.readFileSync("in/text.txt", "utf8"); +fs.writeFileSync("out/result.txt", text.replaceAll("foo", "bar") + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h06.js b/experiments/token-efficiency-heldout-v0/solutions/js/h06.js new file mode 100644 index 0000000..ce764c2 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h06.js @@ -0,0 +1,6 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/data.csv", "utf8").split("\n"); +const col = lines[0].split(",").indexOf("email"); +const emails = lines.slice(1).map((row) => row.split(",")[col]); +fs.writeFileSync("out/result.txt", emails.join("\n") + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h07.js b/experiments/token-efficiency-heldout-v0/solutions/js/h07.js new file mode 100644 index 0000000..a4fce3a --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h07.js @@ -0,0 +1,6 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/data.csv", "utf8").split("\n"); +const col = lines[0].split(",").indexOf("age"); +const kept = lines.slice(1).filter((row) => parseInt(row.split(",")[col], 10) >= 30); +fs.writeFileSync("out/result.csv", [lines[0], ...kept].join("\n") + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h08.js b/experiments/token-efficiency-heldout-v0/solutions/js/h08.js new file mode 100644 index 0000000..dd96f42 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h08.js @@ -0,0 +1,6 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/data.csv", "utf8").split("\n"); +const col = lines[0].split(",").indexOf("amount"); +const total = lines.slice(1).reduce((sum, row) => sum + parseInt(row.split(",")[col], 10), 0); +fs.writeFileSync("out/result.txt", `${total}\n`); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h09.js b/experiments/token-efficiency-heldout-v0/solutions/js/h09.js new file mode 100644 index 0000000..fb68954 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h09.js @@ -0,0 +1,9 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/data.csv", "utf8").split("\n"); +const header = lines[0].split(","); +const rows = lines.slice(1).map((row) => { + const values = row.split(","); + return Object.fromEntries(header.map((name, i) => [name, values[i]])); +}); +fs.writeFileSync("out/result.json", JSON.stringify(rows, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h10.js b/experiments/token-efficiency-heldout-v0/solutions/js/h10.js new file mode 100644 index 0000000..e11722f --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h10.js @@ -0,0 +1,10 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/data.csv", "utf8").split("\n"); +const col = lines[0].split(",").indexOf("dept"); +const counts = {}; +for (const row of lines.slice(1)) { + const dept = row.split(",")[col]; + counts[dept] = (counts[dept] || 0) + 1; +} +fs.writeFileSync("out/result.json", JSON.stringify(counts, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h11.js b/experiments/token-efficiency-heldout-v0/solutions/js/h11.js new file mode 100644 index 0000000..f0dcf8b --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h11.js @@ -0,0 +1,9 @@ +const fs = require("fs"); + +const numbers = fs.readFileSync("in/numbers.txt", "utf8").split("\n").map((line) => parseInt(line, 10)); +const result = { + min: Math.min(...numbers), + max: Math.max(...numbers), + sum: numbers.reduce((a, b) => a + b, 0), +}; +fs.writeFileSync("out/result.json", JSON.stringify(result, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h12.js b/experiments/token-efficiency-heldout-v0/solutions/js/h12.js new file mode 100644 index 0000000..7051485 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h12.js @@ -0,0 +1,10 @@ +const fs = require("fs"); + +const text = fs.readFileSync("in/words.txt", "utf8").toLowerCase(); +const counts = {}; +for (const line of text.split("\n")) { + for (const word of line.split(" ")) { + counts[word] = (counts[word] || 0) + 1; + } +} +fs.writeFileSync("out/result.json", JSON.stringify(counts, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h13.js b/experiments/token-efficiency-heldout-v0/solutions/js/h13.js new file mode 100644 index 0000000..2c89544 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h13.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const scores = JSON.parse(fs.readFileSync("in/scores.json", "utf8")); +const total = scores.reduce((a, b) => a + b, 0); +fs.writeFileSync("out/result.txt", `${Math.floor(total / scores.length)}\n`); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h14.js b/experiments/token-efficiency-heldout-v0/solutions/js/h14.js new file mode 100644 index 0000000..ebbd651 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h14.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/app.log", "utf8").split("\n"); +const count = lines.filter((line) => line.includes("ERROR")).length; +fs.writeFileSync("out/result.txt", `${count}\n`); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h15.js b/experiments/token-efficiency-heldout-v0/solutions/js/h15.js new file mode 100644 index 0000000..3337da1 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h15.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/text.txt", "utf8").split("\n"); +const longest = lines.reduce((best, line) => (line.length > best.length ? line : best)); +fs.writeFileSync("out/result.txt", longest + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h16.js b/experiments/token-efficiency-heldout-v0/solutions/js/h16.js new file mode 100644 index 0000000..05dbacd --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h16.js @@ -0,0 +1,9 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/config.kv", "utf8").split("\n"); +const config = {}; +for (const line of lines) { + const i = line.indexOf("="); + config[line.slice(0, i)] = line.slice(i + 1); +} +fs.writeFileSync("out/result.json", JSON.stringify(config, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h17.js b/experiments/token-efficiency-heldout-v0/solutions/js/h17.js new file mode 100644 index 0000000..543557b --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h17.js @@ -0,0 +1,9 @@ +const fs = require("fs"); + +const lines = fs.readFileSync("in/events.log", "utf8").split("\n"); +const counts = {}; +for (const line of lines) { + const level = line.split("|")[0]; + counts[level] = (counts[level] || 0) + 1; +} +fs.writeFileSync("out/result.json", JSON.stringify(counts, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h18.js b/experiments/token-efficiency-heldout-v0/solutions/js/h18.js new file mode 100644 index 0000000..af8b3c8 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h18.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const emails = fs.readFileSync("in/emails.txt", "utf8").split("\n"); +const domains = emails.map((email) => email.split("@")[1]); +fs.writeFileSync("out/result.txt", domains.join("\n") + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h19.js b/experiments/token-efficiency-heldout-v0/solutions/js/h19.js new file mode 100644 index 0000000..a95f973 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h19.js @@ -0,0 +1,8 @@ +const fs = require("fs"); + +let total = 0; +for (const line of fs.readFileSync("in/times.txt", "utf8").split("\n")) { + const [hours, minutes] = line.split(":").map((part) => parseInt(part, 10)); + total += hours * 60 + minutes; +} +fs.writeFileSync("out/result.txt", `${total}\n`); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h20.js b/experiments/token-efficiency-heldout-v0/solutions/js/h20.js new file mode 100644 index 0000000..f4cfba2 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h20.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const tags = fs.readFileSync("in/tags.txt", "utf8").split(";"); +const unique = [...new Set(tags)]; +fs.writeFileSync("out/result.json", JSON.stringify(unique, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h21.js b/experiments/token-efficiency-heldout-v0/solutions/js/h21.js new file mode 100644 index 0000000..7361506 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h21.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const users = JSON.parse(fs.readFileSync("in/users.json", "utf8")); +const missing = users.filter((user) => !("email" in user)).map((user) => user.id); +fs.writeFileSync("out/result.json", JSON.stringify(missing, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h22.js b/experiments/token-efficiency-heldout-v0/solutions/js/h22.js new file mode 100644 index 0000000..da66c2f --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h22.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const people = JSON.parse(fs.readFileSync("in/people.json", "utf8")); +const lines = people.map((p) => `${p.id} ${p.age >= 0 && p.age <= 150 ? "valid" : "invalid"}`); +fs.writeFileSync("out/result.txt", lines.join("\n") + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h23.js b/experiments/token-efficiency-heldout-v0/solutions/js/h23.js new file mode 100644 index 0000000..8cb80c0 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h23.js @@ -0,0 +1,13 @@ +const fs = require("fs"); + +const ids = JSON.parse(fs.readFileSync("in/ids.json", "utf8")); +let result = "ok"; +const seen = new Set(); +for (const id of ids) { + if (seen.has(id)) { + result = `duplicate:${id}`; + break; + } + seen.add(id); +} +fs.writeFileSync("out/result.txt", result + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h24.js b/experiments/token-efficiency-heldout-v0/solutions/js/h24.js new file mode 100644 index 0000000..96e012f --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h24.js @@ -0,0 +1,6 @@ +const fs = require("fs"); + +const schema = JSON.parse(fs.readFileSync("in/schema.json", "utf8")); +const config = JSON.parse(fs.readFileSync("in/config.json", "utf8")); +const missing = schema.filter((key) => !(key in config)); +fs.writeFileSync("out/result.json", JSON.stringify(missing, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h25.js b/experiments/token-efficiency-heldout-v0/solutions/js/h25.js new file mode 100644 index 0000000..2ba849e --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h25.js @@ -0,0 +1,11 @@ +const fs = require("fs"); + +const values = fs.readFileSync("in/seq.txt", "utf8").split("\n").map((line) => parseInt(line, 10)); +let result = "sorted"; +for (let i = 1; i < values.length; i++) { + if (values[i] < values[i - 1]) { + result = `unsorted at ${i + 1}`; + break; + } +} +fs.writeFileSync("out/result.txt", result + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h26.js b/experiments/token-efficiency-heldout-v0/solutions/js/h26.js new file mode 100644 index 0000000..494e10e --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h26.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const items = JSON.parse(fs.readFileSync("in/items.json", "utf8")); +const byId = Object.fromEntries(items.map((item) => [item.id, item.name])); +fs.writeFileSync("out/result.json", JSON.stringify(byId, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h27.js b/experiments/token-efficiency-heldout-v0/solutions/js/h27.js new file mode 100644 index 0000000..3441499 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h27.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const { user } = JSON.parse(fs.readFileSync("in/profile.json", "utf8")); +const result = { name: user.name, tag_count: user.tags.length }; +fs.writeFileSync("out/result.json", JSON.stringify(result, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h28.js b/experiments/token-efficiency-heldout-v0/solutions/js/h28.js new file mode 100644 index 0000000..245f975 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h28.js @@ -0,0 +1,8 @@ +const fs = require("fs"); + +const members = JSON.parse(fs.readFileSync("in/members.json", "utf8")); +const teams = {}; +for (const m of members) { + (teams[m.team] ||= []).push(m.member); +} +fs.writeFileSync("out/result.json", JSON.stringify(teams, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h29.js b/experiments/token-efficiency-heldout-v0/solutions/js/h29.js new file mode 100644 index 0000000..6174310 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h29.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const records = JSON.parse(fs.readFileSync("in/records.json", "utf8")); +const slim = records.map((r) => ({ id: r.id, status: r.status })); +fs.writeFileSync("out/result.json", JSON.stringify(slim, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h30.js b/experiments/token-efficiency-heldout-v0/solutions/js/h30.js new file mode 100644 index 0000000..18a27e5 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h30.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const codes = JSON.parse(fs.readFileSync("in/codes.json", "utf8")); +const inverted = Object.fromEntries(Object.entries(codes).map(([key, value]) => [value, key])); +fs.writeFileSync("out/result.json", JSON.stringify(inverted, null, 2) + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h31.js b/experiments/token-efficiency-heldout-v0/solutions/js/h31.js new file mode 100644 index 0000000..9b00340 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h31.js @@ -0,0 +1,5 @@ +const fs = require("fs"); + +const entries = fs.readdirSync("in/docs", { recursive: true, withFileTypes: true }); +const count = entries.filter((entry) => entry.isFile()).length; +fs.writeFileSync("out/result.txt", `${count}\n`); diff --git a/experiments/token-efficiency-heldout-v0/solutions/js/h32.js b/experiments/token-efficiency-heldout-v0/solutions/js/h32.js new file mode 100644 index 0000000..62f6e1a --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/js/h32.js @@ -0,0 +1,9 @@ +const fs = require("fs"); +const path = require("path"); + +const entries = fs.readdirSync("in/docs", { recursive: true, withFileTypes: true }); +const paths = entries + .filter((entry) => entry.isFile() && entry.name.endsWith(".txt")) + .map((entry) => path.relative("in/docs", path.join(entry.parentPath ?? entry.path, entry.name)).split(path.sep).join("/")) + .sort(); +fs.writeFileSync("out/result.txt", paths.join("\n") + "\n"); diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h01.py b/experiments/token-efficiency-heldout-v0/solutions/python/h01.py new file mode 100644 index 0000000..9dc1c00 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h01.py @@ -0,0 +1,4 @@ +from pathlib import Path + +lines = Path("in/text.txt").read_text().split("\n") +Path("out/result.txt").write_text("\n".join(line.upper() for line in lines) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h02.py b/experiments/token-efficiency-heldout-v0/solutions/python/h02.py new file mode 100644 index 0000000..f4a5e69 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h02.py @@ -0,0 +1,4 @@ +from pathlib import Path + +lines = Path("in/text.txt").read_text().split("\n") +Path("out/result.txt").write_text("\n".join(reversed(lines)) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h03.py b/experiments/token-efficiency-heldout-v0/solutions/python/h03.py new file mode 100644 index 0000000..93ed2e1 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h03.py @@ -0,0 +1,5 @@ +from pathlib import Path + +lines = Path("in/text.txt").read_text().split("\n") +numbered = [f"{i}: {line}" for i, line in enumerate(lines, start=1)] +Path("out/result.txt").write_text("\n".join(numbered) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h04.py b/experiments/token-efficiency-heldout-v0/solutions/python/h04.py new file mode 100644 index 0000000..e473766 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h04.py @@ -0,0 +1,5 @@ +from pathlib import Path + +lines = Path("in/text.txt").read_text().split("\n") +kept = [line.strip() for line in lines if line.strip()] +Path("out/result.txt").write_text("\n".join(kept) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h05.py b/experiments/token-efficiency-heldout-v0/solutions/python/h05.py new file mode 100644 index 0000000..484fbe2 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h05.py @@ -0,0 +1,4 @@ +from pathlib import Path + +text = Path("in/text.txt").read_text() +Path("out/result.txt").write_text(text.replace("foo", "bar") + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h06.py b/experiments/token-efficiency-heldout-v0/solutions/python/h06.py new file mode 100644 index 0000000..f4b246a --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h06.py @@ -0,0 +1,7 @@ +from pathlib import Path + +lines = Path("in/data.csv").read_text().split("\n") +header = lines[0].split(",") +col = header.index("email") +emails = [row.split(",")[col] for row in lines[1:]] +Path("out/result.txt").write_text("\n".join(emails) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h07.py b/experiments/token-efficiency-heldout-v0/solutions/python/h07.py new file mode 100644 index 0000000..5a8b253 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h07.py @@ -0,0 +1,7 @@ +from pathlib import Path + +lines = Path("in/data.csv").read_text().split("\n") +header = lines[0].split(",") +col = header.index("age") +kept = [row for row in lines[1:] if int(row.split(",")[col]) >= 30] +Path("out/result.csv").write_text("\n".join([lines[0]] + kept) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h08.py b/experiments/token-efficiency-heldout-v0/solutions/python/h08.py new file mode 100644 index 0000000..d6f8a58 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h08.py @@ -0,0 +1,6 @@ +from pathlib import Path + +lines = Path("in/data.csv").read_text().split("\n") +col = lines[0].split(",").index("amount") +total = sum(int(row.split(",")[col]) for row in lines[1:]) +Path("out/result.txt").write_text(f"{total}\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h09.py b/experiments/token-efficiency-heldout-v0/solutions/python/h09.py new file mode 100644 index 0000000..8bd60b2 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h09.py @@ -0,0 +1,7 @@ +import json +from pathlib import Path + +lines = Path("in/data.csv").read_text().split("\n") +header = lines[0].split(",") +rows = [dict(zip(header, row.split(","))) for row in lines[1:]] +Path("out/result.json").write_text(json.dumps(rows, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h10.py b/experiments/token-efficiency-heldout-v0/solutions/python/h10.py new file mode 100644 index 0000000..288f0e3 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h10.py @@ -0,0 +1,8 @@ +import json +from collections import Counter +from pathlib import Path + +lines = Path("in/data.csv").read_text().split("\n") +col = lines[0].split(",").index("dept") +counts = Counter(row.split(",")[col] for row in lines[1:]) +Path("out/result.json").write_text(json.dumps(counts, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h11.py b/experiments/token-efficiency-heldout-v0/solutions/python/h11.py new file mode 100644 index 0000000..8dd5f08 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h11.py @@ -0,0 +1,6 @@ +import json +from pathlib import Path + +numbers = [int(line) for line in Path("in/numbers.txt").read_text().split("\n")] +result = {"min": min(numbers), "max": max(numbers), "sum": sum(numbers)} +Path("out/result.json").write_text(json.dumps(result, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h12.py b/experiments/token-efficiency-heldout-v0/solutions/python/h12.py new file mode 100644 index 0000000..1f6ff2e --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h12.py @@ -0,0 +1,7 @@ +import json +from collections import Counter +from pathlib import Path + +text = Path("in/words.txt").read_text().lower() +counts = Counter(word for line in text.split("\n") for word in line.split(" ")) +Path("out/result.json").write_text(json.dumps(counts, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h13.py b/experiments/token-efficiency-heldout-v0/solutions/python/h13.py new file mode 100644 index 0000000..8d1d8dc --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h13.py @@ -0,0 +1,5 @@ +import json +from pathlib import Path + +scores = json.loads(Path("in/scores.json").read_text()) +Path("out/result.txt").write_text(f"{sum(scores) // len(scores)}\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h14.py b/experiments/token-efficiency-heldout-v0/solutions/python/h14.py new file mode 100644 index 0000000..10e4e17 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h14.py @@ -0,0 +1,5 @@ +from pathlib import Path + +lines = Path("in/app.log").read_text().split("\n") +count = sum(1 for line in lines if "ERROR" in line) +Path("out/result.txt").write_text(f"{count}\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h15.py b/experiments/token-efficiency-heldout-v0/solutions/python/h15.py new file mode 100644 index 0000000..0795912 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h15.py @@ -0,0 +1,4 @@ +from pathlib import Path + +lines = Path("in/text.txt").read_text().split("\n") +Path("out/result.txt").write_text(max(lines, key=len) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h16.py b/experiments/token-efficiency-heldout-v0/solutions/python/h16.py new file mode 100644 index 0000000..f77d58f --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h16.py @@ -0,0 +1,6 @@ +import json +from pathlib import Path + +lines = Path("in/config.kv").read_text().split("\n") +config = dict(line.split("=", 1) for line in lines) +Path("out/result.json").write_text(json.dumps(config, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h17.py b/experiments/token-efficiency-heldout-v0/solutions/python/h17.py new file mode 100644 index 0000000..ecacea0 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h17.py @@ -0,0 +1,7 @@ +import json +from collections import Counter +from pathlib import Path + +lines = Path("in/events.log").read_text().split("\n") +counts = Counter(line.split("|")[0] for line in lines) +Path("out/result.json").write_text(json.dumps(counts, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h18.py b/experiments/token-efficiency-heldout-v0/solutions/python/h18.py new file mode 100644 index 0000000..2d55a68 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h18.py @@ -0,0 +1,5 @@ +from pathlib import Path + +emails = Path("in/emails.txt").read_text().split("\n") +domains = [email.split("@")[1] for email in emails] +Path("out/result.txt").write_text("\n".join(domains) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h19.py b/experiments/token-efficiency-heldout-v0/solutions/python/h19.py new file mode 100644 index 0000000..82a7cf9 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h19.py @@ -0,0 +1,7 @@ +from pathlib import Path + +total = 0 +for line in Path("in/times.txt").read_text().split("\n"): + hours, minutes = line.split(":") + total += int(hours) * 60 + int(minutes) +Path("out/result.txt").write_text(f"{total}\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h20.py b/experiments/token-efficiency-heldout-v0/solutions/python/h20.py new file mode 100644 index 0000000..e9f6023 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h20.py @@ -0,0 +1,6 @@ +import json +from pathlib import Path + +tags = Path("in/tags.txt").read_text().split(";") +unique = list(dict.fromkeys(tags)) +Path("out/result.json").write_text(json.dumps(unique, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h21.py b/experiments/token-efficiency-heldout-v0/solutions/python/h21.py new file mode 100644 index 0000000..d52d804 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h21.py @@ -0,0 +1,6 @@ +import json +from pathlib import Path + +users = json.loads(Path("in/users.json").read_text()) +missing = [user["id"] for user in users if "email" not in user] +Path("out/result.json").write_text(json.dumps(missing, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h22.py b/experiments/token-efficiency-heldout-v0/solutions/python/h22.py new file mode 100644 index 0000000..c2bb29a --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h22.py @@ -0,0 +1,6 @@ +import json +from pathlib import Path + +people = json.loads(Path("in/people.json").read_text()) +lines = [f"{p['id']} {'valid' if 0 <= p['age'] <= 150 else 'invalid'}" for p in people] +Path("out/result.txt").write_text("\n".join(lines) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h23.py b/experiments/token-efficiency-heldout-v0/solutions/python/h23.py new file mode 100644 index 0000000..22aaadd --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h23.py @@ -0,0 +1,12 @@ +import json +from pathlib import Path + +ids = json.loads(Path("in/ids.json").read_text()) +result = "ok" +seen = set() +for item in ids: + if item in seen: + result = f"duplicate:{item}" + break + seen.add(item) +Path("out/result.txt").write_text(result + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h24.py b/experiments/token-efficiency-heldout-v0/solutions/python/h24.py new file mode 100644 index 0000000..6ec7064 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h24.py @@ -0,0 +1,7 @@ +import json +from pathlib import Path + +schema = json.loads(Path("in/schema.json").read_text()) +config = json.loads(Path("in/config.json").read_text()) +missing = [key for key in schema if key not in config] +Path("out/result.json").write_text(json.dumps(missing, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h25.py b/experiments/token-efficiency-heldout-v0/solutions/python/h25.py new file mode 100644 index 0000000..9c4ebda --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h25.py @@ -0,0 +1,9 @@ +from pathlib import Path + +values = [int(line) for line in Path("in/seq.txt").read_text().split("\n")] +result = "sorted" +for i in range(1, len(values)): + if values[i] < values[i - 1]: + result = f"unsorted at {i + 1}" + break +Path("out/result.txt").write_text(result + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h26.py b/experiments/token-efficiency-heldout-v0/solutions/python/h26.py new file mode 100644 index 0000000..cb22b33 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h26.py @@ -0,0 +1,6 @@ +import json +from pathlib import Path + +items = json.loads(Path("in/items.json").read_text()) +by_id = {item["id"]: item["name"] for item in items} +Path("out/result.json").write_text(json.dumps(by_id, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h27.py b/experiments/token-efficiency-heldout-v0/solutions/python/h27.py new file mode 100644 index 0000000..7bda077 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h27.py @@ -0,0 +1,6 @@ +import json +from pathlib import Path + +user = json.loads(Path("in/profile.json").read_text())["user"] +result = {"name": user["name"], "tag_count": len(user["tags"])} +Path("out/result.json").write_text(json.dumps(result, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h28.py b/experiments/token-efficiency-heldout-v0/solutions/python/h28.py new file mode 100644 index 0000000..2c5c793 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h28.py @@ -0,0 +1,8 @@ +import json +from pathlib import Path + +members = json.loads(Path("in/members.json").read_text()) +teams = {} +for m in members: + teams.setdefault(m["team"], []).append(m["member"]) +Path("out/result.json").write_text(json.dumps(teams, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h29.py b/experiments/token-efficiency-heldout-v0/solutions/python/h29.py new file mode 100644 index 0000000..09dfbed --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h29.py @@ -0,0 +1,6 @@ +import json +from pathlib import Path + +records = json.loads(Path("in/records.json").read_text()) +slim = [{"id": r["id"], "status": r["status"]} for r in records] +Path("out/result.json").write_text(json.dumps(slim, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h30.py b/experiments/token-efficiency-heldout-v0/solutions/python/h30.py new file mode 100644 index 0000000..e4632c5 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h30.py @@ -0,0 +1,6 @@ +import json +from pathlib import Path + +codes = json.loads(Path("in/codes.json").read_text()) +inverted = {value: key for key, value in codes.items()} +Path("out/result.json").write_text(json.dumps(inverted, indent=2) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h31.py b/experiments/token-efficiency-heldout-v0/solutions/python/h31.py new file mode 100644 index 0000000..a6bbbe8 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h31.py @@ -0,0 +1,4 @@ +from pathlib import Path + +count = sum(1 for path in Path("in/docs").rglob("*") if path.is_file()) +Path("out/result.txt").write_text(f"{count}\n") diff --git a/experiments/token-efficiency-heldout-v0/solutions/python/h32.py b/experiments/token-efficiency-heldout-v0/solutions/python/h32.py new file mode 100644 index 0000000..c677d03 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/solutions/python/h32.py @@ -0,0 +1,5 @@ +from pathlib import Path + +root = Path("in/docs") +paths = sorted(p.relative_to(root).as_posix() for p in root.rglob("*.txt") if p.is_file()) +Path("out/result.txt").write_text("\n".join(paths) + "\n") diff --git a/experiments/token-efficiency-heldout-v0/tasks/README.md b/experiments/token-efficiency-heldout-v0/tasks/README.md new file mode 100644 index 0000000..4e269aa --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/tasks/README.md @@ -0,0 +1,32 @@ +# Held-out token-efficiency tasks (heldout-v0): frozen specs + +This file and the others in `tasks/` (`manifest.json`, `build_specs.py`) are +**frozen**. They were committed before any reference solution was written or +anything was measured. + +## Corpus + +There are 32 tasks in 7 categories. None of them is one of the three +falsifiable-v0 release workflows. + +| Category | Tasks | +|---|---| +| text | h01–h05 | +| csv | h06–h10 | +| aggregate | h11–h15 | +| parse | h16–h20 | +| validate | h21–h25 | +| reshape | h26–h30 | +| walk | h31–h32 | + +## Running a reference + +- Each reference runs with its working directory set to a fresh sandbox + containing only the task's `inputs`. +- It may read under `in/` and must write exactly the one `output` path. +- `text` outputs are compared exactly, after trailing newlines are removed + from both sides. `json` outputs are compared as decoded values. +- `expected` values come from the spec-time oracle in `build_specs.py`, which + is part of this freeze. The oracle is not a counted or verified reference. +- A task that a language cannot express with features on main at freeze time + is recorded as a gap, not solved by adding features. diff --git a/experiments/token-efficiency-heldout-v0/tasks/build_specs.py b/experiments/token-efficiency-heldout-v0/tasks/build_specs.py new file mode 100644 index 0000000..0312f72 --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/tasks/build_specs.py @@ -0,0 +1,138 @@ +"""Held-out task specs (frozen before any reference solution is written). + +Each task lists input files, one output path, an output kind and the expected +output. Expected outputs are computed here by a spec-time oracle from the task +text; this file is part of the frozen spec commit and is not a reference +solution (it is never counted or verified as one). + +Output comparison (verifier contract): + text: exact match after removing trailing newlines from both sides. + json: decoded-value equality. +""" +import json, re +from collections import Counter, OrderedDict +from pathlib import Path + +T = [] +def task(id, cat, desc, inputs, out, kind, expect): + T.append({"id": id, "category": cat, "description": desc, "inputs": inputs, + "output": out, "kind": kind, + "expected": expect if kind == "text" else expect}) + +def lines(s): return s.split("\n") + +# ---- text transforms ---- +txt = "alpha beta\nGamma delta\n\nfoo bar foo\n padded line \nlast" +task("h01", "text", "Read in/text.txt. Write out/result.txt with every line upper-cased, same line order.", + {"in/text.txt": txt}, "out/result.txt", "text", "\n".join(l.upper() for l in lines(txt))) +task("h02", "text", "Read in/text.txt. Write out/result.txt with the lines in reverse order.", + {"in/text.txt": txt}, "out/result.txt", "text", "\n".join(reversed(lines(txt)))) +task("h03", "text", "Read in/text.txt. Write out/result.txt where each line is prefixed with its 1-based line number and \": \" (e.g. \"1: alpha beta\").", + {"in/text.txt": txt}, "out/result.txt", "text", "\n".join(f"{i+1}: {l}" for i, l in enumerate(lines(txt)))) +task("h04", "text", "Read in/text.txt. Trim leading/trailing spaces of every line, drop lines that are then empty, and write the rest to out/result.txt.", + {"in/text.txt": txt}, "out/result.txt", "text", "\n".join(l.strip() for l in lines(txt) if l.strip())) +task("h05", "text", "Read in/text.txt. Replace every occurrence of the substring \"foo\" with \"bar\" and write the result to out/result.txt.", + {"in/text.txt": txt}, "out/result.txt", "text", txt.replace("foo", "bar")) + +# ---- CSV ---- +csv = "name,email,age,dept,amount\nAda,ada@example.com,36,eng,120\nBob,bob@test.org,25,ops,75\nCy,cy@example.com,30,eng,40\nDee,dee@corp.net,41,sales,300\nEd,ed@test.org,29,ops,15" +rows = [dict(zip(lines(csv)[0].split(","), r.split(","))) for r in lines(csv)[1:]] +task("h06", "csv", "Read in/data.csv (header row, comma-separated, no quoting). Write the email column values, one per line in row order, to out/result.txt.", + {"in/data.csv": csv}, "out/result.txt", "text", "\n".join(r["email"] for r in rows)) +task("h07", "csv", "Read in/data.csv. Write out/result.csv containing the header row followed by only the rows whose integer age is >= 30, in input order.", + {"in/data.csv": csv}, "out/result.csv", "text", "\n".join([lines(csv)[0]] + [l for l, r in zip(lines(csv)[1:], rows) if int(r["age"]) >= 30])) +task("h08", "csv", "Read in/data.csv. Write the integer sum of the amount column to out/result.txt.", + {"in/data.csv": csv}, "out/result.txt", "text", str(sum(int(r["amount"]) for r in rows))) +task("h09", "csv", "Read in/data.csv. Write out/result.json: a JSON array with one object per row mapping each header name to the row's string value.", + {"in/data.csv": csv}, "out/result.json", "json", rows) +task("h10", "csv", "Read in/data.csv. Write out/result.json: a JSON object mapping each dept value to the integer number of rows with that dept.", + {"in/data.csv": csv}, "out/result.json", "json", dict(Counter(r["dept"] for r in rows))) + +# ---- aggregation ---- +nums = "12\n-4\n7\n30\n0\n9" +ns = [int(x) for x in lines(nums)] +task("h11", "aggregate", "Read in/numbers.txt (one integer per line). Write out/result.json: {\"min\": m, \"max\": M, \"sum\": s} as integers.", + {"in/numbers.txt": nums}, "out/result.json", "json", {"min": min(ns), "max": max(ns), "sum": sum(ns)}) +words = "the cat and the hat\nThe bat and THE cat" +task("h12", "aggregate", "Read in/words.txt. Lower-case it, split every line on single spaces, and write out/result.json mapping each word to its integer count.", + {"in/words.txt": words}, "out/result.json", "json", dict(Counter(w for l in lines(words.lower()) for w in l.split(" ")))) +scores = [88, 92, 79, 65, 100, 71] +task("h13", "aggregate", "Read in/scores.json (a JSON array of integers). Write out/result.txt containing the integer mean rounded down (floor).", + {"in/scores.json": json.dumps(scores)}, "out/result.txt", "text", str(sum(scores) // len(scores))) +log = "INFO start\nERROR disk full\nWARN slow\nERROR timeout\ninfo ERROR-free\nDEBUG x" +task("h14", "aggregate", "Read in/app.log. Write out/result.txt containing the integer number of lines that contain the substring \"ERROR\" (case-sensitive).", + {"in/app.log": log}, "out/result.txt", "text", str(sum("ERROR" in l for l in lines(log)))) +task("h15", "aggregate", "Read in/text.txt. Write the longest line (by character count; the first one on ties) to out/result.txt.", + {"in/text.txt": txt}, "out/result.txt", "text", max(lines(txt), key=len)) + +# ---- string parsing ---- +kv = "host=db.local\nport=5432\nuser=admin\nmode=read=only" +task("h16", "parse", "Read in/config.kv (key=value per line; split on the first '=' only). Write out/result.json mapping keys to string values.", + {"in/config.kv": kv}, "out/result.json", "json", dict(l.split("=", 1) for l in lines(kv))) +plog = "INFO|started\nWARN|disk 80%\nERROR|crash\nINFO|retry\nINFO|ok\nERROR|again" +task("h17", "parse", "Read in/events.log (LEVEL|message per line). Write out/result.json mapping each LEVEL to its integer count.", + {"in/events.log": plog}, "out/result.json", "json", dict(Counter(l.split("|")[0] for l in lines(plog)))) +emails = "ada@example.com\nbob@mail.test.org\ncy@x.io" +task("h18", "parse", "Read in/emails.txt (one address per line). Write the domain part (after '@') of each, one per line, to out/result.txt.", + {"in/emails.txt": emails}, "out/result.txt", "text", "\n".join(e.split("@")[1] for e in lines(emails))) +times = "01:30\n00:45\n02:05\n10:00" +task("h19", "parse", "Read in/times.txt (HH:MM durations, one per line). Write the integer total number of minutes to out/result.txt.", + {"in/times.txt": times}, "out/result.txt", "text", str(sum(int(t.split(":")[0]) * 60 + int(t.split(":")[1]) for t in lines(times)))) +tags = "red;green;red;blue;green;yellow" +task("h20", "parse", "Read in/tags.txt (one line of ';'-separated tags). Write out/result.json: the JSON array of distinct tags in first-seen order.", + {"in/tags.txt": tags}, "out/result.json", "json", list(OrderedDict.fromkeys(tags.split(";")))) + +# ---- validation ---- +users = [{"id": 1, "email": "a@x"}, {"id": 2}, {"id": 3, "email": "c@x"}, {"id": 4, "name": "d"}] +task("h21", "validate", "Read in/users.json (array of objects with integer id). Write out/result.json: the JSON array of ids of objects that have no \"email\" key, in input order.", + {"in/users.json": json.dumps(users)}, "out/result.json", "json", [u["id"] for u in users if "email" not in u]) +people = [{"id": "p1", "age": 34}, {"id": "p2", "age": -3}, {"id": "p3", "age": 151}, {"id": "p4", "age": 0}, {"id": "p5", "age": 150}] +task("h22", "validate", "Read in/people.json (array of {id, age} with integer ages). Write out/result.txt with one line per record \" valid\" if 0 <= age <= 150 else \" invalid\".", + {"in/people.json": json.dumps(people)}, "out/result.txt", "text", "\n".join(f"{p['id']} {'valid' if 0 <= p['age'] <= 150 else 'invalid'}" for p in people)) +ids = ["a7", "b2", "c9", "b2", "a7"] +def firstdup(xs): + seen = set() + for x in xs: + if x in seen: return "duplicate:" + x + seen.add(x) + return "ok" +task("h23", "validate", "Read in/ids.json (array of strings). Write out/result.txt: \"ok\" if all are distinct, else \"duplicate:\" for the first id that repeats an earlier one.", + {"in/ids.json": json.dumps(ids)}, "out/result.txt", "text", firstdup(ids)) +schema = ["host", "port", "user", "timeout"] +config = {"host": "h", "user": "u", "debug": True} +task("h24", "validate", "Read in/schema.json (array of required key names) and in/config.json (object). Write out/result.json: the array of required keys missing from config, in schema order.", + {"in/schema.json": json.dumps(schema), "in/config.json": json.dumps(config)}, "out/result.json", "json", [k for k in schema if k not in config]) +seq = "1\n3\n3\n8\n5\n9" +ss = [int(x) for x in lines(seq)] +task("h25", "validate", "Read in/seq.txt (one integer per line). Write out/result.txt: \"sorted\" if the sequence is non-decreasing, otherwise \"unsorted at \" where n is the 1-based line of the first value smaller than its predecessor.", + {"in/seq.txt": seq}, "out/result.txt", "text", next((f"unsorted at {i+1}" for i in range(1, len(ss)) if ss[i] < ss[i-1]), "sorted")) + +# ---- JSON reshaping ---- +items = [{"id": "u1", "name": "Ada"}, {"id": "u2", "name": "Bob"}, {"id": "u3", "name": "Cy"}] +task("h26", "reshape", "Read in/items.json (array of {id, name}). Write out/result.json: an object mapping each id to its name.", + {"in/items.json": json.dumps(items)}, "out/result.json", "json", {i["id"]: i["name"] for i in items}) +prof = {"user": {"name": "Ada", "tags": ["x", "y", "z"], "meta": {"active": True}}} +task("h27", "reshape", "Read in/profile.json ({user: {name, tags, ...}}). Write out/result.json: {\"name\": user.name, \"tag_count\": number of user.tags}.", + {"in/profile.json": json.dumps(prof)}, "out/result.json", "json", {"name": "Ada", "tag_count": 3}) +members = [{"team": "red", "member": "a"}, {"team": "blue", "member": "b"}, {"team": "red", "member": "c"}, {"team": "green", "member": "d"}, {"team": "blue", "member": "e"}] +grp = {} +for m in members: grp.setdefault(m["team"], []).append(m["member"]) +task("h28", "reshape", "Read in/members.json (array of {team, member}). Write out/result.json: an object mapping each team to the array of its members in input order.", + {"in/members.json": json.dumps(members)}, "out/result.json", "json", grp) +recs = [{"id": 1, "status": "open", "owner": "a", "prio": 2}, {"id": 2, "status": "done", "owner": "b", "prio": 1}] +task("h29", "reshape", "Read in/records.json (array of objects). Write out/result.json: the same array keeping only the \"id\" and \"status\" fields of each object.", + {"in/records.json": json.dumps(recs)}, "out/result.json", "json", [{"id": r["id"], "status": r["status"]} for r in recs]) +codes = {"US": "United States", "FR": "France", "JP": "Japan"} +task("h30", "reshape", "Read in/codes.json (object of string to string). Write out/result.json: the inverted object mapping each value to its key.", + {"in/codes.json": json.dumps(codes)}, "out/result.json", "json", {v: k for k, v in codes.items()}) + +# ---- file walking ---- +tree = {"in/docs/a.txt": "one", "in/docs/sub/b.txt": "two", "in/docs/sub/c.md": "three", "in/docs/sub/deep/d.txt": "four", "in/docs/e.log": "five"} +task("h31", "walk", "Recursively walk in/docs. Write out/result.txt containing the integer number of regular files under it.", + tree, "out/result.txt", "text", str(len(tree))) +txts = sorted(p for p in tree if p.endswith(".txt")) +task("h32", "walk", "Recursively walk in/docs. Write out/result.txt with the paths (relative to in/docs, '/'-separated) of all files ending in .txt, sorted lexicographically, one per line.", + tree, "out/result.txt", "text", "\n".join(p[len("in/docs/"):] for p in txts)) + +Path(__file__).with_name("manifest.json").write_text(json.dumps({"version": "heldout-v0", "tasks": T}, indent=2) + "\n") +print(len(T), "tasks") diff --git a/experiments/token-efficiency-heldout-v0/tasks/manifest.json b/experiments/token-efficiency-heldout-v0/tasks/manifest.json new file mode 100644 index 0000000..21504dd --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/tasks/manifest.json @@ -0,0 +1,468 @@ +{ + "version": "heldout-v0", + "tasks": [ + { + "id": "h01", + "category": "text", + "description": "Read in/text.txt. Write out/result.txt with every line upper-cased, same line order.", + "inputs": { + "in/text.txt": "alpha beta\nGamma delta\n\nfoo bar foo\n padded line \nlast" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "ALPHA BETA\nGAMMA DELTA\n\nFOO BAR FOO\n PADDED LINE \nLAST" + }, + { + "id": "h02", + "category": "text", + "description": "Read in/text.txt. Write out/result.txt with the lines in reverse order.", + "inputs": { + "in/text.txt": "alpha beta\nGamma delta\n\nfoo bar foo\n padded line \nlast" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "last\n padded line \nfoo bar foo\n\nGamma delta\nalpha beta" + }, + { + "id": "h03", + "category": "text", + "description": "Read in/text.txt. Write out/result.txt where each line is prefixed with its 1-based line number and \": \" (e.g. \"1: alpha beta\").", + "inputs": { + "in/text.txt": "alpha beta\nGamma delta\n\nfoo bar foo\n padded line \nlast" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "1: alpha beta\n2: Gamma delta\n3: \n4: foo bar foo\n5: padded line \n6: last" + }, + { + "id": "h04", + "category": "text", + "description": "Read in/text.txt. Trim leading/trailing spaces of every line, drop lines that are then empty, and write the rest to out/result.txt.", + "inputs": { + "in/text.txt": "alpha beta\nGamma delta\n\nfoo bar foo\n padded line \nlast" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "alpha beta\nGamma delta\nfoo bar foo\npadded line\nlast" + }, + { + "id": "h05", + "category": "text", + "description": "Read in/text.txt. Replace every occurrence of the substring \"foo\" with \"bar\" and write the result to out/result.txt.", + "inputs": { + "in/text.txt": "alpha beta\nGamma delta\n\nfoo bar foo\n padded line \nlast" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "alpha beta\nGamma delta\n\nbar bar bar\n padded line \nlast" + }, + { + "id": "h06", + "category": "csv", + "description": "Read in/data.csv (header row, comma-separated, no quoting). Write the email column values, one per line in row order, to out/result.txt.", + "inputs": { + "in/data.csv": "name,email,age,dept,amount\nAda,ada@example.com,36,eng,120\nBob,bob@test.org,25,ops,75\nCy,cy@example.com,30,eng,40\nDee,dee@corp.net,41,sales,300\nEd,ed@test.org,29,ops,15" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "ada@example.com\nbob@test.org\ncy@example.com\ndee@corp.net\ned@test.org" + }, + { + "id": "h07", + "category": "csv", + "description": "Read in/data.csv. Write out/result.csv containing the header row followed by only the rows whose integer age is >= 30, in input order.", + "inputs": { + "in/data.csv": "name,email,age,dept,amount\nAda,ada@example.com,36,eng,120\nBob,bob@test.org,25,ops,75\nCy,cy@example.com,30,eng,40\nDee,dee@corp.net,41,sales,300\nEd,ed@test.org,29,ops,15" + }, + "output": "out/result.csv", + "kind": "text", + "expected": "name,email,age,dept,amount\nAda,ada@example.com,36,eng,120\nCy,cy@example.com,30,eng,40\nDee,dee@corp.net,41,sales,300" + }, + { + "id": "h08", + "category": "csv", + "description": "Read in/data.csv. Write the integer sum of the amount column to out/result.txt.", + "inputs": { + "in/data.csv": "name,email,age,dept,amount\nAda,ada@example.com,36,eng,120\nBob,bob@test.org,25,ops,75\nCy,cy@example.com,30,eng,40\nDee,dee@corp.net,41,sales,300\nEd,ed@test.org,29,ops,15" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "550" + }, + { + "id": "h09", + "category": "csv", + "description": "Read in/data.csv. Write out/result.json: a JSON array with one object per row mapping each header name to the row's string value.", + "inputs": { + "in/data.csv": "name,email,age,dept,amount\nAda,ada@example.com,36,eng,120\nBob,bob@test.org,25,ops,75\nCy,cy@example.com,30,eng,40\nDee,dee@corp.net,41,sales,300\nEd,ed@test.org,29,ops,15" + }, + "output": "out/result.json", + "kind": "json", + "expected": [ + { + "name": "Ada", + "email": "ada@example.com", + "age": "36", + "dept": "eng", + "amount": "120" + }, + { + "name": "Bob", + "email": "bob@test.org", + "age": "25", + "dept": "ops", + "amount": "75" + }, + { + "name": "Cy", + "email": "cy@example.com", + "age": "30", + "dept": "eng", + "amount": "40" + }, + { + "name": "Dee", + "email": "dee@corp.net", + "age": "41", + "dept": "sales", + "amount": "300" + }, + { + "name": "Ed", + "email": "ed@test.org", + "age": "29", + "dept": "ops", + "amount": "15" + } + ] + }, + { + "id": "h10", + "category": "csv", + "description": "Read in/data.csv. Write out/result.json: a JSON object mapping each dept value to the integer number of rows with that dept.", + "inputs": { + "in/data.csv": "name,email,age,dept,amount\nAda,ada@example.com,36,eng,120\nBob,bob@test.org,25,ops,75\nCy,cy@example.com,30,eng,40\nDee,dee@corp.net,41,sales,300\nEd,ed@test.org,29,ops,15" + }, + "output": "out/result.json", + "kind": "json", + "expected": { + "eng": 2, + "ops": 2, + "sales": 1 + } + }, + { + "id": "h11", + "category": "aggregate", + "description": "Read in/numbers.txt (one integer per line). Write out/result.json: {\"min\": m, \"max\": M, \"sum\": s} as integers.", + "inputs": { + "in/numbers.txt": "12\n-4\n7\n30\n0\n9" + }, + "output": "out/result.json", + "kind": "json", + "expected": { + "min": -4, + "max": 30, + "sum": 54 + } + }, + { + "id": "h12", + "category": "aggregate", + "description": "Read in/words.txt. Lower-case it, split every line on single spaces, and write out/result.json mapping each word to its integer count.", + "inputs": { + "in/words.txt": "the cat and the hat\nThe bat and THE cat" + }, + "output": "out/result.json", + "kind": "json", + "expected": { + "the": 4, + "cat": 2, + "and": 2, + "hat": 1, + "bat": 1 + } + }, + { + "id": "h13", + "category": "aggregate", + "description": "Read in/scores.json (a JSON array of integers). Write out/result.txt containing the integer mean rounded down (floor).", + "inputs": { + "in/scores.json": "[88, 92, 79, 65, 100, 71]" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "82" + }, + { + "id": "h14", + "category": "aggregate", + "description": "Read in/app.log. Write out/result.txt containing the integer number of lines that contain the substring \"ERROR\" (case-sensitive).", + "inputs": { + "in/app.log": "INFO start\nERROR disk full\nWARN slow\nERROR timeout\ninfo ERROR-free\nDEBUG x" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "3" + }, + { + "id": "h15", + "category": "aggregate", + "description": "Read in/text.txt. Write the longest line (by character count; the first one on ties) to out/result.txt.", + "inputs": { + "in/text.txt": "alpha beta\nGamma delta\n\nfoo bar foo\n padded line \nlast" + }, + "output": "out/result.txt", + "kind": "text", + "expected": " padded line " + }, + { + "id": "h16", + "category": "parse", + "description": "Read in/config.kv (key=value per line; split on the first '=' only). Write out/result.json mapping keys to string values.", + "inputs": { + "in/config.kv": "host=db.local\nport=5432\nuser=admin\nmode=read=only" + }, + "output": "out/result.json", + "kind": "json", + "expected": { + "host": "db.local", + "port": "5432", + "user": "admin", + "mode": "read=only" + } + }, + { + "id": "h17", + "category": "parse", + "description": "Read in/events.log (LEVEL|message per line). Write out/result.json mapping each LEVEL to its integer count.", + "inputs": { + "in/events.log": "INFO|started\nWARN|disk 80%\nERROR|crash\nINFO|retry\nINFO|ok\nERROR|again" + }, + "output": "out/result.json", + "kind": "json", + "expected": { + "INFO": 3, + "WARN": 1, + "ERROR": 2 + } + }, + { + "id": "h18", + "category": "parse", + "description": "Read in/emails.txt (one address per line). Write the domain part (after '@') of each, one per line, to out/result.txt.", + "inputs": { + "in/emails.txt": "ada@example.com\nbob@mail.test.org\ncy@x.io" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "example.com\nmail.test.org\nx.io" + }, + { + "id": "h19", + "category": "parse", + "description": "Read in/times.txt (HH:MM durations, one per line). Write the integer total number of minutes to out/result.txt.", + "inputs": { + "in/times.txt": "01:30\n00:45\n02:05\n10:00" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "860" + }, + { + "id": "h20", + "category": "parse", + "description": "Read in/tags.txt (one line of ';'-separated tags). Write out/result.json: the JSON array of distinct tags in first-seen order.", + "inputs": { + "in/tags.txt": "red;green;red;blue;green;yellow" + }, + "output": "out/result.json", + "kind": "json", + "expected": [ + "red", + "green", + "blue", + "yellow" + ] + }, + { + "id": "h21", + "category": "validate", + "description": "Read in/users.json (array of objects with integer id). Write out/result.json: the JSON array of ids of objects that have no \"email\" key, in input order.", + "inputs": { + "in/users.json": "[{\"id\": 1, \"email\": \"a@x\"}, {\"id\": 2}, {\"id\": 3, \"email\": \"c@x\"}, {\"id\": 4, \"name\": \"d\"}]" + }, + "output": "out/result.json", + "kind": "json", + "expected": [ + 2, + 4 + ] + }, + { + "id": "h22", + "category": "validate", + "description": "Read in/people.json (array of {id, age} with integer ages). Write out/result.txt with one line per record \" valid\" if 0 <= age <= 150 else \" invalid\".", + "inputs": { + "in/people.json": "[{\"id\": \"p1\", \"age\": 34}, {\"id\": \"p2\", \"age\": -3}, {\"id\": \"p3\", \"age\": 151}, {\"id\": \"p4\", \"age\": 0}, {\"id\": \"p5\", \"age\": 150}]" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "p1 valid\np2 invalid\np3 invalid\np4 valid\np5 valid" + }, + { + "id": "h23", + "category": "validate", + "description": "Read in/ids.json (array of strings). Write out/result.txt: \"ok\" if all are distinct, else \"duplicate:\" for the first id that repeats an earlier one.", + "inputs": { + "in/ids.json": "[\"a7\", \"b2\", \"c9\", \"b2\", \"a7\"]" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "duplicate:b2" + }, + { + "id": "h24", + "category": "validate", + "description": "Read in/schema.json (array of required key names) and in/config.json (object). Write out/result.json: the array of required keys missing from config, in schema order.", + "inputs": { + "in/schema.json": "[\"host\", \"port\", \"user\", \"timeout\"]", + "in/config.json": "{\"host\": \"h\", \"user\": \"u\", \"debug\": true}" + }, + "output": "out/result.json", + "kind": "json", + "expected": [ + "port", + "timeout" + ] + }, + { + "id": "h25", + "category": "validate", + "description": "Read in/seq.txt (one integer per line). Write out/result.txt: \"sorted\" if the sequence is non-decreasing, otherwise \"unsorted at \" where n is the 1-based line of the first value smaller than its predecessor.", + "inputs": { + "in/seq.txt": "1\n3\n3\n8\n5\n9" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "unsorted at 5" + }, + { + "id": "h26", + "category": "reshape", + "description": "Read in/items.json (array of {id, name}). Write out/result.json: an object mapping each id to its name.", + "inputs": { + "in/items.json": "[{\"id\": \"u1\", \"name\": \"Ada\"}, {\"id\": \"u2\", \"name\": \"Bob\"}, {\"id\": \"u3\", \"name\": \"Cy\"}]" + }, + "output": "out/result.json", + "kind": "json", + "expected": { + "u1": "Ada", + "u2": "Bob", + "u3": "Cy" + } + }, + { + "id": "h27", + "category": "reshape", + "description": "Read in/profile.json ({user: {name, tags, ...}}). Write out/result.json: {\"name\": user.name, \"tag_count\": number of user.tags}.", + "inputs": { + "in/profile.json": "{\"user\": {\"name\": \"Ada\", \"tags\": [\"x\", \"y\", \"z\"], \"meta\": {\"active\": true}}}" + }, + "output": "out/result.json", + "kind": "json", + "expected": { + "name": "Ada", + "tag_count": 3 + } + }, + { + "id": "h28", + "category": "reshape", + "description": "Read in/members.json (array of {team, member}). Write out/result.json: an object mapping each team to the array of its members in input order.", + "inputs": { + "in/members.json": "[{\"team\": \"red\", \"member\": \"a\"}, {\"team\": \"blue\", \"member\": \"b\"}, {\"team\": \"red\", \"member\": \"c\"}, {\"team\": \"green\", \"member\": \"d\"}, {\"team\": \"blue\", \"member\": \"e\"}]" + }, + "output": "out/result.json", + "kind": "json", + "expected": { + "red": [ + "a", + "c" + ], + "blue": [ + "b", + "e" + ], + "green": [ + "d" + ] + } + }, + { + "id": "h29", + "category": "reshape", + "description": "Read in/records.json (array of objects). Write out/result.json: the same array keeping only the \"id\" and \"status\" fields of each object.", + "inputs": { + "in/records.json": "[{\"id\": 1, \"status\": \"open\", \"owner\": \"a\", \"prio\": 2}, {\"id\": 2, \"status\": \"done\", \"owner\": \"b\", \"prio\": 1}]" + }, + "output": "out/result.json", + "kind": "json", + "expected": [ + { + "id": 1, + "status": "open" + }, + { + "id": 2, + "status": "done" + } + ] + }, + { + "id": "h30", + "category": "reshape", + "description": "Read in/codes.json (object of string to string). Write out/result.json: the inverted object mapping each value to its key.", + "inputs": { + "in/codes.json": "{\"US\": \"United States\", \"FR\": \"France\", \"JP\": \"Japan\"}" + }, + "output": "out/result.json", + "kind": "json", + "expected": { + "United States": "US", + "France": "FR", + "Japan": "JP" + } + }, + { + "id": "h31", + "category": "walk", + "description": "Recursively walk in/docs. Write out/result.txt containing the integer number of regular files under it.", + "inputs": { + "in/docs/a.txt": "one", + "in/docs/sub/b.txt": "two", + "in/docs/sub/c.md": "three", + "in/docs/sub/deep/d.txt": "four", + "in/docs/e.log": "five" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "5" + }, + { + "id": "h32", + "category": "walk", + "description": "Recursively walk in/docs. Write out/result.txt with the paths (relative to in/docs, '/'-separated) of all files ending in .txt, sorted lexicographically, one per line.", + "inputs": { + "in/docs/a.txt": "one", + "in/docs/sub/b.txt": "two", + "in/docs/sub/c.md": "three", + "in/docs/sub/deep/d.txt": "four", + "in/docs/e.log": "five" + }, + "output": "out/result.txt", + "kind": "text", + "expected": "a.txt\nsub/b.txt\nsub/deep/d.txt" + } + ] +} diff --git a/experiments/token-efficiency-heldout-v0/verification_test.go b/experiments/token-efficiency-heldout-v0/verification_test.go new file mode 100644 index 0000000..a2a4eda --- /dev/null +++ b/experiments/token-efficiency-heldout-v0/verification_test.go @@ -0,0 +1,102 @@ +package heldout + +import ( + "crypto/sha256" + "encoding/json" + "fmt" + "os" + "path/filepath" + "testing" +) + +var exts = map[string]string{"howl": "howl", "python": "py", "js": "js", "go": "go"} + +func readJSON(t *testing.T, path string, v any) { + t.Helper() + data, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + if err := json.Unmarshal(data, v); err != nil { + t.Fatal(err) + } +} + +// Every task × language is either verified (pass, matching hash) or an +// explicitly recorded HowlFrame gap with a reason and no solution file. +func TestHeldoutVerificationCoverage(t *testing.T) { + var manifest struct { + Tasks []struct { + ID string `json:"id"` + } `json:"tasks"` + } + readJSON(t, "tasks/manifest.json", &manifest) + var gaps []struct{ Task, Lang, Reason string } + readJSON(t, "gaps.json", &gaps) + var results []struct { + Task, Lang, SHA256 string + Pass bool + } + readJSON(t, "results/verification.json", &results) + if len(manifest.Tasks) < 30 { + t.Fatalf("held-out corpus has %d tasks, want >= 30", len(manifest.Tasks)) + } + gapped := map[string]bool{} + for _, g := range gaps { + if g.Lang != "howl" || g.Reason == "" { + t.Errorf("gap %s/%s must be a HowlFrame gap with a reason", g.Task, g.Lang) + } + gapped[g.Task+"/"+g.Lang] = true + if _, err := os.Stat(filepath.Join("solutions", g.Lang, g.Task+"."+exts[g.Lang])); err == nil { + t.Errorf("gap %s/%s has a solution file", g.Task, g.Lang) + } + } + seen := map[string]bool{} + for _, r := range results { + key := r.Task + "/" + r.Lang + if seen[key] || gapped[key] { + t.Errorf("duplicate or gapped entry %s", key) + } + seen[key] = true + if !r.Pass { + t.Errorf("%s did not pass", key) + } + src, err := os.ReadFile(filepath.Join("solutions", r.Lang, r.Task+"."+exts[r.Lang])) + if err != nil { + t.Errorf("%s: %v", key, err) + continue + } + if got := fmt.Sprintf("%x", sha256.Sum256(src)); got != r.SHA256 { + t.Errorf("%s: stale hash", key) + } + } + for _, task := range manifest.Tasks { + for lang := range exts { + key := task.ID + "/" + lang + if !seen[key] && !gapped[key] { + t.Errorf("missing %s", key) + } + } + } + if want := len(manifest.Tasks)*len(exts) - len(gaps); len(results) != want { + t.Errorf("%d results, want %d", len(results), want) + } +} + +// The frozen spec files must match the hashes recorded at freeze time. +func TestHeldoutSpecsFrozen(t *testing.T) { + frozen := map[string]string{ + "tasks/README.md": "4441e1e5c4e906a55fe595c382a7d2ef784045e9c1b1230f38887d70bf8318f1", + "tasks/build_specs.py": "dcea7d494d8b146ae032456b1f8822364d488c3d8596f7d829aecb21a75148f8", + "tasks/manifest.json": "962fa8198b11ac3ff1066abf35be6dcb87ad8a852574edfc46fee17a0ab9e67e", + } + for path, want := range frozen { + data, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + if got := fmt.Sprintf("%x", sha256.Sum256(data)); got != want { + t.Errorf("%s changed after freeze: %s", path, got) + } + } +}