1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[WIP]javascript 関数合成

1
Last updated at Posted at 2015-01-28

下記関数
$f(x) = x +3$
$g(x) = x * 2$
から
関数
$h(x) = f(g(x)) = (x * 2) + 3 $
を作る方法

>function(x){return x + 3}
>function(x){return x * 2}
//関数を合成するための関数composeを定義
>function compose(f,g){return function(x){return f(g(x))}}
>h = compose(f,g)
>h(2)
< 7
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?