Boost logo

Boost :

Subject: Re: [boost] Assign V2 - first impression
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2011-06-24 14:55:29


er wrote:
> On 6/24/11 2:17 PM, Stewart, Robert wrote:
> > er wrote:
>
> >> Map 1, 10, 100, and 1000 by function f,
> >> which yields f( 1 ), f( 10 ), f( 100 ), f( 1000 )
> >> and insert each, n times, using push_front, in cont.
[snip]
> > IOW, something more like the following would suit me better:
> >
> > Insert elements in cont, using push_front(), where the
> > values are generated by calling f() n times with 1, 10,
> > 100, and 1000, in turn.
>
> Thanks for trying to get to the bottom of it. I agree that the
> wording in English might call for Insert in the beginning. But
> the actual sequence of events is like this:

The English description, as I understood what you were proposing, is an introduction to the example code. It should be about the desired outcome, not the sequence of actions or its efficiency. It is something of a motivating statement.

> Each of x = 1, ..., 1000 is forwarded to a data-generator, f.
> The result of f( x ), which I call y, is forwarded to a
> modifier which, here, executes:
> repeat n times { cont.push_front( y ); }

That's reasonable to describe what the example code actually does, but it shouldn't be the example's introduction.

> The sequence matters, because f( x ) is computed only once,
> which is the most efficient way.

That's good to point out, but not in the example's introduction.

> I use the words data-generator & modifier to be consistent with
> the naming conventions of the library. To be clear, the data-
> generator's job is to map arguments to a suitable data-element.
> The modifier's job is to insert that element (n times, in this
> case).

That's good, but only to describe the example code, not to introduce it.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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