
On 9/5/10 2:07 AM, David Sankel wrote:
On Fri, Sep 3, 2010 at 11:13 PM, Joel de Guzman <joel@boost-consulting.com>wrote:
On 9/4/2010 10:40 AM, David Sankel wrote:
Your lambda uses brackets and I'm assuming this is for sequencing zero argument procedures.
Yeah. It's use and syntax is historical. The intent is to be as close as possible to C++ and to somehow emulate C++ statements. It is used that way, e.g.:
if_(c) [ dothis() ] .else_ [ dothat() ]
It's not only for the sake of being clever. More importantly, C++ users connect to this easily compared to other concocted means. It is instantly recognizable.
I think there's virtue in using syntactic sugar to expose a lambda calculus engine in a way that resembles C++ code.
My focus for DBB is to create a powerful, yet simple, engine that, among other things, others can build syntax sugar on top of -- whether that be a C++ resembling lambda syntax or functional reactive programming syntax.
As an aside, I taught a fork of DBB a new trick today, fix[1]. This enables one to declare recursive functions like factorial and fib. With some syntax sugar this could be quite nifty:
//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'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
Rockin! David, I am very interested with what you are doing. I love fine-grained elements that compose well into very powerful constructs. Phoenix happens to be designed with that in mind and I believe your ideas can be incorporated into phoenix without disrupting the higher level (sugar and all) interfaces that are in place. So, instead of having yet another bind library, why don't you just work on phoenix-3 with your ideas? I am very open to new ideas. Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net