def cookie.date.run
import bend-kit-http@0.38.2.0/http.bend as Httpimport Base
1984# The digits at the start of s: (count, value, rest). d: s starts with a digit.
1985def cookie.date.run(s: String, d: Bool, +n: U32, +acc: U32) -> U32 & U32 & String:
1986 match s:
1987 case SNil{}:
1988 (n, acc, SNil{})
1989 case SCon{Chr{+c}, +t}:
1990 match d:
1991 case True{}:
1992 cookie.date.run(t, cookie.date.head(t), (n + 1 : U32), (acc * 10 + (c - 48 : U32) : U32))
1993 case False{}:
1994 (n, acc, SCon{Chr{c}, t})