core icon indicating copy to clipboard operation
core copied to clipboard

iterator/loop utils function for ArrayView

Open Yoorkin opened this issue 1 year ago • 0 comments

  • ArrayView::iter
  • Do we need fold_left fold_right and each for 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[_] 
  }
}

Yoorkin avatar Jul 10 '24 05:07 Yoorkin