~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to system/doc/programming_examples/fun_test.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2010-03-09 17:34:57 UTC
  • mfrom: (10.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100309173457-4yd6hlcb2osfhx31
Tags: 1:13.b.4-dfsg-3
Manpages in section 1 are needed even if only arch-dependent packages are
built. So, re-enabled them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%1
 
2
-module(fun_test).
 
3
-export([t1/0, t2/0, t3/0, t4/0, double/1]).
 
4
-import(lists, [map/2]).
 
5
 
 
6
t1() -> map(fun(X) -> 2 * X end, [1,2,3,4,5]).
 
7
 
 
8
t2() -> map(fun double/1, [1,2,3,4,5]).
 
9
 
 
10
t3() -> map({?MODULE, double}, [1,2,3,4,5]).
 
11
 
 
12
double(X) -> X * 2.
 
13
%1
 
14
 
 
15
 
 
16
t4() ->
 
17
    "hello world".