VariadicFunctoidsInCpp is the extension of FunctoidsInCpp (FC++) using VariadicTemplates available as VariadicTemplatesForGnuCpp in current versions of GnuCpp using -std=c++0x - See CeePlusPlusEleven.
This can now be further developed using other facilities in CeePlusPlusEleven.
This extends FunctoidsInCpp so that functoids in FC++ which take two arguments e.g. plus(X,Y) can be extended so that the equivalent in VFC++ is plusN(X,Y,Z) which can have any number of arguments up to an implementation limit.
The design principle of this has been interoperability with FC++ so that only those functoids which need redefinition need to be implemented.
When I started this work the implementation of variadic templates was only just becoming available, but since gcc 4.4.0 it is part of the -std=c++0x implementation. See GnuCpp.
I am now also using Clang (CeeLanguageFamilyFrontEnd) as the compiler.
I am working on some examples including something for the examples in ListComprehension.
Here is one following the most complicated example using a combination of VFC++ to generate the tuple and FC++ for all the rest. The return object 'ltiii' is a list of tuples of three integers.
*n*, can be included in lambda expressions.
I am evaluating this work in relation to DecouplingOfObjectOrientedSystems by JensColdewey. I was unaware of his work when I wrote the modifications which linked together two different libraries in CeePlusPlus.
-- JohnFletcher

CategoryCpp CategoryCppTemplates CategoryFunctionalProgramming

ltiii = lambda(N) [compM<ListM>() [ variadic_fcpp::makeTupleN[A,B,C] | A<= enumFromTo [ 1, N ], B<= enumFromTo [ 1, N %fcpp::minus% A %fcpp::plus% 1 ], C<= enumFromTo [ 1, N %fcpp::minus% A %fcpp::minus% B %fcpp::plus% 2] , guard[fcpp::logicalAnd [fcpp::lessEqual[A %fcpp::plus% B %fcpp::plus% C,N] , fcpp::equal[ fcpp::plus[ fcpp::multiplies[ A, A ] , fcpp::multiplies [ B, B ] ], fcpp::multiplies[ C, C ] ] ] ] ] ] ] ] (100);That is rather a mouthful and I have been working to be able to incorporate the 'on the fly' lambda functions of the BoostLambdaLibrary into VFC++. I have now succeeded in doing this and the result is like this.

int n = 100; List<int> a = enumFromTo(1,n); List<int> b = enumFromTo(1,n); List<int> c = enumFromTo(1,n); ltiii = listSomethingGN(boostll_to_fun3(_1 + _2 + _3 <= n && _1*_1 + _2*_2 == _3*_3 ),a,b,c);This returns the same list. One thing has been lost, which the ability to make the lists interactive as they have to be defined externally. The function call 'listSomethingGN' is a VFC++ functoid which takes the guard expression first, followed by a variable number of lists. It then enumerates all combinations of one item from each list for which the guard expression is true. Note: The BoostLambdaLibrary uses a maximum of three placeholders. In addition, variables, here for example

CategoryCpp CategoryCppTemplates CategoryFunctionalProgramming

View edit of April 2, 2012 or FindPage with title or text search