Re:Swift Algorithms
by Kednicma on Wednesday October 07, 2020 @09:04PM
(#24714608)
Worse nomenclature than any other big language I can think of, including Go and Python. Why should this package be called "algorithms"?
[ Parent
| on HN ]
Re:Swift Algorithms
by iainmerrick on Wednesday October 07, 2020 @09:29PM
(#24714733)
C++ has similar nomenclature - - the std::algorithms library has generic functions for working with collections: https://en.cppreference.com/w/cpp/algorithm
Whether C++ is a good model to follow is another question entirely, of course! But at least Swift isn’t being completely idiosyncratic in its naming choices.
Huh? It sounds like it shouldn't be called anything BUT algorithms. It implements standard generic algorithms for various operations. The kinds you'd be asked about in an algorithmic test, learn in algorithms 101, and so on.
Of course technically any part of a program is an algorithm, but usually (like here) we reserve the name for general things like here (from path and graph to partition and search algorithms), not for our "business logic" algorithm.
Re:Swift Algorithms
by summerlight on Wednesday October 07, 2020 @10:13PM
(#24714944)
These functions are designed to be highly generic so can be used as building blocks for many other more specific algorithms while it is not specifically tied to other concepts like container or iterator. Do you have any concise alternatives that reflect these properties?
I agree this is a poor use of namespace. Python has that in itertools, Numpy has combinatorics and random sampling
in numpy.random. Maybe they just planned to stop here? Or the algorithm namespace is bound to become overcrowded.
Re:Swift Algorithms
by happytoexplain on Wednesday October 07, 2020 @10:36PM
(#24715068)
>a new open-source package of sequence and collection algorithms, along with their related types.
This is exactly what algorithms are at the level of almost any language's included libraries. The name seems spot on.