On Sun, Aug 14, 2011 at 12:44 PM, Yitzchak Gale <gale@sefer.org> wrote:
Malcolm Wallace wrote:
> For instance, although I can guess at "sconcat", what semantics is "replicate1p" supposed to have?

A semigroup is just an associative operator.

sconcat is analogous to mconcat, providing a potentially optimized traversal over a non-empty list. Not necessarily in theory, but in practice quite useful.

replicate1p needs to be renamed, but it repeats an element (n + 1) times using peasant multiplication, taking advantage of the associativity to get away with using (<>) only log n times.

replicate1p 0 a = a
replicate1p 1 a = a <> a
replicate1p 3 a = (a <> a) <> (a <> a)

etc.

I am happy to spend some time working on the documentation.

-Edward