|
Boost : |
Subject: Re: [boost] De Bruijn Bind (alternate bind syntax) Interest?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2010-09-05 19:56:31
On 09/04/10 13:54, David Sankel wrote:
> On Sat, Sep 4, 2010 at 10:55 AM, Larry Evans <cppljevans_at_[hidden]>wrote:
>
>> On 09/04/10 08:24, Larry Evans wrote:
>> [snip]
>>> The attached illustrates the difficulty I was having with
>>> mpl::apply. Maybe the apply_apply typedef would be a good
>>> use-case for De Bruijn's method.
>> [snip]
>> Attached is much simplified code that still illustrates problem.
>> Compile errors included:
>>
>
> Thanks for the example. If a De Bruijn indices were used, this would look
> like
>
> typedef< app< lam< app< op, _1_1 > >
> , int_<1>
> >
> >::type apply_apply;
>
Typo:
typedef<
>
> I think this is a valid example of the needlessly cryptic bind/lambda
> semantics that are widespread.
>
I tried translating the above code back to the, let's call at the
type 'universe' as opposed to the value 'universe'. I'm using
universe because that's a term used by nuprl:
http://www.cs.cornell.edu/Info/People/sfa/Nuprl/NuprlPrimitives/Xuniverse_doc.html
to describe hierarchy of types and also because the only other name I
could think of was domain, and that's used by proto and for other
reasons. Another candidate was 'kind':
http://www.haskell.org/haskellwiki/Kind
but I thought of 'universe' first and it seemed more general.
However, compiling my first try( the attached) gives:
[COMPILATION]
> make -f my-make.mk
> /home/evansl/download/gcc/4.5.1-release/install/bin/g++ -Iinclude -I/home/evansl/prog_dev/boost-svn/ro/boost_1_44_0 -std=gnu++0x src/apply_apply.cpp src/test.cpp -o bin/apply_apply.exe
> src/apply_apply.cpp: In function 'int main()':
> src/apply_apply.cpp:63:28: error: cannot convert 'App<int (*)(int), boost::fusion::vector1<int> >' to 'int' in initialization
> make: *** [bin/apply_apply.exe] Error 1
[/COMPILATION]
What am I doing wrong?
TIA.
-regards,
Larry
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk