Re: [proto] fold_tree and grammar using external_transforms and state
Le 27/07/2012 08:11, Eric Niebler a écrit : You mean, a proto callable that wraps fusion::transform? No, we don't have one yet. If you write one, I'll put it in proto. OK Naming is becoming an issue, though. We already have proto::transform. You'd be adding proto::functional::transform that would be totally unrelated. I think I screwed up with the namespaces. It should probably be proto::functional::fusion::transform. Urg. Well, I guess this is a breaking change :s What I need is maybe more generic as I need to apply an arbitrary function with arbitrary number of parmaeters, the first beign the flattened tree, the others begin whatever: transform( f, [a b c d], stuff, thingy ) = [f(a,stuff,thingy) f(b,stuff,thingy) f(c,stuff,thingy)] I'll try and ake it works out of the box first and see how it can be generalized. ___ proto mailing list proto@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/proto
Re: [proto] fold_tree and grammar using external_transforms and state
On 7/27/2012 12:19 AM, Joel Falcou wrote: Le 27/07/2012 08:11, Eric Niebler a écrit : Naming is becoming an issue, though. We already have proto::transform. You'd be adding proto::functional::transform that would be totally unrelated. I think I screwed up with the namespaces. It should probably be proto::functional::fusion::transform. Urg. Well, I guess this is a breaking change :s I could import the existing stuff into proto::functional for back-compat. What I need is maybe more generic as I need to apply an arbitrary function with arbitrary number of parmaeters, the first beign the flattened tree, the others begin whatever: transform( f, [a b c d], stuff, thingy ) = [f(a,stuff,thingy) f(b,stuff,thingy) f(c,stuff,thingy)] Seems to me you want to be able to bind the 2nd and 3rd arguments to f so that you can do this with a standard transform. transform( [a b c], bind(f, _1, stuff, thingy) ) = [f(a,stuff,thingy) f(b,stuff,thingy) f(c,stuff,thingy)] I'll try and ake it works out of the box first and see how it can be generalized. I'll take transform and bind if you write them. :-) -- Eric Niebler BoostPro Computing http://www.boostpro.com ___ proto mailing list proto@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/proto
Re: [proto] fold_tree and grammar using external_transforms and state
Yeah i figured the code was amiss. After corrections and using your tip, it works. The I discovered it was not what I wanted ;) What I actually need to do is that when I encounter a bunch of bitwise_and_ node, I need to flatten them then pass this flattened tree + the initial tuple to the equivalent of fusion transform that will do: skeleton_grammar(current, current value from state, current external_transforms) I guess proto::functional::transform is not there and need to be done by hand ? ___ proto mailing list proto@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/proto