{Record read show compare fold}

Where

Let (read text)
    Let n (STRING.length text)
    In
    Iterate {i num} From {0 0}
        Cond
        | (i = n) `just.num
        | True
            Let c (STRING.fetch text i)
            In
            If And (c >= '0') (c <= '9')
                Continue {(i + 1) ((10 * num) + (c - '0'))}
                `nothing
        ;

Let (compare a b)
    Cond
    | (a < b) `less
    | (a > b) `greater
    | True `equal
    ;

Let (show i)
    (Prim show_integer i)

Let (fold n z succ)
    Iterate {i r} From {0 z}
        If (i = n)
            r
            Continue {(i + 1) (succ i r)}

Where

Let STRING Package "string"