✓
Passing This code compiles and runs correctly.
Code
// std/string:cmp — three-way byte-lexicographic order over raw slices.
// The tor 820_007 spelled by hand for its alphabetical tie-break: a bare
// `a < b` on strings does not lower (Zig refuses `<` on []u8 at Stage D),
// so ordering lives on the namespaced surface. | lt | eq | gt — the
// std/num:cmp shape; shorter-prefix-first settles equality through the
// shared prefix. Pure-Koru subflow: recursion over the bytes, no host call.
import std/io
import std/string
tor show { a: string, b: string }
show = std/string:cmp(a, b)
| lt |> std/io:print.ln("{{ a:s }} lt {{ b:s }}")
| eq |> std/io:print.ln("{{ a:s }} eq {{ b:s }}")
| gt |> std/io:print.ln("{{ a:s }} gt {{ b:s }}")
show(a: "ant", b: "bee")
show(a: "cat", b: "cat")
show(a: "dog", b: "bee")
show(a: "app", b: "apple")
show(a: "apple", b: "app")
show(a: "", b: "a")
show(a: "", b: "")
show(a: "Zebra", b: "apple")
Actual
ant lt bee
cat eq cat
dog gt bee
app lt apple
apple gt app
lt a
eq
Zebra lt apple
Expected output
ant lt bee
cat eq cat
dog gt bee
app lt apple
apple gt app
lt a
eq
Zebra lt apple
Flows
subflow ~show click a branch to expand · @labels scroll to their anchor
cmp (a, b)
flow ~show click a branch to expand · @labels scroll to their anchor
show (a: "ant", b: "bee")
flow ~show click a branch to expand · @labels scroll to their anchor
show (a: "cat", b: "cat")
flow ~show click a branch to expand · @labels scroll to their anchor
show (a: "dog", b: "bee")
flow ~show click a branch to expand · @labels scroll to their anchor
show (a: "app", b: "apple")
flow ~show click a branch to expand · @labels scroll to their anchor
show (a: "apple", b: "app")
flow ~show click a branch to expand · @labels scroll to their anchor
show (a: "", b: "a")
flow ~show click a branch to expand · @labels scroll to their anchor
show (a: "", b: "")
flow ~show click a branch to expand · @labels scroll to their anchor
show (a: "Zebra", b: "apple")
Test Configuration
MUST_RUN LANGUAGES: zig cs