From 381ec5920d9ebeb335963778dec182268819e718 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 30 Mar 2022 14:05:57 -0400 Subject: Now demanding mandatory loop names, instead of using default "again" name. --- stdlib/source/unsafe/lux/data/binary.lux | 4 +-- stdlib/source/unsafe/lux/data/collection/array.lux | 34 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'stdlib/source/unsafe') diff --git a/stdlib/source/unsafe/lux/data/binary.lux b/stdlib/source/unsafe/lux/data/binary.lux index 0dd650ec2..bc99f1f55 100644 --- a/stdlib/source/unsafe/lux/data/binary.lux +++ b/stdlib/source/unsafe/lux/data/binary.lux @@ -283,7 +283,7 @@ sample limit (..size reference)] (.and ("lux i64 =" limit (..size sample)) - (.loop [index 0] + (.loop (again [index 0]) (.if ("lux i64 =" limit index) .true (.and ("lux i64 =" @@ -304,7 +304,7 @@ (~~ (.static @.jvm)) ... Default - (.loop [index 0] + (.loop (again [index 0]) (.if ("lux i64 <" (.int bytes) (.int index)) (.exec (..with/1! ("lux i64 +" target_offset index) diff --git a/stdlib/source/unsafe/lux/data/collection/array.lux b/stdlib/source/unsafe/lux/data/collection/array.lux index 3897dd399..e66d3ca3b 100644 --- a/stdlib/source/unsafe/lux/data/collection/array.lux +++ b/stdlib/source/unsafe/lux/data/collection/array.lux @@ -186,7 +186,7 @@ (.-> .Nat .Nat (..Array a) .Nat (..Array a) (..Array a))) (.function (copy! length src_start src_array dest_start dest_array) - (.loop [offset 0] + (.loop (again [offset 0]) (.if ("lux i64 <" (.int length) (.int offset)) (.exec (.if (..lacks? ("lux i64 +" offset src_start) src_array) @@ -203,8 +203,8 @@ [((.is (.All (_ a) (.-> (..Array a) .Nat)) (.function (occupancy array) (.let [size (..size array)] - (.loop [index 0 - it 0] + (.loop (again [index 0 + it 0]) (.if ("lux i64 <" (.int size) (.int index)) (.if (..lacks? index array) (again ("lux i64 +" 1 index) ) @@ -221,7 +221,7 @@ (.-> (.-> a .Bit) (..Array a) (..Array a))) (.function (only! ? it) (.let [size (..size it)] - (.loop [index 0] + (.loop (again [index 0]) (.if ("lux i64 <" (.int size) (.int index)) (.exec (.if (..lacks? index it) @@ -239,7 +239,7 @@ (.-> (..Array a) (.Maybe ))) (.function ( ? it) (.let [size (..size it)] - (.loop [index 0] + (.loop (again [index 0]) (.if ("lux i64 <" (.int size) (.int index)) (.if (..lacks? index it) (again ("lux i64 +" 1 index)) @@ -266,8 +266,8 @@ (.function (of_list input) (.let [size (list.size input) output (..empty size)] - (.loop [index 0 - input input] + (.loop (again [index 0 + input input]) (.case input {.#End} output @@ -285,8 +285,8 @@ (`` (template: (list|-default ) [((.is (.All (_ a) (.-> (.List a) (..Array a) (.List a))) (.function (list|-default empty array) - (.loop [index ("lux i64 -" 1 (..size array)) - output empty] + (.loop (again [index ("lux i64 -" 1 (..size array)) + output empty]) (.if ("lux i64 =" (~~ (.static ..underflow)) index) output (again ("lux i64 -" 1 index) @@ -298,9 +298,9 @@ (`` (template: (list|+default ) [((.is (.All (_ a) (.-> a (..Array a) (.List a))) (.function (list|+default default array) - (.loop [index ("lux i64 -" 1 (..size array)) - output (`` (.is (.List (~~ (.these (~~ (.type_of default))))) - {.#End}))] + (.loop (again [index ("lux i64 -" 1 (..size array)) + output (`` (.is (.List (~~ (.these (~~ (.type_of default))))) + {.#End}))]) (.if ("lux i64 =" (~~ (.static ..underflow)) index) output (again ("lux i64 -" 1 index) @@ -326,7 +326,7 @@ (.function (= //#= left/* right/*) (.let [size (..size left/*)] (.and ("lux i64 =" (..size right/*) size) - (.loop [index 0] + (.loop (again [index 0]) (.if ("lux i64 <" (.int size) (.int index)) (.if (..lacks? index left/*) (..lacks? index right/*) @@ -353,8 +353,8 @@ (.-> (.-> Nat b a a) a (..Array b) a)) (.function (mix $ init it) (.let [size (..size it)] - (.loop [index 0 - so_far init] + (.loop (again [index 0 + so_far init]) (.if ("lux i64 <" (.int size) (.int index)) (.if (..lacks? index it) (again ("lux i64 +" 1 index) so_far) @@ -378,7 +378,7 @@ (.-> (..Array a) .Bit))) (.function ( ? it) (.let [size (..size it)] - (.loop [index 0] + (.loop (again [index 0]) (.if ("lux i64 <" (.int size) (.int index)) (.if (..lacks? index it) (again ("lux i64 +" 1 index)) @@ -396,7 +396,7 @@ (.-> (.-> a (.Maybe b)) (..Array a) (.Maybe b))) (.function (one ? it) (.let [size (..size it)] - (.loop [index 0] + (.loop (again [index 0]) (.if ("lux i64 <" (.int size) (.int index)) (with_expansions [ (again ("lux i64 +" 1 index))] (.if (..lacks? index it) -- cgit v1.2.3