Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2008-03-18 11:59:01

On 03/18/08 10:30, Eric Niebler wrote:
> Larry Evans wrote:
>> On 03/17/08 23:45, Larry Evans wrote:
>>> On 03/17/08 17:55, Eric Niebler wrote:
>>>> Larry Evans wrote:
>>>>> Me too!
>>>> I couldn't tell from your email -- what are you me too-ing?
>>> flattening a sequence of binary operators into one list
>>> with a tag indicating the operator to be applied between
>>> elements in the list.
> See my reply to Markus. Use proto::flatten() and proto::unpack_expr().

OK. Thanks.

>> And also the means for simplifying an expression somewhat
>> like described by Markus:
>>> I want to detect simultaneous occurences of
>>> x and -x and have them dropped from the typelist of my sum.
>> Use case1:
>> translating a grammar expression:
>> x | x
>> to:
>> x
>> Use case2:
>> Step 1:
>> translating grammar expression:
>> A | B
>> to an expression representing if it can derive empty
>> string:
>> empty<A> | empty<B>
>> which, if A is a the epsilon symbol then emptt<A> == true_
>> and the whole expression simplifies to:
>> true_
> These are domain-specific use cases. The code for that belongs in your
> DSEL, not in Proto.

OK. But so is:

   -x + x -> 0

   0 + x -> x

domain specific, which is what Markus was asking for.
Now I could just translate:

   Empty( A | B ) -> Empty<A> * Empty<B>
   Empty(grammar_terminal) -> 1
   Empty(epsilon) -> 0

and I've got what I want and it's in the domain Markus was talking
about. So, if you do it for the arith domain (Markus'), then
you'd have to have a set of "simplification rule" for that
domain. Replace the simplification rules for arith domain
with simplification rules for domain X, where X is
boolean expressions or grammar expressions or some other
domain, and you've generalized what you can simplify.

My point was that If you can do it for Markus' domain, then
you can to it for domain X. IOW, provide a set of simplification
rules for a particular domain.

Maybe the next version? ;)

Boost list run by bdawes at, gregod at, cpdaniel at, john at