//Purpose:
//  Test the De Bruijn code, after translation to
//  value 'universe' (as opposed to mpl's type 'universe')
//  posted here:
//
//    http://lists.boost.org/Archives/boost/2010/09/170606.php
//
#include "DeBruijnBind.hpp"
/*********************/
/* type 'universe':
#include <boost/mpl/int.hpp>
  //
  //mpl code:
  //
    using namespace boost::mpl;
    
        typedef 
      next< _1>
    op
    ;
        typedef
      apply
      < apply
        < op
        , _1
        >
      , int_<1>
      >::type
    apply_apply
    //This fails to compile.
    ;
  //
  // in DeBruijn notation
  // (slightly modified from the post
  // referenced in the Purpose:):
  //

         typedef
        app
        < lam
          < app
            < op
            , _1_1 
            > 
          >
        , int_<1>
        >::type 
     apply_apply
     ; 
*/
/*********************/
// value 'universe':
int next( int a )
{
    return a+1;
}

int main()
{
    auto op = lam<1>( app(next,_1_1 ) );
    auto lam_app = lam<1>( app(op,_1_1));
  #if 1
    int result = app(next,1);
  #else
    int result = app(lam_app,1);
  #endif
    return result;
}    
