Baseline: tree as shared

This commit is contained in:
alexm committed 2026-10-05 03:03:38 +00:00
commit 31f2fb8a5a
1679 files changed
+1024562

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
# probe: splitting text and counting words in a Dict, in insertion order
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
# expect-stdout: the 3
# expect-stdout: cat 1
# expect-stdout: and 2
# expect-stdout: hat 1
# expect-stdout: bat 1
# expect-stdout: distinct: 5
def main() raises:
var text = String("the cat and the hat and the bat")
var counts = Dict[String, Int]()
for w in text.split(" "):
var word = String(w)
if word in counts:
counts[word] += 1
else:
counts[word] = 1
for e in counts.items():
print(e.key, e.value)
print("distinct:", len(counts))