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

released EO-hamcrest 0.3.2 and EO-collections 0.0.8 and EO-strings 0.2.0 #116

Merged
merged 6 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions make/jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ SOFTWARE.
<version>1.0-SNAPSHOT</version>
<properties>
<eo.version>0.29.1</eo.version>
<stack-size>32M</stack-size>
</properties>
<build>
<plugins>
Expand All @@ -40,6 +41,12 @@ SOFTWARE.
<target>8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xss${stack-size}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.eolang</groupId>
<artifactId>eo-maven-plugin</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions objects/org/eolang/collections/bytes-as-array.eo
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

+home https://github.com/objectionary/eo-collections
+package org.eolang.collections
+rt jvm org.eolang:eo-collections:0.0.6
+version 0.0.6
+rt jvm org.eolang:eo-collections:0.0.8
+version 0.0.8

[b] > bytes-as-array
slice-byte > @
Expand Down
166 changes: 134 additions & 32 deletions objects/org/eolang/collections/list.eo
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

+home https://github.com/objectionary/eo-collections
+package org.eolang.collections
+rt jvm org.eolang:eo-collections:0.0.6
+version 0.0.6
+rt jvm org.eolang:eo-collections:0.0.8
+version 0.0.8

[arr] > list
arr > @
Expand All @@ -50,36 +50,29 @@
# of the array.
[a f] > reducedi
if. > @
eq.
0
length.
arr
arr.length.eq 0
a
rec-reduced
* a 0
f
arr

[acc-index func carr] > rec-reduced
acc-index.at 0 > acc
acc-index.at 1 > index
seq > @
func > new-acc!
acc
if. > @
eq.
index.plus 1 > next-index
carr.length
func > new-acc
acc-index.at 0
index
carr.at index
if.
(index.plus 1).eq (carr.length)
new-acc
rec-reduced
*
func
acc
index
carr.at index
index.plus 1
func
carr
rec-reduced
*
new-acc
next-index
func
carr

# Reduce from start "a" using the function "f"
[a f] > reduced
Expand Down Expand Up @@ -124,7 +117,7 @@
TRUE

# Create a new list without the i-th element
[i] > without
[i] > withouti
^.reducedi > @
*
[a idx item]
Expand All @@ -133,6 +126,16 @@
a
a.with item

[x] > without
list > @
^.reduced
*
[acc item]
if. > @
x.eq item
acc
acc.with item

# Equal to another object?
[x] > eq
if. > @
Expand All @@ -149,7 +152,6 @@
x.at idx
FALSE

# Returns the combined current and passed arrays
[passed] > concat
reduced. > @!
list
Expand All @@ -159,8 +161,8 @@
a.with x > @

# Returns index of the first particular item in list.
# If the list has no this item, found returns -1
[wanted] > found
# If the list has no this item, index-of returns -1
[wanted] > index-of
^.reducedi > @
-1
[acc i item]
Expand All @@ -175,6 +177,27 @@
i
acc.plus 0

# Returns index of the last particular item in list.
# If the list has no this item, last-index-of returns -1
[wanted] > last-index-of
^.reducedi > @
-1
[acc i item]
if. > @
eq.
item
wanted
i
acc.plus 0

# TRUE if the list contain x. Otherwise, "false".
[x] > contains
not. > @
eq.
-1
^.index-of
x

# Returns a new list sorted via lt method
[] > sorted
reducedi. > res!
Expand All @@ -185,13 +208,13 @@
memory 0 > i
memory 0 > j
while. > sorting-process!
i.lt (res.length)
(i.plus 1).lt (res.length)
[iter-i]
seq > @
j.write 0
i.write (i.plus 1)
while.
(j.plus 1).lt (res.length)
(j.plus 2).lt (res.length)
[iter-j]
seq > @
if.
Expand Down Expand Up @@ -222,7 +245,6 @@
# one for the element, the second one
# for the index. The result of dataization
# the "f" should be boolean, that is TRUE or FALSE.

[f] > filteredi
if. > @
eq.
Expand Down Expand Up @@ -259,12 +281,92 @@

# Filter list without index with the function "f".
# Here "f" must be an abstract object
# with one attribute for the element.
# with one attribute for the element.
# The result of dataization the "f"
# should be boolean, that is TRUE or FALSE.

[f] > filtered
^.filteredi > @
[item index]
&.f > @
item
item

[f] > inflated
rec-inflated > @
list
arr
0
f

[a i func] > rec-inflated
func > result!
a
i
if. > @
is-empty.
list
result
a
rec-inflated
list
concat.
list
a
result
plus.
i
1
func

# Get the first i-th elements from
# the start of the list
[i] > head
i > index!

if. > @
index.lte 0
list *
if.
index.gte (^.length)
^
^.reducedi
list *
[acc idx item]
if. > @
idx.gte index
acc
acc.with item

# Get the last i-th elements from
# the end of the list
[i] > tail
minus. > start!
arr.length
i
if. > @
start.lt 0
^
^.reducedi
list *
[acc idx item]
if. > @
gte.
idx
start
acc.with item
acc

# TRUE if the current list is lexicographically
# greater than the passed list. Otherwise, FALSE.
[other] > gt

# TRUE if the current list is lexicographically
# greater than or equal to the passed list. Otherwise, FALSE.
[other] > gte

# TRUE if the current list is lexicographically
# less than the passed list. Otherwise, FALSE.
[other] > lt

# TRUE if the current list is lexicographically
# less than or equal to the passed list. Otherwise, FALSE.
[other] > lte
18 changes: 15 additions & 3 deletions objects/org/eolang/collections/map.eo
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@
+alias org.eolang.math.number
+home https://github.com/objectionary/eo-collections
+package org.eolang.collections
+rt jvm org.eolang:eo-collections:0.0.6
+version 0.0.6
+rt jvm org.eolang:eo-collections:0.0.8
+version 0.0.8

[m] > map

memory 0 > elements-amount

# Returns list of all keys in multimap
Expand All @@ -41,6 +40,19 @@
[curr]
curr.at 0 > @

# TRUE if the map contain key. Otherwise, FALSE.
[key] > contains-key
reduced. > @
keys.
^
FALSE
[a x]
or. > @
a
eq.
x
key

# Returns amount of elements in multimap
[] > size
elements-amount > @
Expand Down
7 changes: 3 additions & 4 deletions objects/org/eolang/collections/multimap.eo
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
+alias org.eolang.math.number
+home https://github.com/objectionary/eo-collections
+package org.eolang.collections
+rt jvm org.eolang:eo-collections:0.0.6
+version 0.0.6
+rt jvm org.eolang:eo-collections:0.0.8
+version 0.0.8

[m] > multimap

memory 0 > elements-amount

# Returns list of all keys in multimap
Expand Down Expand Up @@ -183,7 +182,7 @@
x.at 1
a

[harr arr] > rebuild /array
[harr arr] > rebuild /tuple

# Returns a new map, without elements with the given key
# Returns the map itself, if there was no item with this key
Expand Down
Loading