
//llam → lazy lambda is only evaluated when needed //_a_b → the b argument of the a nested lambda //_a → the a nested lambda
auto fact = iff( _1_1 == 1 , 1 , llam( _2_1 * _2( _2_1 - 1 ) ) )
⇒ syntax sugar traslated to fix
fix( lam( lam( iff( _1_1 == 1 , 1 , llam( _2_1 * _3_1( _2_1 - 1 ) ) ) ) ) );
I am not sure if this is entirely relevant, but there was a discussion on boost::proto list about defining mutually recursive lambdas : http://www.mail-archive.com/proto@lists.boost.org/msg00074.html I haven't gone through all the discussion on this thread, but the recursive definition of "fact" caught my eye. Can this be used for mutually recursive functions as well? Manjunath
I'm also pretty confidant I can make the evaluator do tail call optimization
[1] http://en.wikipedia.org/wiki/Fixed_point_combinator [2] http://en.wikipedia.org/wiki/Tail_call#Tail_call_optimization
-- David Sankel Sankel Software www.sankelsoftware.com 585 617 4748 (Office) _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost