ck/fenwick▲toc

Fenwick tree

.

type fenwickck/fenwick/fenwick: (H, V) -> V<h,a>

Add a value to an element. The first element is at position 1 (1-based). Raise an exception if index <= 0 or index > f.sizeck/fenwick/size: forall<a,h> (f : fenwick<h,a>) -> <div,read<h>> int.

Return the sum from the first element to the end-th element (inclusive). The first element is at position 1 (1-based). For convenience, return 0 if end = 0. Raise an exception if end < 0 or end > f.sizeck/fenwick/size: forall<a,h> (f : fenwick<h,a>) -> <div,read<h>> int.

private import std/core/typesstd/core/types, std/core/hndstd/core/hnd, std/core/exnstd/core/exn, std/core/boolstd/core/bool, std/core/orderstd/core/order, std/core/charstd/core/char, std/core/intstd/core/int, std/core/vectorstd/core/vector, std/core/stringstd/core/string, std/core/sslicestd/core/sslice, std/core/liststd/core/list, std/core/maybestd/core/maybe, std/core/maybe2std/core/maybe2, std/core/eitherstd/core/either, std/core/tuplestd/core/tuple, std/core/lazystd/core/lazy, std/core/showstd/core/show, std/core/debugstd/core/debug, std/core/delayedstd/core/delayed, std/core/consolestd/core/console, std/corestd/core, std/num/int64std/num/int64, std/core/undivstd/core/undiv, std/core/unsafestd/core/unsafe, ck/algebra/monoidck/algebra/monoid