Boost logo

Boost :

From: Gustavo Guerra (gustavobt_at_[hidden])
Date: 2002-01-21 14:34:31


----- Original Message -----
From: "David Abrahams" <david.abrahams_at_[hidden]>

>
> ----- Original Message -----
> From: "vesa_karvonen" <vesa_karvonen_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Monday, January 21, 2002 1:22 PM
> Subject: [boost] Re: Comments on the preprocessor list data structure
>
>
> > --- In boost_at_y..., Douglas Gregor <gregod_at_c...> wrote:
> > > On Monday 21 January 2002 06:53 am, you wrote:
> > > > file://! Drops the first N elements of the list.
> > [...]
> > > > #define BOOST_PP_LIST_DROP(N,L)
> >
> > > "Drop" doesn't really tell us anything about what's being dropped.
> > How about
> > > using REMOVE_FIRST instead, e.g.,
> > >
> > > BOOST_PP_REMOVE_FIRST(2,BOOST_PP_TUPLE_TO_LIST(4,(+,-,*,/)))
> > >
> > > Or, perhaps, to save typing, use REMOVE1ST.
> >
> > The name "drop" is used for the same function in Haskell (and in
> > several other more or less functional languages). I agree that it may
> > sound a bit odd at first. The functions "drop" and "take" form a
> > logical couple.
> >
> > What do you think about the name "take"?
> >
> > I think that 'remove_first' certainly sounds more like STL,
> > but "drop" and "take" don't seem to have close enough relatives in
> > STL, so that the names could just be borrowed.
>
> FWIW, when I read the message I kept thinking "car" and "cdr".
>
> -Dave
>

"car" and "cdr" would only be apropriate for BOOST_PP_LIST_HEAD and
BOOST_PP_LIST_TAIL, not for BOOST_PP_LIST_TAKE and BOOST_PP_LIST_DROP. I
like DROP and TAKE.

Would prefer FIRST and REST instead of HEAD and TAIL, though.

> ----- Original Message -----
> From: "vesa_karvonen" <vesa_karvonen_at_[hidden]>
> //! Expands to the I:th element of the list L.
> /*!
> Example:
>
> BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)),1)
>
> The above expands to B.
> */
> #define BOOST_PP_LIST_AT(L,I)

Don't forget to mention that it starts at 0. Ith is a little ambiguous.

> ----- Original Message -----
> From: "vesa_karvonen" <vesa_karvonen_at_[hidden]>
> So, you like "fold_left" and "fold_right"?
>
> I considered using "accumulate" (and "reverse_accumulate"
> and "accumulate_left", etc...), but IMO it sounds way too arithmetic.
> Also "fold" is well known concept in functional programming.
> Furthermore I don't want to make it appear as if either one of the
> folds would be more primitive.

"fold_left" and "fold_right" are so much better than accumulate_xxx.
Maybe fold_l and fold_r instead?

Also, can we get a shorter preffix than BOOST_PP_LIST_xxx? Maybe
BOOST_PPL_xxx?

The change from PREPROCESSOR to PP helped a lot, but things still get too
much verbose.

Keep up the good work
Gustavo Guerra


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