You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For now there's no way to match on iteraters the same way we do with Lists, and I reckon it would be useful as it can drastically simplify the way people work with iterators.
So ideally it would be something like this:
match [1,2,3].iter() {
1 ~> 2 ~> rest {
// rest is a iterator here.
}
End {
}
}
The text was updated successfully, but these errors were encountered:
I am aware that this is a performance penalty as bascially we need to store what the underlying algorithm produces to make an iterator peekable. But still, I would argue this provides a unified iterface across data structures.
We can have some other data structures and retain the original iterator, so if user want a fast implementation, they choose Iter, and if they want something more fancy, they can choose PatIter
Indeed an external iterator implementation would be very handy. I suggest starting with a prototype package on https://mooncakes.io, and if it turns out useful enough, we may consider moving it to moonbitlang/xor moonbitlang/core, and add pattern match support to it.
For now there's no way to match on iteraters the same way we do with Lists, and I reckon it would be useful as it can drastically simplify the way people work with iterators.
So ideally it would be something like this:
The text was updated successfully, but these errors were encountered: