* [ruby-core:100471] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix
@ 2020-10-21 10:07 grzegorz.jakubiak
2020-10-21 11:26 ` [ruby-core:100472] " marcandre-ruby-core
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: grzegorz.jakubiak @ 2020-10-21 10:07 UTC (permalink / raw)
To: ruby-core
Issue #17277 has been reported by greggzst (Grzegorz Jakubiak).
----------------------------------------
Feature #17277: Make Enumerator#with_index yield row and col indices for Matrix
https://bugs.ruby-lang.org/issues/17277
* Author: greggzst (Grzegorz Jakubiak)
* Status: Open
* Priority: Normal
----------------------------------------
Currently this code seems to be counting index based on the internal array of arrays and it's not correct for the matrix which should return row and col indices
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each.with_index { |e, index| print "#{index} " } ; puts
0 1 2 3 4 5 6 7 8 9 10 11
=> nil
```
I'm aware of the fact that you could do following and you get the correct results:
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each_with_index { |e, row, col| print "[#{row}, #{col}] " } ; puts
[0, 0] [0, 1] [0, 2] [0, 3] [1, 0] [1, 1] [1, 2] [1, 3] [2, 0] [2, 1] [2, 2] [2, 3]
=> nil
```
You can even chain `each_with_index` with other enumerators and access indices within them e.g.
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each_with_index.filter_map { |e, row, col| [row, col] if e % 4 == 0}
=> [[0, 0], [0, 3], [1, 2], [2, 1], [2, 3]]
```
However, I feel we should override `with_index` for Matrix so it returns row and col indices.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ruby-core:100472] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix
2020-10-21 10:07 [ruby-core:100471] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix grzegorz.jakubiak
@ 2020-10-21 11:26 ` marcandre-ruby-core
2020-10-21 12:07 ` [ruby-core:100473] " grzegorz.jakubiak
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marcandre-ruby-core @ 2020-10-21 11:26 UTC (permalink / raw)
To: ruby-core
Issue #17277 has been updated by marcandre (Marc-Andre Lafortune).
What about chained enumerators?
```ruby
matrix.each(:diagonal).each_const(2).with_index do |elem, ?|
```
It's not clear to me how that could be implemented efficiently, do you have an idea?
Finally, what is the use case?
I would rather add `map_with_index`....
----------------------------------------
Feature #17277: Make Enumerator#with_index yield row and col indices for Matrix
https://bugs.ruby-lang.org/issues/17277#change-88091
* Author: greggzst (Grzegorz Jakubiak)
* Status: Open
* Priority: Normal
----------------------------------------
Currently this code seems to be counting index based on the internal array of arrays and it's not correct for the matrix which should return row and col indices
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each.with_index { |e, index| print "#{index} " } ; puts
0 1 2 3 4 5 6 7 8 9 10 11
=> nil
```
I'm aware of the fact that you could do following and you get the correct results:
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each_with_index { |e, row, col| print "[#{row}, #{col}] " } ; puts
[0, 0] [0, 1] [0, 2] [0, 3] [1, 0] [1, 1] [1, 2] [1, 3] [2, 0] [2, 1] [2, 2] [2, 3]
=> nil
```
You can even chain `each_with_index` with other enumerators and access indices within them e.g.
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each_with_index.filter_map { |e, row, col| [row, col] if e % 4 == 0}
=> [[0, 0], [0, 3], [1, 2], [2, 1], [2, 3]]
```
However, I feel we should override `with_index` for Matrix so it returns row and col indices.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ruby-core:100473] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix
2020-10-21 10:07 [ruby-core:100471] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix grzegorz.jakubiak
2020-10-21 11:26 ` [ruby-core:100472] " marcandre-ruby-core
@ 2020-10-21 12:07 ` grzegorz.jakubiak
2020-10-22 5:30 ` [ruby-core:100492] " nobu
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: grzegorz.jakubiak @ 2020-10-21 12:07 UTC (permalink / raw)
To: ruby-core
Issue #17277 has been updated by greggzst (Grzegorz Jakubiak).
I also noticed when combining `each_with_index` with `inject` it passes `element, row_index and col_index` as one argument to the block
```ruby
Matrix[[1,2,4,5],[7,8,9,2]].each_with_index.inject({}) { |acc, e, row, col| puts "#{acc}, #{e}, #{row}, #{col}"; acc[[e[1],e[2]]] = e[0]; acc }
{}, [1, 0, 0], ,
{[0, 0]=>1}, [2, 0, 1], ,
{[0, 0]=>1, [0, 1]=>2}, [4, 0, 2], ,
{[0, 0]=>1, [0, 1]=>2, [0, 2]=>4}, [5, 0, 3], ,
{[0, 0]=>1, [0, 1]=>2, [0, 2]=>4, [0, 3]=>5}, [7, 1, 0], ,
{[0, 0]=>1, [0, 1]=>2, [0, 2]=>4, [0, 3]=>5, [1, 0]=>7}, [8, 1, 1], ,
{[0, 0]=>1, [0, 1]=>2, [0, 2]=>4, [0, 3]=>5, [1, 0]=>7, [1, 1]=>8}, [9, 1, 2], ,
{[0, 0]=>1, [0, 1]=>2, [0, 2]=>4, [0, 3]=>5, [1, 0]=>7, [1, 1]=>8, [1, 2]=>9}, [2, 1, 3], ,
=> {[0, 0]=>1, [0, 1]=>2, [0, 2]=>4, [0, 3]=>5, [1, 0]=>7, [1, 1]=>8, [1, 2]=>9, [1, 3]=>2}
```
marcandre (Marc-Andre Lafortune) wrote in #note-1:
> What about chained enumerators?
>
> ```ruby
> matrix.each(:diagonal).each_const(2).with_index do |elem, ?|
> ```
>
> It's not clear to me how that could be implemented efficiently, do you have an idea?
I tried with refinement for Enumerator in Matrix and use `each_with_index` to yield `row` and `col` index but couldn't get it working...
> Finally, what is the use case?
I would like to access matrix indices in enumerable methods to perform some operations based on them.
> I would rather add `map_with_index`....
I guess this would be helpful but I think it doesn't give enough flexibility because if you want to use `with_index` in `select` you don't need the `map` part and so on
----------------------------------------
Feature #17277: Make Enumerator#with_index yield row and col indices for Matrix
https://bugs.ruby-lang.org/issues/17277#change-88092
* Author: greggzst (Grzegorz Jakubiak)
* Status: Open
* Priority: Normal
----------------------------------------
Currently this code seems to be counting index based on the internal array of arrays and it's not correct for the matrix which should return row and col indices
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each.with_index { |e, index| print "#{index} " } ; puts
0 1 2 3 4 5 6 7 8 9 10 11
=> nil
```
I'm aware of the fact that you could do following and you get the correct results:
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each_with_index { |e, row, col| print "[#{row}, #{col}] " } ; puts
[0, 0] [0, 1] [0, 2] [0, 3] [1, 0] [1, 1] [1, 2] [1, 3] [2, 0] [2, 1] [2, 2] [2, 3]
=> nil
```
You can even chain `each_with_index` with other enumerators and access indices within them e.g.
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each_with_index.filter_map { |e, row, col| [row, col] if e % 4 == 0}
=> [[0, 0], [0, 3], [1, 2], [2, 1], [2, 3]]
```
However, I feel we should override `with_index` for Matrix so it returns row and col indices.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ruby-core:100492] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix
2020-10-21 10:07 [ruby-core:100471] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix grzegorz.jakubiak
2020-10-21 11:26 ` [ruby-core:100472] " marcandre-ruby-core
2020-10-21 12:07 ` [ruby-core:100473] " grzegorz.jakubiak
@ 2020-10-22 5:30 ` nobu
2020-10-22 6:02 ` [ruby-core:100493] " grzegorz.jakubiak
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: nobu @ 2020-10-22 5:30 UTC (permalink / raw)
To: ruby-core
Issue #17277 has been updated by nobu (Nobuyoshi Nakada).
Assignee set to marcandre (Marc-Andre Lafortune)
Status changed from Open to Assigned
----------------------------------------
Feature #17277: Make Enumerator#with_index yield row and col indices for Matrix
https://bugs.ruby-lang.org/issues/17277#change-88111
* Author: greggzst (Grzegorz Jakubiak)
* Status: Assigned
* Priority: Normal
* Assignee: marcandre (Marc-Andre Lafortune)
----------------------------------------
Currently this code seems to be counting index based on the internal array of arrays and it's not correct for the matrix which should return row and col indices
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each.with_index { |e, index| print "#{index} " } ; puts
0 1 2 3 4 5 6 7 8 9 10 11
=> nil
```
I'm aware of the fact that you could do following and you get the correct results:
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each_with_index { |e, row, col| print "[#{row}, #{col}] " } ; puts
[0, 0] [0, 1] [0, 2] [0, 3] [1, 0] [1, 1] [1, 2] [1, 3] [2, 0] [2, 1] [2, 2] [2, 3]
=> nil
```
You can even chain `each_with_index` with other enumerators and access indices within them e.g.
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each_with_index.filter_map { |e, row, col| [row, col] if e % 4 == 0}
=> [[0, 0], [0, 3], [1, 2], [2, 1], [2, 3]]
```
However, I feel we should override `with_index` for Matrix so it returns row and col indices.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ruby-core:100493] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix
2020-10-21 10:07 [ruby-core:100471] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix grzegorz.jakubiak
` (2 preceding siblings ...)
2020-10-22 5:30 ` [ruby-core:100492] " nobu
@ 2020-10-22 6:02 ` grzegorz.jakubiak
2020-10-22 15:16 ` [ruby-core:100507] " sawadatsuyoshi
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: grzegorz.jakubiak @ 2020-10-22 6:02 UTC (permalink / raw)
To: ruby-core
Issue #17277 has been updated by greggzst (Grzegorz Jakubiak).
greggzst (Grzegorz Jakubiak) wrote in #note-2:
> I also noticed when combining `each_with_index` with `inject` it passes `element, row_index and col_index` as one argument to the block
>
> ```ruby
> Matrix[[1,2,4,5],[7,8,9,2]].each_with_index.inject({}) { |acc, e, row, col| puts "#{acc}, #{e}, #{row}, #{col}"; acc[[e[1],e[2]]] = e[0]; acc }
> {}, [1, 0, 0], ,
> {[0, 0]=>1}, [2, 0, 1], ,
> {[0, 0]=>1, [0, 1]=>2}, [4, 0, 2], ,
> {[0, 0]=>1, [0, 1]=>2, [0, 2]=>4}, [5, 0, 3], ,
> {[0, 0]=>1, [0, 1]=>2, [0, 2]=>4, [0, 3]=>5}, [7, 1, 0], ,
> {[0, 0]=>1, [0, 1]=>2, [0, 2]=>4, [0, 3]=>5, [1, 0]=>7}, [8, 1, 1], ,
> {[0, 0]=>1, [0, 1]=>2, [0, 2]=>4, [0, 3]=>5, [1, 0]=>7, [1, 1]=>8}, [9, 1, 2], ,
> {[0, 0]=>1, [0, 1]=>2, [0, 2]=>4, [0, 3]=>5, [1, 0]=>7, [1, 1]=>8, [1, 2]=>9}, [2, 1, 3], ,
> => {[0, 0]=>1, [0, 1]=>2, [0, 2]=>4, [0, 3]=>5, [1, 0]=>7, [1, 1]=>8, [1, 2]=>9, [1, 3]=>2}
> ```
>
My bad I just figured out that's a case for `inject` so it shouldn't be considered in this discussion.
Anyways it'd be good to have `with_index` chained to whatever enumerator returning Matrix indices
----------------------------------------
Feature #17277: Make Enumerator#with_index yield row and col indices for Matrix
https://bugs.ruby-lang.org/issues/17277#change-88112
* Author: greggzst (Grzegorz Jakubiak)
* Status: Assigned
* Priority: Normal
* Assignee: marcandre (Marc-Andre Lafortune)
----------------------------------------
Currently this code seems to be counting index based on the internal array of arrays and it's not correct for the matrix which should return row and col indices
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each.with_index { |e, index| print "#{index} " } ; puts
0 1 2 3 4 5 6 7 8 9 10 11
=> nil
```
I'm aware of the fact that you could do following and you get the correct results:
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each_with_index { |e, row, col| print "[#{row}, #{col}] " } ; puts
[0, 0] [0, 1] [0, 2] [0, 3] [1, 0] [1, 1] [1, 2] [1, 3] [2, 0] [2, 1] [2, 2] [2, 3]
=> nil
```
You can even chain `each_with_index` with other enumerators and access indices within them e.g.
```
Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]].each_with_index.filter_map { |e, row, col| [row, col] if e % 4 == 0}
=> [[0, 0], [0, 3], [1, 2], [2, 1], [2, 3]]
```
However, I feel we should override `with_index` for Matrix so it returns row and col indices.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ruby-core:100507] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix
2020-10-21 10:07 [ruby-core:100471] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix grzegorz.jakubiak
` (3 preceding siblings ...)
2020-10-22 6:02 ` [ruby-core:100493] " grzegorz.jakubiak
@ 2020-10-22 15:16 ` sawadatsuyoshi
2020-10-30 10:07 ` [ruby-core:100666] " grzegorz.jakubiak
2020-12-16 15:47 ` [ruby-core:101467] " marcandre-ruby-core
6 siblings, 0 replies; 8+ messages in thread
From: sawadatsuyoshi @ 2020-10-22 15:16 UTC (permalink / raw)
To: ruby-core
Issue #17277 has been updated by sawa (Tsuyoshi Sawada).
I think the current behaviour is natural. You cannot play around with `with_index` since its receiver is `Enumerator`, not `Matrix`, and the information as a matrix is already gone.
You can retrieve the row and column indices easily from the flattened indices:
```ruby
m.each.with_index{|e, index| p index.divmod(m.column_size)}
[0, 0]
[0, 1]
[0, 2]
[0, 3]
[1, 0]
[1, 1]
[1, 2]
[1, 3]
[2, 0]
[2, 1]
[2, 2]
[2, 3]
```
----------------------------------------
Feature #17277: Make Enumerator#with_index yield row and col indices for Matrix
https://bugs.ruby-lang.org/issues/17277#change-88130
* Author: greggzst (Grzegorz Jakubiak)
* Status: Assigned
* Priority: Normal
* Assignee: marcandre (Marc-Andre Lafortune)
----------------------------------------
Given a matrix:
```ruby
matrix = Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]]
```
You could get the row and col indices of a matrix using `Matrix#each_with_index`:
```ruby
matrix
.each_with_index { |e, row, col| p [row, col] }
[0, 0]
[0, 1]
[0, 2]
[0, 3]
[1, 0]
[1, 1]
[1, 2]
[1, 3]
[2, 0]
[2, 1]
[2, 2]
[2, 3]
```
You can chain it with other enumerators and access indices within them:
```ruby
matrix
.each_with_index
.filter_map { |e, row, col| [row, col] if e % 4 == 0}
# => [[0, 0], [0, 3], [1, 2], [2, 1], [2, 3]]
```
Meanwhile, `with_index` after `Matrix#each` returns flattened indices, not row or column indices, which does not look right:
```ruby
matrix
.each.with_index { |e, index| p index }
0
1
2
3
4
5
6
7
8
9
10
11
```
I feel we should override `with_index` for `Matrix` so it returns row and column indices.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ruby-core:100666] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix
2020-10-21 10:07 [ruby-core:100471] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix grzegorz.jakubiak
` (4 preceding siblings ...)
2020-10-22 15:16 ` [ruby-core:100507] " sawadatsuyoshi
@ 2020-10-30 10:07 ` grzegorz.jakubiak
2020-12-16 15:47 ` [ruby-core:101467] " marcandre-ruby-core
6 siblings, 0 replies; 8+ messages in thread
From: grzegorz.jakubiak @ 2020-10-30 10:07 UTC (permalink / raw)
To: ruby-core
Issue #17277 has been updated by greggzst (Grzegorz Jakubiak).
sawa (Tsuyoshi Sawada) wrote in #note-7:
> I think the current behaviour is natural. You cannot play around with `with_index` since its receiver is `Enumerator`, not `Matrix`, and the information as a matrix is already gone.
>
> You can retrieve the row and column indices easily from the flattened indices:
>
> ```ruby
> matrix.each.with_index{|e, index| p index.divmod(matrix.column_size)}
> [0, 0]
> [0, 1]
> [0, 2]
> [0, 3]
> [1, 0]
> [1, 1]
> [1, 2]
> [1, 3]
> [2, 0]
> [2, 1]
> [2, 2]
> [2, 3]
> ```
I get that but it means performing divmod calculation every time one needs to work row and col indices out. Couldn’t we maybe return a subclass of Enumerator that implements proper with_index for Matrix?
----------------------------------------
Feature #17277: Make Enumerator#with_index yield row and col indices for Matrix
https://bugs.ruby-lang.org/issues/17277#change-88307
* Author: greggzst (Grzegorz Jakubiak)
* Status: Assigned
* Priority: Normal
* Assignee: marcandre (Marc-Andre Lafortune)
----------------------------------------
Given a matrix:
```ruby
matrix = Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]]
```
You could get the row and col indices of a matrix using `Matrix#each_with_index`:
```ruby
matrix
.each_with_index { |e, row, col| p [row, col] }
[0, 0]
[0, 1]
[0, 2]
[0, 3]
[1, 0]
[1, 1]
[1, 2]
[1, 3]
[2, 0]
[2, 1]
[2, 2]
[2, 3]
```
You can chain it with other enumerators and access indices within them:
```ruby
matrix
.each_with_index
.filter_map { |e, row, col| [row, col] if e % 4 == 0}
# => [[0, 0], [0, 3], [1, 2], [2, 1], [2, 3]]
```
Meanwhile, `with_index` after `Matrix#each` returns flattened indices, not row or column indices, which does not look right:
```ruby
matrix
.each.with_index { |e, index| p index }
0
1
2
3
4
5
6
7
8
9
10
11
```
I feel we should override `with_index` for `Matrix` so it returns row and column indices.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ruby-core:101467] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix
2020-10-21 10:07 [ruby-core:100471] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix grzegorz.jakubiak
` (5 preceding siblings ...)
2020-10-30 10:07 ` [ruby-core:100666] " grzegorz.jakubiak
@ 2020-12-16 15:47 ` marcandre-ruby-core
6 siblings, 0 replies; 8+ messages in thread
From: marcandre-ruby-core @ 2020-12-16 15:47 UTC (permalink / raw)
To: ruby-core
Issue #17277 has been updated by marcandre (Marc-Andre Lafortune).
Status changed from Assigned to Closed
Closing for lack of a viable solution
----------------------------------------
Feature #17277: Make Enumerator#with_index yield row and col indices for Matrix
https://bugs.ruby-lang.org/issues/17277#change-89242
* Author: greggzst (Grzegorz Jakubiak)
* Status: Closed
* Priority: Normal
* Assignee: marcandre (Marc-Andre Lafortune)
----------------------------------------
Given a matrix:
```ruby
matrix = Matrix[[0,2,3,4], [6,7,8,9], [1,4,5,8]]
```
You could get the row and col indices of a matrix using `Matrix#each_with_index`:
```ruby
matrix
.each_with_index { |e, row, col| p [row, col] }
[0, 0]
[0, 1]
[0, 2]
[0, 3]
[1, 0]
[1, 1]
[1, 2]
[1, 3]
[2, 0]
[2, 1]
[2, 2]
[2, 3]
```
You can chain it with other enumerators and access indices within them:
```ruby
matrix
.each_with_index
.filter_map { |e, row, col| [row, col] if e % 4 == 0}
# => [[0, 0], [0, 3], [1, 2], [2, 1], [2, 3]]
```
Meanwhile, `with_index` after `Matrix#each` returns flattened indices, not row or column indices, which does not look right:
```ruby
matrix
.each.with_index { |e, index| p index }
0
1
2
3
4
5
6
7
8
9
10
11
```
I feel we should override `with_index` for `Matrix` so it returns row and column indices.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-12-16 15:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 10:07 [ruby-core:100471] [Ruby master Feature#17277] Make Enumerator#with_index yield row and col indices for Matrix grzegorz.jakubiak
2020-10-21 11:26 ` [ruby-core:100472] " marcandre-ruby-core
2020-10-21 12:07 ` [ruby-core:100473] " grzegorz.jakubiak
2020-10-22 5:30 ` [ruby-core:100492] " nobu
2020-10-22 6:02 ` [ruby-core:100493] " grzegorz.jakubiak
2020-10-22 15:16 ` [ruby-core:100507] " sawadatsuyoshi
2020-10-30 10:07 ` [ruby-core:100666] " grzegorz.jakubiak
2020-12-16 15:47 ` [ruby-core:101467] " marcandre-ruby-core
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).