aboutsummaryrefslogtreecommitdiffstats
path: root/system/doc/programming_examples/fun_test.erl
blob: 8472fd87f8668bf246640be4e634c1672e6d112b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
%1
-module(fun_test).
-export([t1/0, t2/0, t3/0, t4/0, double/1]).
-import(lists, [map/2]).

t1() -> map(fun(X) -> 2 * X end, [1,2,3,4,5]).

t2() -> map(fun double/1, [1,2,3,4,5]).

t3() -> map({?MODULE, double}, [1,2,3,4,5]).

double(X) -> X * 2.
%1


t4() ->
    "hello world".