main.adl
1 program bubblesort.alpha { 2 transition bubble_sort(xs: [u32; 8]) -> [u32; 8] { 3 for i: u8 in 0u8..7u8 { 4 for j: u8 in 0u8..7u8-i { 5 // Move the smaller elements forward 6 if xs[j+1u8] < xs[j] { 7 let swap: u32 = xs[j]; 8 // let swap = xs[j]; 9 xs[j] = xs[j+1u8]; 10 xs[j+1u8] = swap; 11 } 12 } 13 } 14 return xs; 15 } 16 17 // The constructor is configured to prevent upgrades. 18 @noupgrade 19 async constructor() {} 20 }