github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/cue/testdata/builtins/list/sort.txtar (about)

     1  -- in.cue --
     2  import "list"
     3  
     4  a: list.Sort([2, 3, 1, 4], {x: _, y: _, less: x < y})
     5  -- out/eval --
     6  (struct){
     7    a: (#list){
     8      0: (int){ 1 }
     9      1: (int){ 2 }
    10      2: (int){ 3 }
    11      3: (int){ 4 }
    12    }
    13  }
    14  -- out/compile --
    15  --- in.cue
    16  {
    17    a: 〈import;list〉.Sort([
    18      2,
    19      3,
    20      1,
    21      4,
    22    ], {
    23      x: _
    24      y: _
    25      less: (〈0;x〉 < 〈0;y〉)
    26    })
    27  }