This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package functionalcomposition; | |
public abstract class AbstractFunction implements Function { | |
@Override | |
public Function compose(final Function f) { | |
return new AbstractFunction() { | |
@Override | |
public double apply(double x) { | |
return AbstractFunction.this.apply(f.apply(x)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace FunctionalComposition | |
{ | |
class FunctionalComposition | |
{ | |
static void Main(string[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace FunctionalComposition | |
{ | |
class FunctionalComposition | |
{ | |
static void Main(string[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package functionalcomposition; | |
public abstract class AbstractFunction<Param, Result> implements Function<Param, Result> { | |
@Override | |
public <Param2> Function<Param2, Result> compose(final Function<Param2, Param> f) { | |
return new AbstractFunction<Param2, Result>() { | |
@Override | |
public Result apply(Param2 x) { | |
return AbstractFunction.this.apply(f.apply(x)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<functional> | |
#include<cmath> | |
using namespace std; | |
using namespace std::tr1; | |
template<typename Param, typename Middle, typename Result> | |
function<Result(Param)> compose(const function<Result(Middle)>& f, const function<Middle(Param)>& g) { | |
return [f, g](Param x){return f(g(x));}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<functional> | |
#include<cmath> | |
using namespace std; | |
using namespace std::tr1; | |
template<typename Param, typename Result> | |
class Function { | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/runhaskell | |
module Main ( | |
main | |
) where | |
f = exp | |
g = (** 2) | |
h = (+ 1) . negate | |
main = print $ (f.g.h) 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[color] | |
ui = true | |
[alias] | |
log-graph = log --graph --decorate --abbrev-commit --all | |
[core] | |
editor = emacs | |
#editor = nano | |
[credential] | |
helper = cache | |
[gui] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<functional> | |
#include<cmath> | |
using namespace std; | |
using namespace std::tr1; | |
template<typename Param, typename Result> | |
class Function { | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<functional> | |
#include<cmath> | |
using namespace std; | |
using namespace std::tr1; | |
template<typename Param, typename Result> | |
class Function { | |
public: |