Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align Vector API with design, add some extra functions from AoC #4026

Merged
merged 46 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
ba72cb0
Vector.sort API tweak.
jdunkerley Jan 4, 2023
8eb08b7
Easier Random functions.
jdunkerley Jan 4, 2023
4d49961
Rename direction to order.
jdunkerley Jan 4, 2023
f09c5ce
Align a fair chunk of Vector, Range and List.
jdunkerley Jan 5, 2023
dc7c1c4
Changelog and fix test issues.
jdunkerley Jan 5, 2023
7a20ccc
Adding some more for Pair.
jdunkerley Jan 6, 2023
d6b5378
Add contains to Pair.
jdunkerley Jan 6, 2023
9a09295
Sort List.at and List.get.
jdunkerley Jan 6, 2023
e8dd1c3
Add back List.init.
jdunkerley Jan 6, 2023
876ca66
More aligning...
jdunkerley Jan 9, 2023
cb50552
More aligning...
jdunkerley Jan 9, 2023
263da7b
Remove static random functions.
jdunkerley Jan 9, 2023
e60d248
Fix issues.
jdunkerley Jan 9, 2023
d1e1333
Fix issues.
jdunkerley Jan 9, 2023
adb9fba
Fix most failing tests.
jdunkerley Jan 9, 2023
3a65eea
Last failing test.
jdunkerley Jan 9, 2023
11b93a9
Various new ones for Pair and Range.
jdunkerley Jan 9, 2023
f4bdf48
Some refactoring.
jdunkerley Jan 10, 2023
949d906
Completed Pair and Range alignment.
jdunkerley Jan 10, 2023
6b33f25
Add find to list and a few tuning bits.
jdunkerley Jan 10, 2023
4af89f7
Added index_of to List.
jdunkerley Jan 10, 2023
a6b3117
Added last_index_of to List.
jdunkerley Jan 10, 2023
4285e1d
Tidy examples and make aggregate work on first column by default.
jdunkerley Jan 10, 2023
60f9877
Add get, first, second, last to Text.
jdunkerley Jan 10, 2023
eb2ca95
Add get, first, second, last to Text.
jdunkerley Jan 10, 2023
f77015f
Add Map contains_key.
jdunkerley Jan 10, 2023
1c00c9d
Add ALIAS to row_count and order_by.
jdunkerley Jan 10, 2023
82e5096
Add ALIAS to row_count and order_by.
jdunkerley Jan 10, 2023
c5345f0
Fix empty edge case for last_index_of.
jdunkerley Jan 10, 2023
bcf6304
Some of Jaroslav's PR comments.
jdunkerley Jan 11, 2023
aee640d
Adjust test to show interchangeable Pairs.
jdunkerley Jan 11, 2023
9d64f2c
Tests for start.
jdunkerley Jan 11, 2023
a6c3fe7
Missing tests for List.
jdunkerley Jan 11, 2023
ce5e7a7
Fix failing Benchmark.
jdunkerley Jan 11, 2023
8ff4990
Fix failing Benchmark.
jdunkerley Jan 11, 2023
4b60fae
Ignore Range parse differences.
jdunkerley Jan 11, 2023
9918ed4
rename variables.
jdunkerley Jan 11, 2023
0be8bc7
rename variables.
jdunkerley Jan 11, 2023
1efd2e8
Stripped warnings before table visualisation.
jdunkerley Jan 11, 2023
422b373
Exclude List.enso.
jdunkerley Jan 11, 2023
58bc55a
Exclude Data/Text/Extensions.enso.
jdunkerley Jan 11, 2023
9198985
Some PR Comments.
jdunkerley Jan 12, 2023
397083e
Extra tests and error correction.
jdunkerley Jan 12, 2023
dea9055
Fix Table issue.
jdunkerley Jan 12, 2023
6398075
Merge branch 'develop' into wip/jd/aoc-minor-functions
mergify[bot] Jan 12, 2023
fff14fe
Merge branch 'develop' into wip/jd/aoc-minor-functions
mergify[bot] Jan 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@
- [Overhauled the JSON support (now based of JavaScript), `Data.fetch` and other
minor tweaks][3987]
- [Enable Date, Time and DateTime to be read and written to Excel.][3997]
- [Aligning core APIs for Vector, List and Range. Adding some missing functions
to the types.][4026]
- [Implemented `Table.distinct` for Database backends.][4027]

[debug-shortcuts]:
Expand Down Expand Up @@ -424,6 +426,7 @@
[3987]: https://github.com/enso-org/enso/pull/3987
[3997]: https://github.com/enso-org/enso/pull/3997
[4013]: https://github.com/enso-org/enso/pull/4013
[4026]: https://github.com/enso-org/enso/pull/4026
[4027]: https://github.com/enso-org/enso/pull/4027

#### Enso Compiler
Expand Down
9 changes: 5 additions & 4 deletions distribution/lib/Standard/Base/0.0.0-dev/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,21 @@ component-groups:
- Standard.Base.Data.Text.Regex.escape
- Select:
exports:
- Standard.Base.Data.Vector.Vector.tail
- Standard.Base.Data.Vector.Vector.at
- Standard.Base.Data.Vector.Vector.get
- Standard.Base.Data.Vector.Vector.filter
- Standard.Base.Data.Vector.Vector.find
- Standard.Base.Data.Vector.Vector.at
- Standard.Base.Data.Vector.Vector.take
- Standard.Base.Data.Vector.Vector.drop
- Standard.Base.Data.Vector.Vector.partition
- Standard.Base.Data.Vector.Vector.distinct
- Join:
exports:
- Standard.Base.Data.Vector.Vector.append
- Standard.Base.Data.Vector.Vector.prepend
- Standard.Base.Data.Vector.Vector.zip
- Transform:
exports:
- Standard.Base.Data.Vector.Vector.insert
- Standard.Base.Data.Vector.Vector.remove
- Standard.Base.Data.Vector.Vector.map
- Standard.Base.Data.Vector.Vector.sort
- Standard.Base.Data.Vector.Vector.distinct
Expand Down
2 changes: 1 addition & 1 deletion distribution/lib/Standard/Base/0.0.0-dev/src/Data.enso
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ fetch uri method=HTTP_Method.Get headers=[] parse=True =

if response.code.is_success.not then Error.throw (Request_Error.Error "Status Code" ("Request failed with status code: " + response.code + ". " + response.body.to_text)) else
response_headers = response.headers
content_type = response_headers.find h-> "Content-Type".equals_ignore_case h.name
content_type = response_headers.find if_missing=Nothing h-> "Content-Type".equals_ignore_case h.name
if (parse == False) || (content_type == Nothing) then response else
format = Auto_Detect.get_web_parser content_type.value uri
if format == Nothing then response else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ invert_range_selection : Vector Range -> Integer -> Boolean -> Vector Range
invert_range_selection ranges length needs_sorting =
sorted = if needs_sorting then sort_and_merge_ranges ranges else ranges
ranges_with_sentinels = [0.up_to 0] + sorted + [length.up_to length]
ranges_with_sentinels.zip ranges_with_sentinels.tail prev-> next->
ranges_with_sentinels.zip (ranges_with_sentinels.drop 1) prev-> next->
prev.end.up_to next.start

## PRIVATE
Expand All @@ -120,7 +120,7 @@ sort_and_merge_ranges ranges =
if sorted.is_empty then [] else
current_ref = Ref.new sorted.first
builder = Vector.new_builder
sorted.tail.each range->
sorted.drop 1 . each range->
current = current_ref.get
case range.start <= current.end of
True -> current_ref.put (current.start.up_to (Math.max current.end range.end))
Expand Down
8 changes: 4 additions & 4 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Data/Json.enso
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ type JS_Object
from_pairs : Vector -> JS_Object
from_pairs pairs =
js_object = pairs.fold new_object current->pair->
case pair.at 0 of
case pair.first of
text : Text ->
set_value current text (pair.at 1).to_js_object
current
js_value = pair.second.to_js_object
set_value current text js_value
_ -> Error.throw (Illegal_Argument.Error "JS_Object.from_pairs: key must be a Text value")
JS_Object.Value js_object

Expand Down Expand Up @@ -243,7 +243,6 @@ make_javascript enso_object =
value = enso_object.get key
js_value = make_javascript value
set_value current key js_value
current
_ : Vector -> enso_object.map make_javascript
_ : Array -> Vector.from_polyglot_array enso_object . map make_javascript
_ -> enso_object
Expand All @@ -265,6 +264,7 @@ foreign js get_value object key = """

foreign js set_value object key value = """
object[key] = value
return object
jdunkerley marked this conversation as resolved.
Show resolved Hide resolved

foreign js get_property_names object = """
return Object.getOwnPropertyNames(object)
Loading