...

Text file src/cuelang.org/go/cue/testdata/eval/lists.txtar

Documentation: cuelang.org/go/cue/testdata/eval

     1-- in.cue --
     2a: [...int]
     3a: [1, 2, 3, 5]
     4a: [1, 2, 3, d]
     5
     6b: a[3]
     7d: 5
     8
     9c: [for x in [[1, 2]][0] {x + d}]
    10-- out/eval/stats --
    11Leaks:  4
    12Freed:  11
    13Reused: 8
    14Allocs: 7
    15Retain: 6
    16
    17Unifications: 15
    18Conjuncts:    29
    19Disjuncts:    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}

View as plain text