From 1cfe97548a7e992d256be181b3f1f15ce0fa9b0a Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Fri, 25 Sep 2026 22:00:44 +0700 Subject: [PATCH] test/syntax/algorithms.fln is the converter's fixture again --- test/syntax/algorithms.fln | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/test/syntax/algorithms.fln b/test/syntax/algorithms.fln index 1f267d09..eaaa4d7a 100644 --- a/test/syntax/algorithms.fln +++ b/test/syntax/algorithms.fln @@ -27,30 +27,19 @@ fn selection-sort(coll: [$t]) -> () where ordered?($t) fn insertion-sort(coll: [$t]) -> () where ordered?($t) let i = 1 let length = length(coll) - while i < length + while and(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) - -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) + while j > 0 + and coll[j] < coll[dec(j)] + let temp = coll[j] + coll[j] = coll[dec(j)] + coll[dec(j)] = temp + --(j) ++(i) fn main() -> i32 = 0 -comment: +comment(): 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)) let str = bytes("INSERTIONSORT")