Skip to content

Commit

Permalink
Fix some cases where at was used as a function pointer.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdunkerley committed May 24, 2024
1 parent 6ef6222 commit 83bc2f1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 1 addition & 2 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Data/Range.enso
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 83bc2f1

Please sign in to comment.