Baseline: tree as shared

This commit is contained in:
alexm committed 2026-10-05 03:03:38 +00:00
commit 659c03bbf8
1471 files changed
+990535

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
# origin: Programming+ exercise count-base-proved
# status: unverified; `corpus.py verify` checks it on the pinned compiler
# probe: count_base with its claims as comments, as the matho pane states them
# expect-stdout: 3
def count_base(b: String, t: String) -> Int:
# ensures: result == |{ k in [0, |t|) : t[k] == b }|
var total: Int = 0
for i in range(t.count_codepoints()):
# invariant: total == |{ k in [0, i) : t[k] == b }|
if String(t[codepoint=i]) == b:
total += 1
return total
def main():
print(count_base("A", "GATTACA"))