Inspect.Algebra.fold_doc
You're seeing just the function
fold_doc
, go back to Inspect.Algebra module for more information.
Specs
Folds a list of documents into a document using the given folder function.
The list of documents is folded "from the right"; in that, this function is
similar to List.foldr/3
, except that it doesn't expect an initial
accumulator and uses the last element of docs
as the initial accumulator.
Examples
iex> docs = ["A", "B", "C"]
iex> docs =
...> Inspect.Algebra.fold_doc(docs, fn doc, acc ->
...> Inspect.Algebra.concat([doc, "!", acc])
...> end)
iex> Inspect.Algebra.format(docs, 80)
["A", "!", "B", "!", "C"]