cuelang.org/go@v0.10.1/cue/testdata/builtins/list/issue332.txtar (about) 1 -- in.cue -- 2 import "list" 3 4 #d: { 5 #x: string 6 result: [#x] 7 } 8 #foo: { 9 X=#x: _ 10 y: list.FlattenN((#d & {#x: X}).result, 1) 11 } 12 r: #foo & { 13 #x: "hello" 14 } 15 -- out/eval/stats -- 16 Leaks: 2 17 Freed: 23 18 Reused: 17 19 Allocs: 8 20 Retain: 12 21 22 Unifications: 25 23 Conjuncts: 65 24 Disjuncts: 35 25 -- out/eval -- 26 (struct){ 27 #d: (#struct){ 28 #x: (string){ string } 29 result: (#list){ 30 0: (string){ string } 31 } 32 } 33 #foo: (#struct){ 34 #x: (_){ _ } 35 y: (#list){ 36 0: (string){ string } 37 } 38 } 39 r: (#struct){ 40 #x: (string){ "hello" } 41 y: (#list){ 42 0: (string){ "hello" } 43 } 44 } 45 } 46 -- out/compile -- 47 --- in.cue 48 { 49 #d: { 50 #x: string 51 result: [ 52 〈1;#x〉, 53 ] 54 } 55 #foo: { 56 #x: _ 57 y: 〈import;list〉.FlattenN((〈1;#d〉 & { 58 #x: 〈1;#x〉 59 }).result, 1) 60 } 61 r: (〈0;#foo〉 & { 62 #x: "hello" 63 }) 64 }