def num

cswap-bend-cli@0.1.0.0 · clock.bend:90

import cswap-bend-cli@0.1.0.0/clock.bend as Clock
import Base

90# The n digits of `s` at offset `off`, as a number.
91def num(+s: String, off: Nat, +n: Nat) -> Maybe<&2, U32>:
92  +slice = String.take(String.drop(s, off), n)
93  num.pick(all_digits(slice) && Nat.is_eq(String.length(slice), n), slice)

Uses (11)

Used by (7)