Echo server: Difference between revisions

Content added Content deleted
(Add LFE version of echo server based on the Erlang version)
m (→‎{{header|LFE}}: Changed to more standard syntax for pattern matching)
Line 1,157: Line 1,157:
(defun handle (conn)
(defun handle (conn)
(receive
(receive
((tuple 'tcp conn data)
(`#(tcp ,conn ,data)
(gen_tcp:send conn data))
(gen_tcp:send conn data))
((tuple 'tcp_closed conn)
(`#(tcp_closed ,conn)
(lfe_io:format "Connection closed: ~p~n" (list conn)))))
(lfe_io:format "Connection closed: ~p~n" (list conn)))))
</lang>
</lang>