Quine in Erlang

How could I have forgotten about the friend of mine who's fond of Erlang? :-D

-module(q).
-export([s/0]).

s()->io:format("~s~p.\n",[p(),p()]).

p()->"-module(q).\n-export([s/0]).\n\ns()->io:format(\"~s~p.\\n\",[p(),p()]).\n\np()->".


Here's another one for the Eshell REPL:
fun(P)->io:format("~s\n~p).\n",[P,P])end(
"fun(P)->io:format(\"~s\\n~p).\\n\",[P,P])end(").


And as I know he's also in love with LISP, here's a Haskell variant rewritten in that spirit:
(\ (x)-> ((++) x (show x)))"(\\ (x)-> ((++) x (show x)))"

Comments

Popular posts from this blog

Hidden TFTP of TP-Link routers

Tftp secret of TL-WR740N uncovered

When both Google *and* AppStatus is down