From 83bc2f107989d02aeb108fd67f79956eaaf41f80 Mon Sep 17 00:00:00 2001 From: James Dunkerley Date: Fri, 24 May 2024 11:24:17 +0100 Subject: [PATCH] Fix some cases where `at` was used as a function pointer. --- .../lib/Standard/Base/0.0.0-dev/src/Data/Array_Proxy.enso | 2 +- distribution/lib/Standard/Base/0.0.0-dev/src/Data/Range.enso | 3 +-- .../lib/Standard/Base/0.0.0-dev/src/Data/Time/Date_Range.enso | 2 +- distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso | 3 +-- .../Base/0.0.0-dev/src/Internal/Array_Like_Helpers.enso | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array_Proxy.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array_Proxy.enso index a100bad8655b..9c9d83e5a3af 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array_Proxy.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array_Proxy.enso @@ -40,4 +40,4 @@ type Array_Proxy methods. from_proxy_object : Any -> Array from_proxy_object proxy = - Array_Like_Helpers.new_array_proxy_builtin proxy.length proxy.at + Array_Like_Helpers.new_array_proxy_builtin proxy.length (i-> proxy.at i) diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Range.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Range.enso index e92227521f56..0cdfd497a9a4 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Range.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Range.enso @@ -535,10 +535,9 @@ type Range 1.up_to 6 . to_vector to_vector : Vector Integer to_vector self = - proxy = Array_Proxy.new self.length self.at + proxy = Array_Proxy.new self.length (i-> self.at i) Vector.from_polyglot_array proxy - ## ICON preparation Combines all the elements of a non-empty range using a binary operation. If the range is empty, returns `if_empty`. diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date_Range.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date_Range.enso index 1ae81b27c51e..3632aa22b78a 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date_Range.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date_Range.enso @@ -214,7 +214,7 @@ type Date_Range (Date.new 2021 05 07).up_to (Date.new 2021 05 10) . to_vector to_vector : Vector Date to_vector self = - proxy = Array_Proxy.new self.length self.at + proxy = Array_Proxy.new self.length (i-> self.at i) Vector.from_polyglot_array proxy ## GROUP Logical diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso index 04d6d85bad25..7c5dd6fe3fb1 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso @@ -31,7 +31,6 @@ from project.Data.Index_Sub_Range import Index_Sub_Range from project.Data.Ordering import all from project.Data.Range.Extensions import all from project.Metadata import Display, Widget - from project.Runtime import assert polyglot java import java.lang.IndexOutOfBoundsException @@ -1445,7 +1444,7 @@ type Builder of the vector, i.e. -1 will correspond to the last element. @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length display=Display.Always) at : Integer -> Any ! Index_Out_Of_Bounds - at self index:Integer=0 = + at self index:Integer = actual_index = if index < 0 then self.length + index else index Panic.catch IndexOutOfBoundsException (self.elements_java_builder.get actual_index) _-> Error.throw (Index_Out_Of_Bounds.Error index self.length) diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Internal/Array_Like_Helpers.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Internal/Array_Like_Helpers.enso index f12786d07043..aed4ba0f04b5 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Internal/Array_Like_Helpers.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Internal/Array_Like_Helpers.enso @@ -246,7 +246,7 @@ transpose vec_of_vecs = Vector.from_polyglot_array proxy map vector function on_problems = - vector_from_function vector.length (function << vector.at) on_problems + vector_from_function vector.length (function << (i-> vector.at i)) on_problems map_with_index vector function on_problems = vector_from_function vector.length (i-> function i (vector.at i)) on_problems