Full functoids

In the previous versions (prior to v1.5) of the FC++ library, to define a (say, 2-argument) functoid of your own, you would just say

   struct MyFunctoid {
      // Sig information
      // operator(x,y) definition
   } myFunctoid;
You would probably also choose to add currying capabilities by wrapping your functoids like so:
   struct MyFunctoid {
      // Sig information
      // operator(x,y) definition
   };
   Curryable2<MyFunctoid> myFunctoid;

Now with v1.5 of the library, we introduce a new type of wrapper called "full" functoids. Full functoids wrap existing functoids with all of the v1.5 library functionality, namely:

To define a full functoid, do the following
   namespace impl {
      struct XMyFunctoid {
         // Sig information
         // operator(x,y) definition
      };
   }
   typedef Full2<impl::XMyFunctoid> MyFunctoid;
   MyFunctoid myFunctoid;
The FullN wrappers work just like the CurryableN wrappers. (The introduction of the namespace and the typedef are not strictly necessary, but using this idiom ensures that the C++ type of someFunctoid is always just SomeFunctoid (and not, say, Full3<SomeFunctoid> or Curryable2<SomeFunctoid> or whatever). Throughout the library implementation we use this idiom to create a simple way to name the C++ types of functoids.)

While wrapping your functoids in the FullN wrappers is considered optional, we recommend that you wrap all of your functoids this way. Non-wrapped functoids will not be curryable, cannot participate fully in lambda expressions, cannot use infix syntax, and cannot be used with some of the library combinators.

For more details about the implementation of these features, inspect the code in full.h, smart.h, and curry.h.



Last updated on Oct 03, 2003 by Brian McNamara