diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso index 70865445f2a5..f212da7c7183 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso @@ -24,6 +24,7 @@ import project.Panic.Panic from project.Data.Boolean import Boolean, False, True from project.Data.Index_Sub_Range import Index_Sub_Range from project.Data.Range.Extensions import all +from project.Metadata import Display, Widget ## The type of primitive mutable arrays. @Builtin_Type @@ -46,8 +47,9 @@ type Array Get the last element of an array. [1, 2, 3].to_array.at -1 == 3 + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) at : Integer -> Any ! Index_Out_Of_Bounds - at self index = Array_Like_Helpers.at self index + at self index:Integer=0 = Array_Like_Helpers.at self index ## GROUP Metadata ICON metadata @@ -733,8 +735,9 @@ type Array also allowed be negative, then the elements are indexed from the back of the array, i.e. -1 will correspond to the last element. - if_missing: The value to return if the index is out of bounds. + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) get : Integer -> Any -> Any - get self index ~if_missing=Nothing = + get self index:Integer=0 ~if_missing=Nothing = Array_Like_Helpers.get self index if_missing ## GROUP Logical 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/List.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/List.enso index 610e5130de65..5c8e53af9078 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/List.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/List.enso @@ -16,6 +16,7 @@ import project.Panic.Panic from project.Data.Boolean import Boolean, False, True from project.Data.Filter_Condition import unify_condition_or_predicate, unify_condition_predicate_or_element from project.Data.List.List import Cons, Nil +from project.Metadata import Display, Widget ## The basic cons-list type. @@ -76,8 +77,9 @@ type List import Standard.Examples example_length = Examples.list.length + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) at : Integer -> Any ! Index_Out_Of_Bounds - at self index = + at self index:Integer=0 = self.get index (Error.throw (Index_Out_Of_Bounds.Error index self.length)) ## ICON parse3 @@ -93,8 +95,9 @@ type List also allowed be negative, then the elements are indexed from the back of the final item, i.e. -1 will correspond to the last element. - if_missing: The value to return if the index is out of bounds. + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) get : Integer -> Any -> Any - get self index ~if_missing=Nothing = case index >= 0 of + get self index:Integer=0 ~if_missing=Nothing = case index >= 0 of True -> loop current index = case current of Nil -> if_missing diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Pair.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Pair.enso index 68b2eb32b5c1..6f52c8fe6625 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Pair.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Pair.enso @@ -10,6 +10,7 @@ import project.Function.Function import project.Nothing.Nothing import project.Panic.Panic from project.Data.Text.Extensions import all +from project.Metadata import Display, Widget ## A pair of elements. type Pair @@ -70,8 +71,9 @@ type Pair - index: The location in the pair to get the element from. The index is also allowed be negative, then the elements are indexed from the back of the pair, i.e. -1 will correspond to the last element. + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) at : Integer -> Any - at self index = + at self index:Integer=0 = self.get index (Error.throw (Index_Out_Of_Bounds.Error index 2)) ## ICON parse3 @@ -83,8 +85,9 @@ type Pair also allowed be negative, then the elements are indexed from the back of the pair, i.e. -1 will correspond to the last element. - if_missing: The value to return if the index is out of bounds. + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) get : Integer -> Any -> Any - get self index ~if_missing=Nothing = + get self index:Integer=0 ~if_missing=Nothing = case index of 0 -> self.first 1 -> self.second 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 b1c37d8472ea..491ba602657a 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 @@ -15,6 +15,7 @@ import project.Nothing.Nothing import project.Panic.Panic from project.Data.Boolean import Boolean, False, True from project.Data.Filter_Condition import unify_condition_or_predicate +from project.Metadata import Display, Widget ## Represents a right-exclusive range of integer values. type Range @@ -120,8 +121,9 @@ type Range Get the last element of a range with step. 0.up_to 10 . with_step 2 . get -1 == 8 + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) at : Integer -> Any ! Index_Out_Of_Bounds - at self index = + at self index:Integer=0 = self.get index (Error.throw (Index_Out_Of_Bounds.Error index self.length)) ## ICON parse3 @@ -133,8 +135,9 @@ type Range also allowed be negative, then the elements are indexed from the back, i.e. -1 will correspond to the last element. - if_missing: The value to return if the index is out of bounds. + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) get : Integer -> Any -> Any - get self index ~if_missing=Nothing = + get self index:Integer=0 ~if_missing=Nothing = len = self.length used_index = if index < 0 then len + index else index if used_index >= 0 && used_index < len then self.start + used_index * self.step else @@ -532,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 (self.at _) 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/Text/Extensions.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Extensions.enso index 81a8ce41ef81..fb9333a143ac 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Extensions.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Extensions.enso @@ -127,9 +127,9 @@ Text.each self function = Get the individual characters in the text "건반(Korean)". "건반(Korean)".at 1 == "반" -@index (t-> Widget.Numeric_Input minimum=0 maximum=t.length display=Display.Always) +@index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) Text.at : Integer -> Text ! Index_Out_Of_Bounds -Text.at self index = +Text.at self index:Integer=0 = self.get index (Error.throw (Index_Out_Of_Bounds.Error index self.length)) ## ALIAS get character @@ -154,9 +154,9 @@ Text.at self index = Get the individual characters in the text "건반(Korean)". "건반(Korean)".get 1 == "반" -@index (t-> Widget.Numeric_Input minimum=0 maximum=t.length display=Display.Always) +@index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) Text.get : Integer -> Any -> Any -Text.get self index ~if_missing=Nothing = +Text.get self index:Integer=0 ~if_missing=Nothing = new_index = if index < 0 then index + self.length else index if new_index < 0 then if_missing else iterator = BreakIterator.getCharacterInstance diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Match.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Match.enso index aef2a5b4e6b2..9ffee0b54841 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Match.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Match.enso @@ -15,6 +15,7 @@ import project.Nothing.Nothing import project.Panic.Panic from project.Data.Boolean import Boolean, False, True from project.Data.Range.Extensions import all +from project.Metadata import Display, Widget type Match ## PRIVATE @@ -299,8 +300,9 @@ type Match Arguments: - id: The integer index or name of that group. - if_missing: The value to return if the index is out of bounds. + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.pattern.group_count display=Display.Always) get : Integer -> Any -> Text | Any - get self index ~if_missing=Nothing = + get self index:Integer=0 ~if_missing=Nothing = self.text index . catch No_Such_Group (_-> if_missing) ## GROUP Selections @@ -312,6 +314,7 @@ type Match Arguments: - id: The integer index or name of that group. - if_missing: The value to return if the index is out of bounds. + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.pattern.group_count display=Display.Always) at : Integer -> Text ! Index_Out_Of_Bounds - at self index = + at self index:Integer=0 = self.get index if_missing=(Error.throw (Index_Out_Of_Bounds.Error index self.pattern.group_count)) 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 3276bb5027f4..742c4ae15f3d 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 @@ -18,6 +18,7 @@ import project.Nothing.Nothing from project.Data.Boolean import Boolean, False, True from project.Data.Filter_Condition import unify_condition_or_predicate, unify_condition_predicate_or_element from project.Data.Range.Extensions import all +from project.Metadata import Display, Widget from project.Runtime import assert polyglot java import org.enso.base.Time_Utils @@ -161,8 +162,9 @@ type Date_Range Get the last element of a range with step. (Date.new 2023 04 05) . up_to (Date.new 2023 10 07) . with_step Date_Period.Month . get -1 == (Date.new 2023 10 05) + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) at : Integer -> Any ! Index_Out_Of_Bounds - at self index = + at self index:Integer=0 = self.get index (Error.throw (Index_Out_Of_Bounds.Error index self.length)) ## ICON parse3 @@ -174,8 +176,9 @@ type Date_Range also allowed be negative, then the elements are indexed from the back, i.e. -1 will correspond to the last element. - if_missing: The value to return if the index is out of bounds. + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) get : Integer -> Any -> Any - get self index ~if_missing=Nothing = + get self index:Integer=0 ~if_missing=Nothing = len = self.length effective_index = if index < 0 then len + index else index if effective_index >= 0 && effective_index < len then self.internal_at effective_index else @@ -214,7 +217,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 (self.at _) 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 5d04ff3be89d..42af464fc23c 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 @@ -30,6 +30,7 @@ from project.Data.Filter_Condition import unify_condition_or_predicate, unify_co 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 @@ -294,8 +295,9 @@ type Vector a Get the last element of a vector. [1, 2, 3].at -1 == 3 + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) at : Integer -> Any ! Index_Out_Of_Bounds - at self index = Array_Like_Helpers.at self index + at self index:Integer=0 = Array_Like_Helpers.at self index ## ICON parse3 Gets an element from the vector at a specified index (0-based). @@ -306,8 +308,9 @@ type Vector a also allowed be negative, then the elements are indexed from the back of the vector, i.e. -1 will correspond to the last element. - if_missing: The value to return if the index is out of bounds. + @index (t-> Widget.Numeric_Input minimum=0 maximum=t.length-1 display=Display.Always) get : Integer -> Any -> Any - get self index ~if_missing=Nothing = + get self index:Integer=0 ~if_missing=Nothing = Array_Like_Helpers.get self index if_missing ## ICON dataframe_map_column @@ -1440,7 +1443,7 @@ type Builder also allowed be negative, then the elements are indexed from the back of the vector, i.e. -1 will correspond to the last element. at : Integer -> Any ! Index_Out_Of_Bounds - at self index = + 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..b3fd7aa6314c 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 (i-> function (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 diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Nothing.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Nothing.enso index 98e776fd6351..907f0171c1a1 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Nothing.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Nothing.enso @@ -53,6 +53,6 @@ type Nothing - key: The key to get. - if_missing: The value to return if the key is not found. get : Text | Integer -> Any -> Nothing - get self key ~if_missing=Nothing = + get self (key:(Text | Integer)=0) ~if_missing=Nothing = _ = key if_missing diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/System/File_By_Line.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/System/File_By_Line.enso index 6f99a007ec55..c0479d55cf09 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/System/File_By_Line.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/System/File_By_Line.enso @@ -56,7 +56,7 @@ type File_By_Line Arguments: - line: The line to read (0 indexed). get : Integer -> Text - get self line:Integer = if self.limit_lines.is_nothing.not && line>self.limit_lines then Error.throw (Index_Out_Of_Bounds.Error line self.limit_lines) else + get self line:Integer=0 = if self.limit_lines.is_nothing.not && line>self.limit_lines then Error.throw (Index_Out_Of_Bounds.Error line self.limit_lines) else read_line self line ## GROUP Selections @@ -207,7 +207,7 @@ type File_By_Line Exports the row_map row_positions : Vector Integer row_positions self = Vector.from_polyglot_array <| - Array_Proxy.new self.row_map.getSize (i-> self.row_map.get i) + Array_Proxy.new self.row_map.getSize (self.row_map.get _) ## PRIVATE Gets the Java_File for the backing file. diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/DB_Column.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/DB_Column.enso index b3cbe808225e..f36f63a8bfce 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/DB_Column.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/DB_Column.enso @@ -137,7 +137,7 @@ type DB_Column example_at = Examples.integer_column.at 0 at : Integer -> (Any | Nothing) ! Index_Out_Of_Bounds - at self (index : Integer) = + at self index:Integer=0 = self.get index (Error.throw (Index_Out_Of_Bounds.Error index self.length)) ## GROUP Standard.Base.Selections @@ -155,7 +155,7 @@ type DB_Column example_at = Examples.integer_column.get 0 -1 get : Integer -> Any -> Any | Nothing - get self (index : Integer) (~default=Nothing) = + get self index:Integer=0 (~default=Nothing) = self.read (..First index+1) . get index default ## GROUP Standard.Base.Metadata diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/DB_Table.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/DB_Table.enso index fc20c0536449..b0c7fe7c92d0 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/DB_Table.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/DB_Table.enso @@ -136,7 +136,7 @@ type DB_Table - selector: The name or index of the column to get. @selector Widget_Helpers.make_column_name_selector at : Text | Integer -> DB_Column ! No_Such_Column | Index_Out_Of_Bounds - at self selector=0 = case selector of + at self (selector:(Integer | Text)=0) = case selector of _ : Integer -> self.make_column (self.internal_columns.at selector) _ -> self.get selector (Error.throw (No_Such_Column.Error selector)) @@ -148,11 +148,10 @@ type DB_Table - if_missing: The value to use if the selector isn't present. @selector Widget_Helpers.make_column_name_selector get : Text | Integer -> Any -> DB_Column | Any - get self selector=0 ~if_missing=Nothing = + get self (selector:(Integer | Text)=0) ~if_missing=Nothing = internal_column = case selector of _ : Integer -> self.internal_columns.get selector if_missing=Nothing _ : Text -> self.internal_columns.find (p -> p.name == selector) if_missing=Nothing - _ -> Error.throw (Illegal_Argument.Error "expected 'selector' to be either a Text or an Integer, but got "+(Meta.get_simple_type_name selector)+".") if internal_column.is_nothing then if_missing else self.make_column internal_column ## ALIAS cell value, get cell diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso index 4e8d2bdf84d8..bd8c608455d5 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso @@ -2140,7 +2140,7 @@ type Column example_at = Examples.integer_column.at 0 @index (self-> Numeric_Input minimum=0 maximum=self.length-1) at : Integer -> (Any | Nothing) ! Index_Out_Of_Bounds - at self (index : Integer) = + at self index:Integer=0 = self.get index (Error.throw (Index_Out_Of_Bounds.Error index self.length)) ## GROUP Standard.Base.Selections @@ -2159,7 +2159,7 @@ type Column example_at = Examples.integer_column.get 0 -1 @index (self-> Numeric_Input minimum=0 maximum=self.length-1) get : Integer -> Any -> Any | Nothing - get self (index : Integer) (~default=Nothing) = + get self index:Integer=0 (~default=Nothing) = valid_index = (index >= 0) && (index < self.length) if valid_index.not then default else storage = self.java_column.getStorage @@ -2321,7 +2321,7 @@ type Column @range Index_Sub_Range.default_widget take : (Index_Sub_Range | Range | Integer) -> Column take self range=(First 1) = - Index_Sub_Range_Module.take_helper self.length self.at self.slice (slice_ranges self) range + Index_Sub_Range_Module.take_helper self.length (self.at _) self.slice (slice_ranges self) range ## ALIAS skip, remove GROUP Standard.Base.Selections @@ -2334,7 +2334,7 @@ type Column @range Index_Sub_Range.default_widget drop : (Index_Sub_Range | Range | Integer) -> Column drop self range=(First 1) = - Index_Sub_Range_Module.drop_helper self.length self.at self.slice (slice_ranges self) range + Index_Sub_Range_Module.drop_helper self.length (self.at _) self.slice (slice_ranges self) range ## PRIVATE Returns a column with a continuous sub-range of rows taken. diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Conversions/Convertible_To_Columns.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Conversions/Convertible_To_Columns.enso index 6c63fcc862d3..75cc10f2bc8c 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Conversions/Convertible_To_Columns.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Conversions/Convertible_To_Columns.enso @@ -17,7 +17,7 @@ type Convertible_To_Columns ## PRIVATE Convertible_To_Columns.from (that:JS_Object) = - Convertible_To_Columns.Value that.field_names that.get + Convertible_To_Columns.Value that.field_names (that.get _) ## PRIVATE Convertible_To_Columns.from (that:Map) = @@ -38,7 +38,7 @@ Convertible_To_Columns.from (that:Column) = ## PRIVATE Convertible_To_Columns.from (that:Row) = - Convertible_To_Columns.Value that.column_names that.get + Convertible_To_Columns.Value that.column_names (that.get _) ## PRIVATE Convertible_To_Columns.from (that:Vector) = diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Conversions/Convertible_To_Rows.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Conversions/Convertible_To_Rows.enso index 2346fabe1570..8ac248100849 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Conversions/Convertible_To_Rows.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Conversions/Convertible_To_Rows.enso @@ -33,35 +33,35 @@ Convertible_To_Rows.from that:Table = Convertible_To_Rows.from rows ## PRIVATE -Convertible_To_Rows.from that:Column = Convertible_To_Rows.Value that.length that.get +Convertible_To_Rows.from that:Column = Convertible_To_Rows.Value that.length (that.get _) ## PRIVATE -Convertible_To_Rows.from that:Vector = Convertible_To_Rows.Value that.length that.get +Convertible_To_Rows.from that:Vector = Convertible_To_Rows.Value that.length (that.get _) ## PRIVATE -Convertible_To_Rows.from that:Array = Convertible_To_Rows.Value that.length that.get +Convertible_To_Rows.from that:Array = Convertible_To_Rows.Value that.length (that.get _) ## PRIVATE Convertible_To_Rows.from that:List = Convertible_To_Rows.from that.to_vector ## PRIVATE -Convertible_To_Rows.from that:Range = Convertible_To_Rows.Value that.length that.get +Convertible_To_Rows.from that:Range = Convertible_To_Rows.Value that.length (that.get _) ## PRIVATE -Convertible_To_Rows.from that:Pair = Convertible_To_Rows.Value that.length that.get +Convertible_To_Rows.from that:Pair = Convertible_To_Rows.Value that.length (that.get _) ## PRIVATE -Convertible_To_Rows.from that:Date_Range = Convertible_To_Rows.Value that.length that.get +Convertible_To_Rows.from that:Date_Range = Convertible_To_Rows.Value that.length (that.get _) ## PRIVATE Convertible_To_Rows.from that:Map = vals = that.to_vector.map p-> Key_Value.Pair p.first p.second - Convertible_To_Rows.Value vals.length vals.get ["Key", "Value"] + Convertible_To_Rows.Value vals.length (vals.get _) ["Key", "Value"] ## PRIVATE Convertible_To_Rows.from that:JS_Object = vals = that.map_with_key k->v-> Key_Value.Pair k v - Convertible_To_Rows.Value vals.length vals.get ["Key", "Value"] + Convertible_To_Rows.Value vals.length (vals.get _) ["Key", "Value"] ## PRIVATE Convertible_To_Rows.from (that:Any) = diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Excel/Excel_Format.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Excel/Excel_Format.enso index a3c030735a5b..67de1aabec2e 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Excel/Excel_Format.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Excel/Excel_Format.enso @@ -5,7 +5,7 @@ import Standard.Base.System.File.Generic.Writable_File.Writable_File import Standard.Base.System.File_Format_Metadata.File_Format_Metadata import Standard.Base.System.Input_Stream.Input_Stream from Standard.Base.Metadata.Choice import Option -from Standard.Base.Metadata.Widget import Numeric_Input, Text_Input +from Standard.Base.Metadata.Widget import Text_Input from Standard.Base.System.File_Format import parse_boolean_with_infer import project.Excel.Excel_Range.Excel_Range diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Excel/Excel_Workbook.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Excel/Excel_Workbook.enso index 1eb4390a0bc8..638cd89f267f 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Excel/Excel_Workbook.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Excel/Excel_Workbook.enso @@ -1,4 +1,5 @@ from Standard.Base import all +import Standard.Base.Errors.Deprecated.Deprecated import Standard.Base.Errors.File_Error.File_Error import Standard.Base.Errors.Illegal_Argument.Illegal_Argument import Standard.Base.Errors.Illegal_State.Illegal_State @@ -73,13 +74,15 @@ type Excel_Workbook Creates an Excel_Workbook connection. Value (excel_connection_resource_ref : Ref (Managed_Resource ReadOnlyExcelConnection)) (file:(File|Temporary_File|Nothing)) xls_format:Boolean - ## ICON metadata + ## PRIVATE + ICON metadata Returns the list of databases (or catalogs) for the connection. databases : Nothing databases self = Nothing - ## ICON metadata - Returns the name of the current database (or catalog). + ## PRIVATE + ICON metadata + Returns the name of the current file. database : Text database self = case self.file of regular_file : File -> regular_file.path @@ -87,31 +90,34 @@ type Excel_Workbook just an implementation detail - it is coming form a stream so there is no logical file it is associated with. _ -> "" - ## ICON data_input - Returns a new Connection with the specified database set as default. + ## PRIVATE + ICON data_input + Returns a new Workbook with the specified file. Arguments: - - database: The name of the database to connect to. - @database (Single_Choice display=Display.Always values=[Option 'Nothing']) - set_database : Text -> Excel_Workbook ! Illegal_Argument + - database: The target file to open as an Excel_Workbook. + set_database : Text | File -> Excel_Workbook ! Illegal_Argument set_database self database = if database == self.database then self else file = File.new database if file.exists && file.is_directory.not then Excel_Workbook.new file self.xls_format else Error.throw (Illegal_Argument.Error "The specified file ('"+file.path+"') does not exist.") - ## ICON metadata + ## PRIVATE + ICON metadata Returns the list of schemas for the connection within the current database (or catalog). schemas : Vector (Text | Nothing) schemas self = [Nothing] - ## ICON metadata + ## PRIVATE + ICON metadata Returns the name of the current schema. schema : Text | Nothing schema self = Nothing - ## ICON data_input - Returns a new Connection with the specified schema set as default. + ## PRIVATE + ICON data_input + Returns a new Workbook with the specified schema set as default. Arguments: - schema: The name of the schema to connect to. @@ -147,12 +153,14 @@ type Excel_Workbook named_ranges self = self.with_java_workbook java_workbook-> Vector.from_polyglot_array (ExcelReader.readRangeNames java_workbook) - ## ICON metadata + ## PRIVATE + ICON metadata Gets a list of the table types. table_types : Vector Text table_types self = ['Worksheet', 'Named Range'] - ## GROUP Standard.Base.Metadata + ## PRIVATE + GROUP Standard.Base.Metadata ICON metadata Returns a materialised Table of all the matching views and tables. @@ -182,7 +190,8 @@ type Excel_Workbook Table.from_rows ['Name', 'Type', 'Database', 'Schema'] filtered - ## ICON data_input + ## PRIVATE + ICON data_input Read a range into a Table. Arguments: @@ -196,7 +205,7 @@ type Excel_Workbook _ = [alias] self.read query headers=headers - ## ALIAS range, sheet, worksheet + ## ALIAS range, sheet, worksheet, get GROUP Standard.Base.Input ICON data_input Read a range into a Table. @@ -219,7 +228,8 @@ type Excel_Workbook _ : Text -> ExcelReader.readRangeByName java_workbook query java_headers 0 java_limit java_problem_aggregator limit.attach_warning (Table.Value java_table) - ## GROUP Standard.Base.Input + ## PRIVATE + GROUP Standard.Base.Input ICON data_input Read an Excel_Section from the Workbook @@ -251,7 +261,7 @@ type Excel_Workbook _ : Text -> ExcelReader.readRangeByName java_workbook address java_headers skip_rows java_limit java_problem_aggregator row_limit.attach_warning (Table.Value java_table) - ## ALIAS get, worksheet + ## PRIVATE GROUP Standard.Base.Input ICON data_input Reads a worksheet from the workbook. @@ -263,7 +273,8 @@ type Excel_Workbook @name (self-> Single_Choice display=Display.Always values=(self.sheet_names.map t-> Option t t.pretty)) sheet : Text | Integer -> Headers -> Table sheet self name:(Text | Integer) headers:Headers=Headers.Detect_Headers = - self.read_section (Excel_Section.Worksheet name headers 0 Nothing) + Warning.attach (Deprecated.Warning "Standard.Table.Excel.Excel_Workbook.Excel_Workbook" "sheet" "Deprecated: use `read` instead.") <| + self.read_section (Excel_Section.Worksheet name headers 0 Nothing) ## PRIVATE ADVANCED diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Rows_View.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Rows_View.enso index 208bca36368e..6a261769c70a 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Rows_View.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Rows_View.enso @@ -18,4 +18,4 @@ type Rows_View ICON parse3 Gets the specified row. at : Integer -> Any - at self index = Row.Value self.table index + at self index:Integer=0 = Row.Value self.table index diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Row.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Row.enso index d918b4d53433..041b8ab03f5a 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Row.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Row.enso @@ -29,7 +29,7 @@ type Row - column: The name or index of the column being looked up. @column (self -> Widget_Helpers.make_column_name_selector self.table) at : (Integer | Text) -> Any - at self column = self.table.at column . at self.index + at self (column:(Integer | Text)=0) = self.table.at column . at self.index ## ICON parse3 Gets the value of the specified column. @@ -39,7 +39,7 @@ type Row - if_missing: The value to use if the column isn't present. @column (self -> Widget_Helpers.make_column_name_selector self.table) get : (Integer | Text) -> Any -> Any - get self column ~if_missing=Nothing = + get self (column:(Integer | Text)=0) ~if_missing=Nothing = table_column = self.table.get column case table_column of Nothing -> if_missing diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Table.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Table.enso index 87bb2017aacd..42551b4e54c2 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Table.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Table.enso @@ -245,7 +245,7 @@ type Table example_at = Examples.inventory_table.at -1 @selector Widget_Helpers.make_column_name_selector at : Text | Integer -> Column ! No_Such_Column | Index_Out_Of_Bounds - at self selector=0 = case selector of + at self (selector:(Integer | Text)=0) = case selector of _ : Integer -> java_columns = Vector.from_polyglot_array self.java_table.getColumns Column.Value (java_columns.at selector) @@ -273,11 +273,10 @@ type Table example_at = Examples.inventory_table.get -1 @selector Widget_Helpers.make_column_name_selector get : Text | Integer -> Any -> Column | Any - get self selector=0 ~if_missing=Nothing = + get self (selector:(Integer | Text)=0) ~if_missing=Nothing = java_column = case selector of _ : Integer -> Vector.from_polyglot_array self.java_table.getColumns . get selector _ : Text -> self.java_table.getColumnByName selector - _ -> Error.throw (Illegal_Argument.Error "expected 'selector' to be either a Text or an Integer, but got "+(Meta.get_simple_type_name selector)+".") if java_column.is_nothing then if_missing else Column.Value java_column ## ALIAS cell value, get cell @@ -1571,7 +1570,7 @@ type Table @range Index_Sub_Range.default_widget take : (Index_Sub_Range | Range | Integer) -> Table take self range=(First 1) = - Index_Sub_Range_Module.take_helper self.row_count self.rows.at self.slice (slice_ranges self) range + Index_Sub_Range_Module.take_helper self.row_count (self.rows.at _) self.slice (slice_ranges self) range ## ALIAS skip, remove GROUP Standard.Base.Selections @@ -1603,7 +1602,7 @@ type Table @range Index_Sub_Range.default_widget drop : (Index_Sub_Range | Range | Integer) -> Table drop self range=(First 1) = - Index_Sub_Range_Module.drop_helper self.row_count self.rows.at self.slice (slice_ranges self) range + Index_Sub_Range_Module.drop_helper self.row_count (self.rows.at _) self.slice (slice_ranges self) range ## PRIVATE Filter out all rows. diff --git a/distribution/lib/Standard/Visualization/0.0.0-dev/src/Text.enso b/distribution/lib/Standard/Visualization/0.0.0-dev/src/Text.enso index 23cf7e68ed85..5291f935dc83 100644 --- a/distribution/lib/Standard/Visualization/0.0.0-dev/src/Text.enso +++ b/distribution/lib/Standard/Visualization/0.0.0-dev/src/Text.enso @@ -31,7 +31,7 @@ get_lazy_visualization_text_window text pos size chunk_width = y_range = pos_y.up_to ((pos_y + size_y).min lines) coordinates = x_range.map (x -> y_range.map (y -> [x,y])) . flatten chunks = coordinates.map (ix -> [ix, (get_text_chunk ix)]) - active_lines = y_range.map text.lines.at + active_lines = y_range.map (text.lines.at _) max_line_length = (active_lines.map (line -> line.length)).fold 0 (l -> r -> l.max r) make_grid_visualization_response chunks lines max_line_length diff --git a/test/Table_Tests/src/Common_Table_Operations/Core_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Core_Spec.enso index 2c4d37824813..55ee1f9ebd95 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Core_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Core_Spec.enso @@ -116,8 +116,7 @@ add_specs suite_builder setup = data.table.at 100 . should_fail_with Index_Out_Of_Bounds group_builder.specify "should fail with Type Error is not an Integer or Text" <| - data.table.at (Pair.new 1 2) . should_fail_with Illegal_Argument - data.table.at (Pair.new 1 2) . catch . to_display_text . should_equal "Illegal Argument: expected 'selector' to be either a Text or an Integer, but got Pair." + Test.expect_panic_with (data.table.at (Pair.new 1 2)) Type_Error suite_builder.group prefix+"Table.get" group_builder-> data = Data.setup create_connection_fn setup.table_builder @@ -150,8 +149,7 @@ add_specs suite_builder setup = data.table.get 100 column_1 . name . should_equal "foo" group_builder.specify "should fail with Type Error is not an Integer or Text" <| - data.table.get (Pair.new 1 2) . should_fail_with Illegal_Argument - data.table.get (Pair.new 1 2) . catch . to_display_text . should_equal "Illegal Argument: expected 'selector' to be either a Text or an Integer, but got Pair." + Test.expect_panic_with (data.table.at (Pair.new 1 2)) Type_Error suite_builder.group prefix+"Table.set" group_builder-> data = Data.setup create_connection_fn setup.table_builder diff --git a/test/Table_Tests/src/Common_Table_Operations/Take_Drop_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Take_Drop_Spec.enso index 918584b17d92..47c664d17b22 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Take_Drop_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Take_Drop_Spec.enso @@ -205,8 +205,8 @@ add_specs suite_builder setup = rnd = data.table.take (Sample 3 seed=42) random_indices = [5, 6, 2] - alpha_sample = random_indices.map (data.table.at "alpha" . to_vector . at) - beta_sample = random_indices.map (data.table.at "beta" . to_vector . at) + alpha_sample = random_indices.map (data.table.at "alpha" . to_vector . at _) + beta_sample = random_indices.map (data.table.at "beta" . to_vector . at _) rnd.at "alpha" . to_vector . should_equal alpha_sample rnd.at "beta" . to_vector . should_equal beta_sample