|
Boost : |
Subject: Re: [boost] De Bruijn Bind (alternate bind syntax) Interest?
From: Manjunath Kudlur (keveman_at_[hidden])
Date: 2010-09-04 14:53:30
> //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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk