I think I can't explain well my ideas ^^. I'll try to be really detailed so I'm not sure I'm actually saying what I'm thinking.
Let's consider the idea of that Vector class this way :
Vectors are list of a defined type (may be immutable ?) and adds sugar syntaxing for vectorized operations.
Based on this small and not complete enough definition, we should be able to apply any function to that vector.
I identify two ways functions are used with vectors : it's either applied on the vector as an iterable/list, or on the elements of this vector.
Thus, we need to be have different notations for those two uses. To keep it coherent with Python, if a functions is applied on the vector as an iterable,
the vector is given as a parameter :
>>> len(v) # Number of elements in the Vector `v`
If we want to apply a function on each element of the list, we should then use another notations. So far, several have been proposed.
In the following example showing the different notations, we use the generic way so we can apply it to user-defined functions :
>>> # Compute the length of each element of the Vector `v`
>>> v @ len
Another example with parameters
>>> # Replace all "a" by "b"
>>> v.apply(lambda s: s.replace("a", "b"))
>>> v @ (lambda s: s.replace("a", "b"))
My personal opinion is that the two notations feel good. One is standard, the other is not but is less verbose and it's a good point.
Now that I detailed everything in my brain and by mail, I guess we are just saying the same thing !
There's something I didn't mention on purpose, it's the use of : `v.lower()`
I think having special cases of how vectors works is not a good idea : it's confusing.
If we want the user to be able to use user-defined functions we need a notation. Having something different for some
of the functions feels weird to me. And obviously, if the user can't use its own functions, this whole thing is pretty useless.
Tell me if I got anything wrong.
Nb : I found a way to simplify my previous example using lambda instead of partial.