Explorer

core.list-fold

description
Fold a list of T from the left into a value of A, starting from init. T and A are type arguments
type
Fn(
  T: Type,
  A: Type,
  reducer: Fn(acc: Param("A"), item: Param("T")) -> Param("A"),
  init: Param("A"),
  xs: List<Param("T")>
) -> Param("A")
expression
fn(T$0, A$1, reducer$2, init$3, xs$4) =>
  @core.list-fold-inner(
    T: $0,
    A: $1,
    reducer: fn(acc$5, item$6) =>
      $2(acc: $5, item: $6),
    xs: $4,
    start: 0,
    end: @core.list-length(value: $4),
    acc: $3
  )
visibility
public
core.list-fold (project definy, branch auto-release, snapshot oiQgPqhJm-TbM4kexXeRHBaJB_tS7gwBSewII64P-44)
id: K_mmTOWzhknK2olseENNVk-qrgrNItcrMW464gfTBy0
content hash: D12LIYE4DX2UNXAs-RyRdvwaP4B5MT9Rzz6IfivCY7c