Skip to content

Commit d6ad55f

Browse files
authored
Merge pull request #4859 from tihiyn/4654
feat(#4654): separated `mapped` from `list`
2 parents c011fb5 + b34e3d1 commit d6ad55f

File tree

6 files changed

+36
-26
lines changed

6 files changed

+36
-26
lines changed

eo-runtime/src/main/eo/org/eolang/ss/list.eo

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
+alias org.eolang.ss.reducedi
33
+alias org.eolang.ss.reduced
44
+alias org.eolang.ss.eachi
5-
+alias org.eolang.ss.mappedi
65
+alias org.eolang.tt.sprintf
76
+architect yegor256@gmail.com
87
+home https://github.com/objectionary/eo
@@ -49,14 +48,6 @@
4948
back
5049
origin.length.minus index
5150

52-
# Map without index. Here "func" must be an abstract
53-
# object with one free attribute, for the element
54-
# of the collection.
55-
[func] > mapped
56-
mappedi > @
57-
^
58-
func item > [item idx] >>
59-
6051
# For each collection element dataize the object
6152
# Here "func" must be an abstract object with
6253
# one free attribute, the element of the collection.
@@ -331,15 +322,6 @@
331322
* 4 0
332323
* 7 3
333324

334-
# Tests that mapping without index transforms elements correctly.
335-
[] +> tests-simple-list-mapping
336-
eq. > @
337-
mapped.
338-
list
339-
* 1 2 3
340-
x.times 2 > [x]
341-
* 2 4 6
342-
343325
# Tests that iterating over elements without index access works correctly.
344326
[] +> tests-iterates-with-each
345327
eq. > @

eo-runtime/src/main/eo/org/eolang/ss/map.eo

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
+alias org.eolang.ss.hash-code-of
22
+alias org.eolang.ss.list
3+
+alias org.eolang.ss.mapped
34
+alias org.eolang.tt.sprintf
45
+architect yegor256@gmail.com
56
+home https://github.com/objectionary/eo
@@ -65,12 +66,12 @@
6566
entries.length > size
6667
# Returns `list` of all keys in hash map.
6768
# Keys order is not guaranteed.
68-
mapped. > keys
69+
mapped > keys
6970
list entries
7071
entry.key > [entry]
7172
# Returns `list` of all values in hash map.
7273
# Values order is not guaranteed.
73-
mapped. > values
74+
mapped > values
7475
list entries
7576
entry.value > [entry]
7677

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
+alias org.eolang.ss.list
2+
+alias org.eolang.ss.mappedi
3+
+architect yegor256@gmail.com
4+
+home https://github.com/objectionary/eo
5+
+package org.eolang.ss
6+
+version 0.0.0
7+
+spdx SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com
8+
+spdx SPDX-License-Identifier: MIT
9+
10+
# Map `lst` without index. Here "func" must be an abstract
11+
# object with one free attribute, for the element
12+
# of the collection.
13+
[lst func] > mapped
14+
mappedi > @
15+
lst
16+
func item > [item idx] >>
17+
18+
# Tests that mapping without index transforms elements correctly.
19+
[] +> tests-simple-list-mapping
20+
eq. > @
21+
mapped
22+
list
23+
* 1 2 3
24+
x.times 2 > [x]
25+
* 2 4 6

eo-runtime/src/main/eo/org/eolang/ss/set.eo

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
+alias org.eolang.ss.list
22
+alias org.eolang.ss.map
3+
+alias org.eolang.ss.mapped
34
+architect yegor256@gmail.com
45
+home https://github.com/objectionary/eo
56
+package org.eolang.ss
@@ -13,11 +14,10 @@
1314
[lst] > set
1415
initialized > @
1516
map
16-
list
17-
lst
18-
.mapped
17+
mapped
18+
list
19+
lst
1920
map.entry item true > [item]
20-
.origin
2121

2222
# Initialized set with rebuilt unique sequence.
2323
[mp] > initialized

eo-runtime/src/main/eo/org/eolang/tt/contains-all.eo

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
+alias org.eolang.tt.contains
22
+alias org.eolang.ss.list
33
+alias org.eolang.ss.reduced
4+
+alias org.eolang.ss.mapped
45
+architect yegor256@gmail.com
56
+home https://github.com/objectionary/eo
67
+package org.eolang.tt
@@ -11,7 +12,7 @@
1112
# Checks if `text` contains all elements from `substrings`
1213
[text substrings] > contains-all
1314
reduced > @
14-
mapped.
15+
mapped
1516
substrings
1617
contains text-bts x > [x] >>
1718
true

eo-runtime/src/main/eo/org/eolang/tt/contains-any.eo

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
+alias org.eolang.tt.contains
22
+alias org.eolang.ss.list
33
+alias org.eolang.ss.reduced
4+
+alias org.eolang.ss.mapped
45
+architect yegor256@gmail.com
56
+home https://github.com/objectionary/eo
67
+package org.eolang.tt
@@ -11,7 +12,7 @@
1112
# Checks if `text` contains any element from `substrings`
1213
[text substrings] > contains-any
1314
reduced > @
14-
mapped.
15+
mapped
1516
substrings
1617
contains text-bts x > [x] >>
1718
false

0 commit comments

Comments
 (0)