Re: .enumerate, thanks for the clarification. Btw I wonder if there should be a public .generateIndices. A user of multi-list may want the indices for assignment:
for index in ml.indices
ml[index] = .foo(ml[index])
# or
for index in ml.indices
ml[index] = ml[index].bar
Re: numpy speed, it probably gets an initial boost from being compiled C code, but then gets a drag from operating with the Python interpreter. My guess is that micro-benchmarks on mult-lists/arrays will be faster in numpy, but that in practice, the Cobra applications would be faster.
Re: LINQ, it is not yet available, though we have some similar extension methods on IEnumerable and IList, as well as list comprehensions, so the demand has not been very high. I am aware of the need to support LINQ in the long term and it's fairly high in my priorities.
Re: LINQ syntax, I'm really glad to hear someone else say that they don't like the syntax mixing in C# as I've always felt this way as well. Re: Cobra we'll start with things like picking up C# extension methods (Cobra currently only picks up its own), lambda arg type inference, etc. and see how we like the result. If Cobra does add syntactic sugar for LINQ, I would prefer something that can work with the extension methods such that they receive uniform treatment.
Re: zip with a selector function, I also noticed that .NET/LINQ has one, but Python does not. Did the .NET guys think it was valuable for performance or something? It doesn't seem strictly necessary.
Re: arrays vs. lists, they both share a common ancestor: IList<of T>. However, the Cobra compiler does not currently recognize this for arrays because when I enable that, problems with method overload resolution create false compilation errors. This is my top priority after the 0.9 release.
For now, I suggest using IList<of T> everywhere and live with the list comprehensions for now. When I fix the method overload resolution, I will fix the array+IList relationship and we can revisit comprehensions.
Re: Python's treatment of:
- Code: Select all
ml[a:b][c:d][e:f]
ml[a:b, c:d, e:f]
You said that it treats them both the same. I was guessing that maybe the first line is 3 calls and the 2nd is one call. But you're saying they are both one call? And do these call __slice__ or what? I forget.
Re: operator overloading, I'm sad to report that this does not work so well with generic classes. This appears to be a fundamental limitation of .NET generics. See https://www.google.com/search?q=C%23+op ... g+generics
Consider in your example "_data[i] + other._data[i]" where each operand is of type T. At compile-time, it is unknown if T is an int, decimal, float64, another MultiList, a vector, etc. So the compiler cannot know what code to generate.
We might be able to overcome this problem with some compile-time extra code gen and some warnings about cons that result, but that's a whole other project. Believe me, I've thought about this issue and it's not trivial.
Re: your "oper []" examples, they don't show a difference between getting and setting.