Worst Phobos documentation evar!

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 31 15:42:04 PST 2014


On Wed, 31 Dec 2014 15:26:04 -0800
Walter Bright via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> On 12/31/2014 2:28 PM, ketmar via Digitalmars-d wrote:
> > i can do Ddoc myself, i just can't read the result.
> 
> 
> 
> /****************************
> This function does blah, blah, blah.
> 
> Blah, blah, blah is an amazing algorithm invented by I. M. Nerdly.
> 
> Params:
>     x = the awesome input value
> 
> Returns:
>     insightful description of the return value
> 
> Example:
> ---
> int foo(int x) { ... stunning D code ... }
> ---
> ***************************/
> 

Implements the homonym function (also known as $(D accumulate), $(D
compress), $(D inject), or $(D foldl)) present in various programming
languages of functional flavor. The call $(D reduce!(fun)(seed,
range)) first assigns $(D seed) to an internal variable $(D result),
also called the accumulator. Then, for each element $(D x) in $(D
range), $(D result = fun(result, x)) gets evaluated. Finally, $(D
result) is returned. The one-argument version $(D reduce!(fun)(range))
works similarly, but it uses the first element of the range as the
seed (the range must be non-empty).

'cmon, wtf all that $(XXX) crap is? and with capitals, which distracts
from the actual text. ah, the following is even better:


$(BOOKTABLE Cheat Sheet,
$(TR $(TH Function Name) $(TH Description)
)
$(LEADINGROW Searching
)
$(TR $(TDNW $(LREF all)) $(TD $(D all!"a > 0"([1, 2, 3, 4])) returns $(D true) because all elements are positive)
)
$(TR $(TDNW $(LREF any)) $(TD $(D any!"a > 0"([1, 2, -3, -4])) returns $(D true) because at least one element is positive)
)
$(TR $(TDNW $(LREF balancedParens)) $(TD $(D
balancedParens("((1 + 1) / 2)")) returns $(D true) because the string
has balanced parentheses.)
)
$(TR $(TDNW $(LREF boyerMooreFinder)) $(TD $(D find("hello
world", boyerMooreFinder("or"))) returns $(D "orld") using the $(LUCKY
Boyer-Moore _algorithm).)
)
$(TR $(TDNW $(LREF canFind)) $(TD $(D canFind("hello world",
"or")) returns $(D true).)
)
$(TR $(TDNW $(LREF count)) $(TD Counts elements that are equal
to a specified value or satisfy a predicate. $(D count([1, 2, 1], 1))
returns $(D 2) and $(D count!"a < 0"([1, -3, 0])) returns $(D 1).)
)
$(TR $(TDNW $(LREF countUntil)) $(TD $(D countUntil(a, b))
returns the number of steps taken in $(D a) to reach $(D b); for
example, $(D countUntil("hello!", "o")) returns $(D 4).)
)
$(TR $(TDNW $(LREF commonPrefix)) $(TD $(D commonPrefix("parakeet",
"parachute")) returns $(D "para").)
)

this goes on and on and on. this is just a line noise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150101/a3a945fe/attachment.sig>


More information about the Digitalmars-d mailing list