AbstractAlgebra.jl icon indicating copy to clipboard operation
AbstractAlgebra.jl copied to clipboard

Use `getindex` for vector creation

Open albinahlback opened this issue 8 months ago • 4 comments

Now ZZ[1, 2, 3, 4] should create a vector. Still allows for getting generators via S[i]. Will be overloaded with specific methods since this is very generic.

Solves #2052

albinahlback avatar Apr 03 '25 13:04 albinahlback

Isn't R[1] ambiguous? And what about R[:x]?

thofma avatar Apr 03 '25 13:04 thofma

Isn't R[1] ambiguous?

Yes, but it will always default to gens(R, 1).

And what about R[:x]?

It will still work as VarName is stricter than Any.

albinahlback avatar Apr 03 '25 13:04 albinahlback

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 88.36%. Comparing base (2479164) to head (acc4fd3). :warning: Report is 120 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2053   +/-   ##
=======================================
  Coverage   88.36%   88.36%           
=======================================
  Files         125      125           
  Lines       31551    31552    +1     
=======================================
+ Hits        27880    27881    +1     
  Misses       3671     3671           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Apr 03 '25 13:04 codecov[bot]

Isn't R[1] ambiguous?

Yes, but it will always default to gens(R, 1).

It is still very unintuitive for users. And as far as I can see, the syntax does not allow to create singleton vectors. (What about empty vectors?)

lgoettgens avatar Apr 15 '25 10:04 lgoettgens

Thank you @albinahlback . If we started from scratch, I'd like to have this; but due to the history and existing features, unfortunately this is not something we feel we should add to Nemo.

Note that one can do ZZ.([1,2,3,4]) which is slightly less efficient and slightly longer but for interactive use hopefully "good enough".

fingolfin avatar Oct 29 '25 10:10 fingolfin