2010. 12. 4. 02:10
Programing erlang p.71

Most effient way to make a list. Insert into a head.

some_function([H|T], ..., Result, ...) ->
   H1 = ... H ...,
   some_function(T, ..., [H1 | Result ], ...);
some_function([], ..., Result, ...) ->
   {..., Result, ...}.

Use function lists:reverse to reverse Result(list).
Don't use operation ++ (ex: List ++ [H])

programming erlnag p.168
-module(ctemplate).
-compile(exprot_all).

start() ->
   spawn(fun() -> loop([]) end).

rpc(Pid, Request) ->
   Pid ! {self(), Request},
   receive
      {Pid, Response} ->
            Response
   end.

loop(X) ->
   receive
      Any ->
        io:format("Received:~p~n", [Any]),
        loop(X)
   end.

Use TDD strategy.
Use erlang shell as small steps on TDD.
Posted by newpolaris