dotProduct and sum unification

Idan Arye via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 8 16:38:47 PDT 2014


On Monday, 8 September 2014 at 17:02:21 UTC, Andrei Alexandrescu 
wrote:
> On 9/8/14, 2:58 AM, Ilya Yaroshenko wrote:
>> + std.numeric.normalize
>
> One issue with std.numeric is it's rather disorganized - a grab 
> bag of vaguely "numeric" stuff. However std.algorithm also 
> includes stuff that's arguably numeric, e.g. min and max etc. I 
> think the right way is to let the existing stuff be and improve 
> the organization of std.numeric.
>
> Andrei

Not only numeric stuff - I'd argue that `levenshteinDistance` and 
`balancedParens` belong to `std.string`.


Most of the stuff `std.algorithm` are building blocks for 
algorithms - things that you never need to explain when writing 
pseudo-code because they are so trivial, like "iterate in 
decreasing order over the elements of that array that are not 
members of that set".

But somehow other stuff found it's place into `std.algorithm` - 
actual algorithms like `sum` or `levenshteinDistance`. These are, 
indeed, "algorithms", but that doesn't mean they should be in 
`std.algorithm` - if we used that logic Phobos would have been 
composed of two giant modules, `std.algorithm` and `std.type`...


More information about the Digitalmars-d mailing list