prime-sequence
The prime-sequence worked example.
Run it from sema/:
sema check examples/prime-sequenceSEMA_STRICT=1 sema run examples/prime-sequencesema assure examples/prime-sequence --grade silverSource
Section titled “Source”src/main.sema
Section titled “src/main.sema”"""Bounded exact prime indexing and inclusive prime counting."""
assure silver
equation prime_landmarks() -> any: return (prime_nth(1), prime(100), prime_count(100), primepi(541))
test "prime aliases are exact and one based": values = prime_landmarks() check values[0] == 2 check values[1] == 541 check values[2] == 25 check values[3] == 100
def main() -> any !{}: return prime_landmarks()Reflected API
Section titled “Reflected API”Bounded exact prime indexing and inclusive prime counting.
def main
Section titled “def main”def main() -> any !{}Returns any
Effects !{}