Advertisement
Guest User

Untitled

a guest
Jun 21st, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.24 KB | None | 0 0
  1. -module(chatbot).
  2. % build a chatbot that just echoes your msg back
  3. -export([chatback/0, chat/1]).
  4.  
  5. chatback() ->
  6.   receive
  7.     M -> io:format("~s~n", [M]),
  8.     chatback()
  9.   end.
  10.  
  11. CB = spawn(chatbot, chatback, []).
  12.  
  13. chat(M) ->
  14.   CB ! M.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement