cuelang.org/go@v0.10.1/cue/testdata/eval/lists.txtar (about)

     1  -- in.cue --
     2  a: [...int]
     3  a: [1, 2, 3, 5]
     4  a: [1, 2, 3, d]
     5  
     6  b: a[3]
     7  d: 5
     8  
     9  c: [for x in [[1, 2]][0] {x + d}]
    10  -- out/eval/stats --
    11  Leaks:  4
    12  Freed:  11
    13  Reused: 8
    14  Allocs: 7
    15  Retain: 6
    16  
    17  Unifications: 15
    18  Conjuncts:    29
    19  Disjuncts:    13
    20  -- out/eval --
    21  (struct){
    22    a: (#list){
    23      0: (int){ 1 }
    24      1: (int){ 2 }
    25      2: (int){ 3 }
    26      3: (int){ 5 }
    27    }
    28    b: (int){ 5 }
    29    d: (int){ 5 }
    30    c: (#list){
    31      0: (int){ 6 }
    32      1: (int){ 7 }
    33    }
    34  }
    35  -- out/compile --
    36  --- in.cue
    37  {
    38    a: [
    39      ...int,
    40    ]
    41    a: [
    42      1,
    43      2,
    44      3,
    45      5,
    46    ]
    47    a: [
    48      1,
    49      2,
    50      3,
    51      〈1;d〉,
    52    ]
    53    b: 〈0;a〉[3]
    54    d: 5
    55    c: [
    56      for _, x in [
    57        [
    58          1,
    59          2,
    60        ],
    61      ][0] {
    62        (〈1;x〉 + 〈3;d〉)
    63      },
    64    ]
    65  }