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

Missing brackets when printing a function with iterated sublist access #5109

Closed
zickgraf opened this issue Oct 13, 2022 · 3 comments · Fixed by #5116
Closed

Missing brackets when printing a function with iterated sublist access #5109

zickgraf opened this issue Oct 13, 2022 · 3 comments · Fixed by #5116
Labels
kind: bug Issues describing general bugs, and PRs fixing them priority: low

Comments

@zickgraf
Copy link
Contributor

Observed behaviour

gap> Display( x -> ([ 1 ]{[ 1 ]}){[ 1 ]} );
function ( x )
    return [ 1 ]{[ 1 ]}{[ 1 ]};
end

Expected behaviour

gap> Display( x -> ([ 1 ]{[ 1 ]}){[ 1 ]} );
function ( x )
    return ([ 1 ]{[ 1 ]}){[ 1 ]};
end

The brackets are important because [ 1 ]{[ 1 ]}{[ 1 ]} is interpreted as a submatrix access (which seems to be undocumented).

Copy and paste GAP banner (to tell us about your setup)

 ┌───────┐   GAP 4.13dev-45-g9f1d31c-dirty built on 2022-09-26 11:44:24+0200
 │  GAP  │   https://www.gap-system.org
 └───────┘   Architecture: x86_64-pc-linux-gnu-default64-kv8
 Configuration:  gmp 6.2.1, GASMAN, readline
 Loading the library and packages ...
 Packages:   GAPDoc 1.dev, IO 4.7.0dev, PrimGrp 3.4.0, SmallGrp 1.4.1, TransGrp 2.0.5
 Try '??help' for help. See also '?copyright', '?cite' and '?authors'
@fingolfin
Copy link
Member

I agree this is a bug.

The behaviour of [ 1 ]{[ 1 ]}{[ 1 ]} is documented here.

@fingolfin fingolfin added kind: bug Issues describing general bugs, and PRs fixing them priority: low labels Oct 13, 2022
@fingolfin
Copy link
Member

I think fixing this may be quite tricky. At the same time, it doesn't seem very important -- AFAIK we don't make any promises that functions can be round tripped by parsing their printed version (and indeed, in general this is not possible due to closures). I realize it may be important to you, all I want to convey here is that I wouldn't hold my breath for this to be fixed.

@zickgraf
Copy link
Contributor Author

The behaviour of [ 1 ]{[ 1 ]}{[ 1 ]} is documented here.

Thanks for the hint! I couldn't find it previously and have created #5114.

I think fixing this may be quite tricky.

I gave this a shot in #5116.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Issues describing general bugs, and PRs fixing them priority: low
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants