Fleet
0.0.9
Inference in the LOT
src
Functional.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <functional>
4
#include <cassert>
5
6
/* Some helpful functions for functional programming. This defines
7
*
8
* The type ft<a,b,c> is a std::function that takes b,c as arguments and returns a
9
*
10
* */
11
12
13
template
<
typename
out,
typename
... args>
14
using
ft
= std::function<out(args...)>;
15
16
// compose f and g: f(g(args))
17
template
<
typename
Fout,
typename
Gout,
typename
... Gargs >
18
ft
<Fout,Gargs...>
compose
(
ft<Fout,Gout>
& f,
ft<Gout, Gargs...>
& g) {
19
return
[=](Gargs... args) {
return
f(g(args...)); };
20
}
compose
ft< Fout, Gargs... > compose(ft< Fout, Gout > &f, ft< Gout, Gargs... > &g)
Definition:
Functional.h:18
ft
std::function< out(args...)> ft
Definition:
Functional.h:14
Generated by
1.8.13