4 ms·
A slice is a pointer + a length. Zip takes two iterators and gives an iterator that returns pairs of elements from each of them. For an imperative translation
by steveklabnik 10y ago
A slice is a pointer + a length. Zip takes two iterators and gives an iterator that returns pairs of elements from each of them.
For an imperative translation see https://www.reddit.com/r/programming/comments/5fpghn/zerocost_abstractions/dam19ax/?st=iw5lpml6&sh=4c17bb07 https://www.reddit.com/r/programming/comments/5fpghn/zerocos...
Doing an exact translation to C is hard. The C that does the same thing, or C that demonstrates these abstractions that are boiling away?
- kutkloon7 10y agoThe thing with C is also that it's hard to do metaprogramming. Example, I have some finite element code that ideally, I would like to run for an arbitrary dimension. In C, this is practically impossible to code efficiently, while in C++ (and I suppose in Rust) I belive this can be done with templates (though I have not too much experience with this).