Boost logo

Boost :

Subject: [boost] [mpl]haskell-like list comprehension
From: Larry Evans (cppljevans_at_[hidden])
Date: 2009-10-01 13:13:54


A recent post about variadic fusion:

   http://article.gmane.org/gmane.comp.lib.boost.devel/194407

contained, in the test driver attachment, a pair of templates:

   test
   test_impl

These two templates were used to, in effect, test a cross product from
the domains {0...24,0...24}. This was a use-case for
something like haskell's list comprehension:

   http://www.haskell.org/haskellwiki/List_comprehension

There's now a prototype of an mpl list_comprehension class
in the boost vault:

   http://www.boostpro.com/vault/index.php?directory=variadic_templates&

the output from the file is:

{ 9000, 9010, 9020}
{ 9000, 9010, 9021}
{ 9000, 9011, 9020}
{ 9000, 9011, 9021}
{ 9000, 9012, 9020}
{ 9000, 9012, 9021}
{ 9001, 9010, 9020}
{ 9001, 9010, 9021}
{ 9001, 9011, 9020}
{ 9001, 9011, 9021}
{ 9001, 9012, 9020}
{ 9001, 9012, 9021}


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