Explorer

definy.decimal-of

description
The number written in decimal digits by bytes from index after acc. none if there is a byte that is not a digit
type
Fn(bytes: List<Number>, index: Number, acc: Number) -> Union{#none, #some(Number)}
expression
fn(bytes$0, index$1, acc$2) =>
  match @core.list-get(list: $0, index: $1) {
    #none(_) =>
      #some($2),
    #some(byte$3) =>
      match @core.and(left: @core.less-than(left: 47, right: $3), right: @core.less-than(left: $3, right: 58)) {
        true =>
          @definy.decimal-of(
            bytes: $0,
            index: @core.plus(left: $1, right: 1),
            acc: @core.plus(left: @core.multiply(left: $2, right: 10), right: @core.minus(left: $3, right: 48))
          ),
        false =>
          #none
      }
  }
visibility
public
definy.decimal-of (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: fzMmBroA-nfDLM2x722u9Ux1P8YC9fvooXyNbQH7a3o
content hash: mB8ifEm9BTpKSlD9cM1EFGZwi9dJqH42uGtc6gxLLSo