Boost logo

Boost :

Subject: Re: [boost] Naming convention of iterated binary operation
From: Rob Stewart (rstewart_at_[hidden])
Date: 2016-05-02 04:20:31


On May 1, 2016 11:25:39 PM EDT, Jeremy Murphy <jeremy.william.murphy_at_[hidden]> wrote:
>Dear list entities,
>
>is there such a convention or precedent for naming an iterated binary
>operation?
>
>For example, Boost.Functional/Hash has an iterated hash() called
>hash_range(). I don't mind the "_range" suffix but I prefer the
>"iterated_"
>prefix based on the mathematical definition:
>https://en.wikipedia.org/wiki/Iterated_binary_operation
>
>The case in point is gcd() in Boost.Math: we want to provide an
>iterated gcd but we can't quite decide how to name it. I like the
>"iterated_" prefix but I would rather go with whatever might be
>the convention.

Given that the definition you linked noted only a couple of cases using different names for iterated variants and a couple of cases that use the same name as for the non-iterated function, it isn't clear that there is a case for preferring that modifier. (I'm no mathematician, so I have no experience to draw upon here.)

In C++, given overloading, it isn't necessary to use a different name for different arguments. Therefore, I wonder whether "gcd" is sufficient for the iterated case.

___
Rob

(Sent from my portable computation engine)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk