Advertisement
Guest User

Untitled

a guest
Nov 14th, 2013
293
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. template<class T, class F>
  2. auto fmap(F f, List<T> lst) -> List<decltype(f(lst.front()))>
  3. {
  4.     if (lst.isEmpty())
  5.         return List<decltype(f(lst.front()))>();
  6.     else
  7.         return List<decltype(f(lst.front()))>(f(lst.front()), fmap(f, lst.pop_front()));
  8. }
Advertisement
RAW Paste Data Copied
Advertisement