Echo server: Difference between revisions
Content added Content deleted
m (→{{header|LFE}}: Changed to more standard syntax for pattern matching) |
m (→{{header|LFE}}: Tweaked for LFE) |
||
Line 1,131: | Line 1,131: | ||
=={{header|LFE}}== |
=={{header|LFE}}== |
||
{{trans|Erlang}} |
|||
⚫ | |||
;;; |
|||
;;; This is a straight port from the Erlang version. |
|||
;;; |
|||
;;; You can run this in the LFE REPL by slurping the file: |
|||
;;; |
|||
;;; > (slurp "echo_server.lfe") |
|||
;;; > (start) |
|||
;;; |
|||
(defmodule echo |
|||
⚫ | |||
PAste into the LFE REPL: |
|||
⚫ | |||
(defun start () |
(defun start () |
||
(spawn (lambda () |
(spawn (lambda () |
||
Line 1,162: | Line 1,154: | ||
(lfe_io:format "Connection closed: ~p~n" (list conn))))) |
(lfe_io:format "Connection closed: ~p~n" (list conn))))) |
||
</lang> |
</lang> |
||
Usage: |
|||
<pre> |
|||
⚫ | |||
<0.38.0> |
|||
> (! server "hey!") |
|||
"hey!" |
|||
> (! server "wassup?") |
|||
"wassup?" |
|||
</pre> |
|||
=={{header|Nim}}== |
=={{header|Nim}}== |