定时打印消息
1> FLoop = fun(Pid)-> Lfun = fun(F,Pid) -> receive loop->io:format("test",[]),erlang:send_after(1000,Pid,loop),F(F,Pid) end end,Lfun(Lfun,Pid) end.
2> spawn(fun()-> FLoop(self()) end).
3> erlang:send(v(2), loop).
其他相关:
http://stackoverflow.com/questions/867418/how-do-you-write-a-fun-thats-recursive-in-erlang/867525