leanprover / lean4

Lean 4 programming language and theorem prover
https://lean-lang.org
Apache License 2.0
4.75k stars 427 forks source link

feat: upstream definition of Vector from Batteries #6197

Closed kim-em closed 4 days ago

kim-em commented 5 days ago

This PR upstreams the definition of Vector from Batteries, along with the basic functions.

leanprover-community-bot commented 5 days ago

Mathlib CI status (docs):

tydeu commented 4 days ago

Out of curiosity, is the plan to eventually have a native implementation of Vector (since it can be more efficiently represented than an Array)?

nomeata commented 4 days ago

Out of curiosity, is the plan to eventually have a native implementation of Vector (since it can be more efficiently represented than an Array)?

Can it? You still need the length information at runtime for things like compactification

digama0 commented 4 days ago

Indeed. You need the capacity at runtime for GC to work correctly, although you could drop the length field at the cost of making push a major performance footgun.