def secfrac.go

bend-kit-time@0.3.0.0 · time.bend:451

import bend-kit-time@0.3.0.0/time.bend as Time
import Base

451# Digits after the first nine are read and dropped. d says whether s starts with a digit.
452def secfrac.go(s: String, d: Bool, +mul: U32, +acc: U32, +k: U32) -> U32 & U32 & String:
453  match s:
454    case SNil{}:
455      (k, acc, SNil{})
456    case SCon{Chr{+c}, +t}:
457      match d:
458        case True{}:
459          secfrac.go(t, at.head(t), (mul / 10 : U32), (acc + (c - 48) * mul : U32), (k + 1 : U32))
460        case False{}:
461          (k, acc, SCon{Chr{c}, t})

Uses (11)

Used by (1)