cuelang.org/go@v0.10.1/cue/testdata/comprehensions/multi.txtar (about)

     1  -- in.cue --
     2  list: [2, 3]
     3  a: [ 3, for x in list {x}, for x in list {x}]
     4  b: [ 3, if true {3}, for x in list if x > 2 {x}]
     5  
     6  issue574: {
     7  	greet: true
     8  	bye:   true
     9  
    10  	message1: [
    11  		if greet {"hello"},
    12  		"how are you doing?",
    13  		"bye",
    14  	]
    15  
    16  	message2: [
    17  		if !greet {"hello"},
    18  		"how are you doing?",
    19  		if bye {
    20  			"bye"
    21  		},
    22  	]
    23  }
    24  -- out/eval/stats --
    25  Leaks:  0
    26  Freed:  24
    27  Reused: 20
    28  Allocs: 4
    29  Retain: 0
    30  
    31  Unifications: 24
    32  Conjuncts:    37
    33  Disjuncts:    24
    34  -- out/eval --
    35  (struct){
    36    list: (#list){
    37      0: (int){ 2 }
    38      1: (int){ 3 }
    39    }
    40    a: (#list){
    41      0: (int){ 3 }
    42      1: (int){ 2 }
    43      2: (int){ 3 }
    44      3: (int){ 2 }
    45      4: (int){ 3 }
    46    }
    47    b: (#list){
    48      0: (int){ 3 }
    49      1: (int){ 3 }
    50      2: (int){ 3 }
    51    }
    52    issue574: (struct){
    53      greet: (bool){ true }
    54      bye: (bool){ true }
    55      message1: (#list){
    56        0: (string){ "hello" }
    57        1: (string){ "how are you doing?" }
    58        2: (string){ "bye" }
    59      }
    60      message2: (#list){
    61        0: (string){ "how are you doing?" }
    62        1: (string){ "bye" }
    63      }
    64    }
    65  }
    66  -- out/compile --
    67  --- in.cue
    68  {
    69    list: [
    70      2,
    71      3,
    72    ]
    73    a: [
    74      3,
    75      for _, x in 〈1;list〉 {
    76        〈1;x〉
    77      },
    78      for _, x in 〈1;list〉 {
    79        〈1;x〉
    80      },
    81    ]
    82    b: [
    83      3,
    84      if true {
    85        3
    86      },
    87      for _, x in 〈1;list〉 if (〈0;x〉 > 2) {
    88        〈1;x〉
    89      },
    90    ]
    91    issue574: {
    92      greet: true
    93      bye: true
    94      message1: [
    95        if 〈1;greet〉 {
    96          "hello"
    97        },
    98        "how are you doing?",
    99        "bye",
   100      ]
   101      message2: [
   102        if !〈1;greet〉 {
   103          "hello"
   104        },
   105        "how are you doing?",
   106        if 〈1;bye〉 {
   107          "bye"
   108        },
   109      ]
   110    }
   111  }