test/syntax/algorithms.fln is the converter's fixture again

This commit is contained in:
Joseph Ferano 2026-09-25 22:00:44 +07:00
parent cecbec6c71
commit 1cfe97548a

View File

@ -27,30 +27,19 @@ fn selection-sort(coll: [$t]) -> () where ordered?($t)
fn insertion-sort(coll: [$t]) -> () where ordered?($t) fn insertion-sort(coll: [$t]) -> () where ordered?($t)
let i = 1 let i = 1
let length = length(coll) let length = length(coll)
while i < length while and(i < length)
let j = i let j = i
while j > 0 and coll[j] < coll[dec(j)] while j > 0
let temp = coll[j] and coll[j] < coll[dec(j)]
coll[j] = coll[dec(j)] let temp = coll[j]
coll[dec(j)] = temp coll[j] = coll[dec(j)]
--(j) coll[dec(j)] = temp
++(i) --(j)
fn insertion-sort-dyn(coll)
let i = 1
let length = length(coll)
while i < length
let j = i
while j > 0 and coll[j] < coll[dec(j)]
let temp = coll[j]
coll[j] = coll[dec(j)]
coll[dec(j)] = temp
--(j)
++(i) ++(i)
fn main() -> i32 = 0 fn main() -> i32 = 0
comment: comment():
insertion-sort([\I \N \S \E \R \T \I \O \N \S \O \R \T]) insertion-sort([\I \N \S \E \R \T \I \O \N \S \O \R \T])
insertion-sort(slice([6 2 4 9 1 9 4 5], 0, 8)) insertion-sort(slice([6 2 4 9 1 9 4 5], 0, 8))
let str = bytes("INSERTIONSORT") let str = bytes("INSERTIONSORT")