feat: move corpus to library

This commit is contained in:
alexm committed 2026-10-06 09:57:04 -04:00
1 parent df12b2a008
commit 9d351b4a0f
1301 files changed
+941859 -4

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
# origin: Programming+ exercise tally
# status: unverified; `corpus.py verify` checks it on the pinned compiler
# probe: how many times each base appears in t, in a Dict
# expect-stdout: {G: 1, A: 3, T: 2, C: 1}
def tally_bases(t: String) raises -> Dict[String, Int]:
var tally = Dict[String, Int]()
for i in range(t.count_codepoints()):
var b = String(t[codepoint=i])
if b in tally:
tally[b] += 1
else:
tally[b] = 1
return tally^
def main() raises:
print(tally_bases("GATTACA"))