core
core copied to clipboard
iterator/loop utils function for ArrayView
- ArrayView::iter
- Do we need
fold_leftfold_rightandeachfor ArrayView?
A real world example:
pub fn separate(sep : Document, docs : Array[Document]) -> Document {
let cat_by_sep = fn(l,r) { concat(l,concat(sep, r)) }
match docs {
[] => empty()
[x,.. as xs] => xs.fold_left(cat_by_sep, init=x) // fail, the type of xs is ArrayView[_]
}
}