Showing posts with label boost::mpl. Show all posts
Showing posts with label boost::mpl. Show all posts

Aug 26, 2016

[FP] Related read/study links

Reading/learning process:
  1. C++ template, the definitive guide
  2. Modern C++ design
  3. -- Above 2 books are essential for me to understand the type system in programming language in general. --
  4. Functors, Applicatives, And Monads In Pictures
  5. Yet Another Monad Tutorial (part 2: >>= and return)
  6. Monads in C++
  7. functional-cpp
  8. PyMonad
  9. Functional Programming Patterns (NDC London 2014)
  10. Railway Oriented Programming


Used boost::mpl in SRM code base intensively; as for daily coding,
having pure function, function composition in mind as the basic design of the programs.


Resources:
Category Theory:
Category Theory for the Sciences


Monad:
--
Yet Another Monad Tutorial (part 2: >>= and return)
--
Functors, Applicatives, And Monads In Pictures
Monads Demystified
Using Monads in C++ to Solve Constraints: 1. The List Monad
Monads in C++
Haskell/Understanding monads
Monad 最简介绍
函数式编程
單子 (monad) 入門(一)
單子 (monad) 入門(二)讀取單子
Understanding_monads


Condition & restarts:
Conditions and Restarts
What's a condition system and why do you want one?
Google group discussion: A tale of restarts


FP slides:
Functional Programming Patterns (NDC London 2014)
Railway Oriented Programming


Jargon of FP:
functional-programming-jargon


Haskell:
Learn You a Haskell for Great Good!
A Fistful of Monads


FP in C++ Document:
functional-cpp


C++ FP Library:
Hana Library: Monad
https://cat.github.io/
FTL - The Functional Template Library
FC++: Functional Programming in C++


Python Library:
PyMonad


javascript:
Monads in JavaScript (7 min read)


Reddit talk:
reddit

Dec 6, 2012

[boost][mpl] lambda example typo

In Boost::mpl::lambda 's example, the code:
template< typename N1, typename N2 > struct int_plus
    : int_<( N1::value + N2::value )>
{
};

typedef lambda< int_plus<_1, int_<42> > >::type f1;
typedef bind< quote2<int_plus>, _1, int_<42> > f2;

typedef f1::apply<42>::type r1;
typedef f2::apply<42>::type r2;

BOOST_MPL_ASSERT_RELATION( r1::value, ==, 84 );
BOOST_MPL_ASSERT_RELATION( r2::value, ==, 84 );

should be:
template< typename N1, typename N2 > struct int_plus
    : int_<( N1::value + N2::value )>
{
};

typedef lambda< int_plus<_1, int_<42> > >::type f1;
typedef bind< quote2<int_plus>, _1, int_<42> > f2;

typedef f1::apply<int_<42> >::type r1;
typedef f2::apply<int_<42> >::type r2;

BOOST_MPL_ASSERT_RELATION( r1::value, ==, 84 );
BOOST_MPL_ASSERT_RELATION( r2::value, ==, 84 );