[Proto] lambda functions with named variables
Dear all,
I am thinking of having creatures like
lam(x)(x + 2)
in my code which would be the Haskell equivalent for
\x -> x + 2.
In fact, I am working in an untyped world (with very limited functionality) and my typical lambda expressions would only include (function) applications, (lambda) abstractions, and let-bindings. It is exactly for the existence of let-bindings that I guess I can't resort to placeholders like:
template<int> placeholder;
const terminal
On 11/1/2010 12:59 PM, Manjunath Kudlur wrote:
2) To provide a map-like container in which I can store things like boost::any objects. OK, maybe this is not for Proto to address but though it might still have something to offer...
Have you checked out Boost.Fusion map or vector for this purpose?
Second this. You do *not* want to use boost::any for this as you will
lose all type safety and optimization opportunities. Here's the basic
strategy:
Define tags like this:
template<typename T>
struct arg_ { typedef T type; };
template<typename T>
struct arg
: proto::terminal
Hi Manjunath,
2) To provide a map-like container in which I can store things like boost::any objects. OK, maybe this is not for Proto to address but though it might still have something to offer...
Have you checked out Boost.Fusion map or vector for this purpose?
Not really. So, is there any reason what you would recommend that? TIA, --Hossein
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 11/3/2010 11:59 AM, Hossein Haeri wrote:
Hi Manjunath,
2) To provide a map-like container in which I can store things like boost::any objects. OK, maybe this is not for Proto to address but though it might still have something to offer...
Have you checked out Boost.Fusion map or vector for this purpose?
Not really. So, is there any reason what you would recommend that?
Did you see my elaboration on this idea? http://lists.boost.org/boost-users/2010/11/63833.php - -- Eric Niebler BoostPro Computing http://www.boostpro.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJM0ZCVAAoJEAeJsEDfjLbXSeUIAItrR/TUFdSTq4ZOIHztDTkJ 53H9n7jlQ9KYjBRwXat1EMXdKjdlK3ZTsCLtPiVUXiLrYZzNh+xGfAdoohWMUXUc O2p2OQBBtnvszJMP42j/QW58jsKI68ti9heUJyfLES8ddnp0ocWBdoZYLKrMTJCu QGNfBZJU7ylXK4i5/8AdFTpAN3nvnFPeCbS0BYdD7EqFsB+k63xRMNj+TwmAMM0N cXRlpKYkKLilkbfeTWQ+gOqzr4liFnPxTwCkEJSo+67vYSPUjFh0babdfo6fzgwK KsPeLV0e0YEPiMOTOI8Rq7ECpGvhqhM/H5JkK/6/IMrh+n2/UwneZ21HX//7mXc= =SjCa -----END PGP SIGNATURE-----
Dear Eric,
Have you checked out Boost.Fusion map or vector for this purpose?
Not really. So, is there any reason what you would recommend that?
Did you see my elaboration on this idea? http://lists.boost.org/boost-users/2010/11/63833.php
Yes, but, in fact, you're too quick for me. I've only started to read about Proto. So, there are lots of points in your code that I don't understand. I'm gradually going through the Proto documentation only in my spare time. I see your code -- as well as the other friend here at Boost -- suggest checking Fusion vectors. That's piles onto my stack and I'll get there soon I hope. I thought, in the mean time, you might provide some shortcuts for my journey to the heart of Fusion. And, that's the reason why I asked what's so special about them (for my application)? And, BTW, thank you very much for your cool cpp-next articles. So inspiring... :) TTFN, --Hossein
participants (3)
-
Eric Niebler
-
Hossein Haeri
-
Manjunath Kudlur