
On 09/20/10 10:43, David Sankel wrote: [snip]
The z function in the example is a weird beast. I gave it a trivial implementation:
struct Z2 { typedef int result_type; template < typename F, typename G > int operator()( F f , G g ) const { return 3; };
} const z2 = Z2();
To make a non-trivial implementation of z, you could use the fact that its first argument has kind * → *. That is, its first argument must be a function from something to something. Its second argument has kind ((* → *) → *) → *). That is, its second argument must be a function that takes in a function as its first parameter that takes in a function as its first parameter. A fun mind bender :).
David
Thanks David. On reason I got interested in wiki is because I was having problems doing it for types instead of values. This type de_bruijn code is here: http://svn.boost.org/svn/boost/sandbox/variadic_templates/libs /mpl/sandbox/de_bruijn/eval.cpp As indicated by the Status: comment, I'm having some problems. I just thought I'd upload it in case anyone else has some idea where I'm going wrong. I'll look at your code, with the modifications you suggest above, to see if that'll give me some ideas. BTW, the context in your value de_bruijn looks like the args in my type de_bruijn. IOW, it keeps track of the current args and the depth in the expression tree. I have yet figured out what any further comparision between the value and type de_bruijn are, but I'd be curious. -regards, Larry