On Friday, 6 August 2021 at 15:59:27 UTC-7 Kwankyu Lee wrote:
> On Saturday, August 7, 2021 at 5:47:54 AM UTC+9 Nils Bruin wrote:
>
>> So how bad would it be to potentially double the number of vector spaces
>> in existence by giving them an extra parameter determining whether fresh
>> vectors (such as those resulting from vector arithmetic) should be mutable
>> or not.
>>
>
> Having vector.immutable() method that returns the same vector but set
> immutable would be a simpler solution for your annoyance. No?
>
I don't think so. Between writing imm(v+w) and (v+w).immutable() I think
the first version is much easier to write. However, the real annoyance is
coming from the fact that what I would write every time is a dictionary
like { v+w : ... } and every time it will cost me getting an error message
before I correct it to { imm(v+w): ...}.
With an option on the parent, it would cost me one error message in the
session before I change the parent construction to
V=VectorSpace(k,n, immutable_vectors=True)
and then I'm good for the rest of the session. I've been sceptical about
such an option before and for library use I don't think it's such a big
deal, but I've now encountered in real life an interactive scenario where
it's super-annoying. It seriously made me consider moving the computation
over to magma, where hashing sums of vectors is no problem at all (the
syntax for associative arrays is a little less convenient, though...).
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sage-devel/dec531dd-a8a6-47b7-8739-7a39104b6e33n%40googlegroups.com.