status
failed

# My first quine

I finally got around to writing a quine today, it turned out to be not so daunting once given a good chunk of thought and some experimentation. It’s not particularly pretty (well, in fact it’s very ugly indeed,) but it is mine!

n = "\n\\\"main = let f a b = (take b . drop a) n in putStrLn $f 6 4 ++ reverse (f 1 2) ++ [n!!6] ++ (replicate 3 . head . tail) n ++ drop 2 n ++ [n!!2] ++ take 1 n ++ drop 3 n" main = let f a b = (take b . drop a) n in putStrLn$ f 6 4 ++ reverse (f 1 2) ++ [n!!6] ++ (replicate 3 . head . tail) n ++ drop 2 n ++ [n!!2] ++ take 1 n ++ drop 3 n

I later realised it could be done much better by using two putStrLns and a show to avoid having to encode special characters in the first string. Therefore I present my second quine!

n = "main = putStrLn ((take 4 . drop 3) n ++ show n) >> putStrLn n"
main = putStrLn ((take 4 . drop 3) n ++ show n) >> putStrLn n