Explorer

cbor.encode-entries

description
The CBOR of the map entries from start to end (halving the range)
type
Fn(entries: List<@cbor.entry>, start: Number, end: Number) -> List<Number>
expression
fn(entries$0, start$1, end$2) =>
  let length$3 = @core.minus(left: $2, right: $1);
  match @core.less-than(left: $3, right: 2) {
    true =>
      match @core.equal(left: $3, right: 1) {
        true =>
          match @core.list-get(list: $0, index: $1) {
            #some(entry$4) =>
              @core.list-concat(left: @cbor.encode(item: $4.key), right: @cbor.encode(item: $4.value)),
            #none(_) =>
              []
          },
        false =>
          []
      },
    false =>
      let middle$5 = @core.plus(left: $1, right: @core.divide(left: $3, right: 2));
      @core.list-concat(
        left: @cbor.encode-entries(entries: $0, start: $1, end: $5),
        right: @cbor.encode-entries(entries: $0, start: $5, end: $2)
      )
  }
visibility
public
cbor.encode-entries (project cbor, branch main, snapshot 5bvML2Im-osGmgnKJsp0FwmfSMONephnrgdWQboV3-E)
id: BJLaIBbQv99O44aaJ197pLuECxBTUoWeE9Ibi4-qVwU
content hash: rkoGN_mBZwFxwB0NxAGEndUc4WdNIEIuO0w0k6WcnSs