Boost logo

Boost :

Subject: Re: [boost] De Bruijn Bind (alternate bind syntax) Interest?
From: David Sankel (camior_at_[hidden])
Date: 2010-09-04 22:23:30


On Sat, Sep 4, 2010 at 2:53 PM, Manjunath Kudlur <keveman_at_[hidden]> wrote:

> > //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?
>

Yes, thanks to Bekič's theorem (I don't have a good reference but here is
one[1] that leads to more.)

[1] http://www.haskell.org/pipermail/haskell-cafe/2007-March/023585.html

-- 
David Sankel
Sankel Software
www.sankelsoftware.com
585 617 4748 (Office)

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk