From 68b85661724216f7cbca8cfb97686e3ae39095b3 Mon Sep 17 00:00:00 2001 From: john Date: Wed, 30 Jul 2025 16:18:50 +0300 Subject: [PATCH] Implement function in the correct order --- dana/programs/binarysearch.dana | 11 +++++------ dana/programs/bsort.dana | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dana/programs/binarysearch.dana b/dana/programs/binarysearch.dana index 79a67de..7e1a146 100644 --- a/dana/programs/binarysearch.dana +++ b/dana/programs/binarysearch.dana @@ -1,4 +1,9 @@ def main + def swap: a as ref int, b as ref int + var t is int + t := a + a := b + b := t def partition is int: arr as int [], low high as int var pivot i j is int @@ -20,12 +25,6 @@ def main pi := partition(arr, low, high) quicksort: arr, low, (pi - 1) quicksort: arr, (pi + 1), high - - def swap: a as ref int, b as ref int - var t is int - t := a - a := b - b := t def binarySearch is int: arr as int [], low high x as int var mid is int diff --git a/dana/programs/bsort.dana b/dana/programs/bsort.dana index fd281ff..d0e8ca3 100644 --- a/dana/programs/bsort.dana +++ b/dana/programs/bsort.dana @@ -1,4 +1,9 @@ def main + def swap: x y as ref int + var t is int + t := x + x := y + y := t def bsort: n as int, x as int [] var changed is byte @@ -18,12 +23,6 @@ def main if not changed: break : outer_loop_label - def swap: x y as ref int - var t is int - t := x - x := y - y := t - def writeArray: msg as byte [], n as int, x as int [] var i is int